Operating System - HP-UX
1753864 Members
7568 Online
108809 Solutions
New Discussion юеВ

GCC doesn't link libraries properly

 
SOLVED
Go to solution
Kalin Evtimov
Regular Advisor

GCC doesn't link libraries properly

Hi!
I am compiling a program with gcc, but although I have a linker opition -lrrd, which should link to a librrd.so library, it doesn't. If I use chatr on the compiled file, I see:

64-bit ELF shared library
shared library dynamic path search:
LD_LIBRARY_PATH enabled first
SHLIB_PATH enabled second
embedded path enabled third -lrrd
shared library list:
libm.so.1
shared vtable support disabled

This library is not in the shared list!
Does anybody know why?

P.S. What does the +b option of gcc mean?

Thank you!
3 REPLIES 3
Amit Agarwal_1
Trusted Contributor
Solution

Re: GCC doesn't link libraries properly

It is not necessary that your application is actually dependent on libraries that you link with. You can specify any number of libraries at the link time, but linker will keep only those names which resolves any external refernces in application.

In your case, it seems that your application is not calling any procedure/function defined in librrd.so. Hence it is not shown in the chatr output.

-Amit
Kalin Evtimov
Regular Advisor

Re: GCC doesn't link libraries properly

But this librray is actually called when the application is run, and I get error:

Unsatisfied code symbol 'rrd_clear_error'

and this symbol is exactly contained in librrd.so

Kalin Evtimov
Regular Advisor

Re: GCC doesn't link libraries properly

I got it! It was actually the option +b, which should look like +b(library/path/), but within my makefile it had not parameters, so I added them and it worked so far..