Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - linking shared libraries: unresolved symbol: (3 Items)
   
linking shared libraries: unresolved symbol  
I want to link binary1 that uses symbols from libA.so. libA uses symbols from libB.so.

Linking binary1 against shared lib "libA.so" results in unresolved symbol messages. The unresolved symbols are located 
in libB.so.

objdump shows for libA.so:
"NEEDED libB.so"
Because of this output I supose, that libA.so is linked against libB.so.

I do not want that symbols from libB.so are visible in binary1 but only in libA.so. Thus linking binary1 against libB.so
 is no option.

Why does the linker complain?
Re: linking shared libraries: unresolved symbol  
I assume you don't specify this library when you do final linking? Linker still needs it, when you create .so symbols 
are not actually resolved.

On 09/12/10 10:01 AM, Thomas Schickentanz wrote:
> I want to link binary1 that uses symbols from libA.so. libA uses symbols from libB.so.
> 
> Linking binary1 against shared lib "libA.so" results in unresolved symbol messages. The unresolved symbols are located
 in libB.so.
> 
> objdump shows for libA.so:
> "NEEDED libB.so"
> Because of this output I supose, that libA.so is linked against libB.so.
> 
> I do not want that symbols from libB.so are visible in binary1 but only in libA.so. Thus linking binary1 against libB.
so is no option.
> 
> Why does the linker complain?
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post78045
> 
Re: linking shared libraries: unresolved symbol  
If your goal is to not have libB mentioned in NEEDED list of your
executable, you can prepend --no-add-needed before adding libB.so to ld
command line.

You still have to specify it though.

If you are using our build system, then you should be able to do
something like this in your common.mk:

LIBPREF_B=-Wl,--no-add-needed
LIBS+=  B
LIBPOST_B=-Wl,--add-needed

this should be before "include qtargets.mk"

It will not list it if you haven't referenced any symbols from it in
your executable.

On Thu, 2010-12-09 at 10:01 -0500, Thomas Schickentanz wrote:
> I want to link binary1 that uses symbols from libA.so. libA uses
> symbols from libB.so.
> 
> Linking binary1 against shared lib "libA.so" results in unresolved
> symbol messages. The unresolved symbols are located in libB.so.
> 
> objdump shows for libA.so:
> "NEEDED libB.so"
> Because of this output I supose, that libA.so is linked against
> libB.so.
> 
> I do not want that symbols from libB.so are visible in binary1 but
> only in libA.so. Thus linking binary1 against libB.so is no option.
> 
> Why does the linker complain?
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post78045
> 
> 
>