bug-libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: --whole-archive doesn't work on OSX


From: Andrew Miller
Subject: Re: --whole-archive doesn't work on OSX
Date: Tue, 15 Aug 2006 16:26:24 +1200
User-agent: Thunderbird 1.5.0.4 (X11/20060516)

Peter O'Gorman wrote:

On Aug 3, 2006, at 10:01 AM, Andrew Miller wrote:

...
However, the documentation seems to imply that the behaviour of whole-archive should happen on all platforms, for all convenience libraries.

e.g.
— Variable: *whole_archive_flag_spec*

   Compiler flag to generate shared objects from convenience archives.

If whole_archive_flag_spec is empty, as it is on darwin for more recent versions of libtool then the convenience archive will be unpacked using lipo/ar and the objects will be added to the link line.
I haven't been able to reproduce this behaviour when building binaries for either libtool-1.5.22 or current CVS libtool (although it does unpack the archive when building installable libraries from convenience libraries).

Here is the output I am getting from a current CVS libtool...

/bin/sh ./libtool --tag=CXX --mode=link g++ -g -O2 -o cellml_corba_server -lxml2 -lomniORB4 -lomnithread cellml_corba_server-Main.o ./libcellml_context.la ./libcellml_context_corba.la ./libcellml.la ./libcellml_corba.la ./libCORBASupport.la ./libltdlc.la libtool: link: g++ -g -O2 -o .libs/cellml_corba_server cellml_corba_server-Main.o -Wl,-bind_at_load /Users/cmiss/physiome_builds/trees/CellML_DOM_API_OSX/./.libs/dlopen.a /usr/lib/libxml2.dylib -lpthread -lz /usr/lib/libiconv.dylib -lm -lomniORB4 -lomnithread ./.libs/libcellml_context.dylib ./.libs/libcellml_context_corba.dylib ./.libs/libcellml.dylib ./.libs/libcellml_corba.dylib ./.libs/libCORBASupport.a ./.libs/libltdlc.a

This produces a cellml_corba_server binary which is missing symbols which are in the convenience libraries: bioeng21:~/physiome_builds/trees/CellML_DOM_API_OSX cmiss$ nm ./.libs/cellml_corba_server |grep __Z18gWrapperRepositoryv bioeng21:~/physiome_builds/trees/CellML_DOM_API_OSX cmiss$ nm ./.libs/libCORBASupport.a |grep __Z18gWrapperRepositoryv
000000ac t __GLOBAL__D__Z18gWrapperRepositoryv
00000000 a __GLOBAL__D__Z18gWrapperRepositoryv.eh
0000009c t __GLOBAL__I__Z18gWrapperRepositoryv
00000000 a __GLOBAL__I__Z18gWrapperRepositoryv.eh
00000190 T __Z18gWrapperRepositoryv
00001820 S __Z18gWrapperRepositoryv.eh

and when a module (which references __Z18gWrapperRepositoryv) is dynamically loaded into cellml_corba_server, it results in: bioeng21:~/physiome_builds/trees/CellML_DOM_API_OSX cmiss$ ./cellml_corba_server
dyld: lazy symbol binding failed: Symbol not found: __Z18gWrapperRepositoryv
Referenced from: /Users/cmiss/physiome_builds/trees/CellML_DOM_API_OSX/.libs/libcellml_context_corba.0.dylib
 Expected in: flat namespace

dyld: Symbol not found: __Z18gWrapperRepositoryv
Referenced from: /Users/cmiss/physiome_builds/trees/CellML_DOM_API_OSX/.libs/libcellml_context_corba.0.dylib
 Expected in: flat namespace

Trace/BPT trap

This works correctly on Linux (it doesn't actually need -Wl,--whole-archive here, because it gives the .a archives by name rather than with -l, meaning that the whole archive gets linked anyway):

/bin/sh ./libtool --tag=CXX --mode=link g++ -g -O2 -o cellml_corba_server -lxml2 -lomniORB4 -lomnithread cellml_corba_server-Main.o ./libcellml_context.la ./libcellml_context_corba.la ./libcellml.la ./libcellml_corba.la ./libCORBASupport.la ./libltdlc.la -ldl libtool: link: g++ -g -O2 -o .libs/cellml_corba_server cellml_corba_server-Main.o /people/amil082/code/CellML_DOM_API/./.libs/dlopen.a /home/amil082/usr//lib/libxml2.so -lz -lm -lomniORB4 -lomnithread ./.libs/libcellml_context.so ./.libs/libcellml_context_corba.so ./.libs/libcellml.so ./.libs/libcellml_corba.so ./.libs/libCORBASupport.a ./.libs/libltdlc.a -ldl -Wl,-rpath -Wl,/home/amil082/usr//lib -Wl,-rpath -Wl,/home/amil082/tmp/cda/lib address@hidden CellML_DOM_API]$ nm ./.libs/cellml_corba_server |grep gWrapperRepo
0804af20 t _GLOBAL__D__Z18gWrapperRepositoryv
0804af30 t _GLOBAL__I__Z18gWrapperRepositoryv
0804af50 T _Z18gWrapperRepositoryv
080526b0 b _ZGVZ18gWrapperRepositoryvE2wr
080526b8 b _ZZ18gWrapperRepositoryvE2wr
address@hidden CellML_DOM_API]$ ./cellml_corba_server

Extracting the objects from the archives for binary builds as well as library builds for platforms where whole-archive is empty should fix this.

Best regards,
Andrew Miller





reply via email to

[Prev in Thread] Current Thread [Next in Thread]