17 May, 2015, Zeno wrote in the 1st comment:
Votes: 0
I'm using some old code by Samson and Eizneckam that does dynamic do_function linking. The code is like:

asection *s;
s = bfd_get_section_by_name( abfd, "__exported_do_funs" );


But it's not linking to the lib correctly and I'm not sure why.

I get:

Quote
line 9500: undefined reference to `bfd_get_section_by_name'


In mud.h I have:

#include <bfd.h> /* Eizneckam's BFD Code */


The link I have with gcc is:

/usr/bin/gcc    -lcrypt -lz -lbfd -liberty -lm -lmysqlclient -lnsl -L/usr/lib/mysql -I/usr/include/mysql/ -o


-lbfd is correct right?

Any thoughts on why it's not finding the lib?
17 May, 2015, Davion wrote in the 2nd comment:
Votes: 0
All I can think of off the top of my head, is the shared library isn't in the included path. Find out where it's located, and try adding the directory. Via -I /path/to/lib
17 May, 2015, Zeno wrote in the 3rd comment:
Votes: 0
I found the .a and I just tried using -L

/usr/bin/gcc    -lcrypt -lz -lbfd -liberty -lm -lmysqlclient -lnsl -L/usr/lib/mysql -I/usr/include/mysql/ -L/usr/lib/libbfd.a -o smaug


Still undefined refs though. I'll see about -I
17 May, 2015, Davion wrote in the 4th comment:
Votes: 0
Zeno said:
I found the .a and I just tried using -L

/usr/bin/gcc    -lcrypt -lz -lbfd -liberty -lm -lmysqlclient -lnsl -L/usr/lib/mysql -I/usr/include/mysql/ -L/usr/lib/libbfd.a -o smaug


Still undefined refs though. I'll see about -I


That's odd. If it's just in /usr/lib you shouldn't need to do anything. -L should just be used with a directory. So using it would be -L/usr/lib/ -lbfd
17 May, 2015, Zeno wrote in the 5th comment:
Votes: 0
Yeah still can't figure it out. Here's the full make output: http://biyg.org/maketxt.txt

I feel like there's a ref somewhere pointing to the wrong lib, but I see nothing in the Makefile wrong…
17 May, 2015, Davion wrote in the 6th comment:
Votes: 0
What if you move the include directly into the .c file? Shouldn't matter but, I've seen weirder.
18 May, 2015, Zeno wrote in the 7th comment:
Votes: 0
I did try include in both mud.h and the c file, same error. Didn't try only the c file yet, as I got a lot of undefined functions from what was in mud.h

SOLVED! http://stackoverflow.com/questions/20915...
0.0/7