bug-libtool
[Top][All Lists]
Advanced

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

--whole-archive doesn't work on OSX


From: Andrew Miller
Subject: --whole-archive doesn't work on OSX
Date: Wed, 02 Aug 2006 13:24:59 +1200
User-agent: Thunderbird 1.5.0.4 (X11/20060516)

Hi,

I have just posted a bug regarding libtool on OSX to http://savannah.gnu.org/support/index.php?func=detailitem&item_id=105489

I'm not sure if that is the right place to post bugs, so in case it isn't, here is the text of the report:

This bug tested on:
Darwin bioeng21.bioeng.auckland.ac.nz 8.7.0 Darwin Kernel Version 8.7.0: Fri May 26 15:20:53 PDT 2006; root:xnu-792.6.76.obj~1/RELEASE_PPC Power Macintosh powerpc

It seems that recent versions of libtool don't support the --whole-archive on MacOSX. This causes the --whole-archive flag to be passed to gcc (which seems to be silently ignored on OSX), resulting in a link which doesn't really contain the whole archive.
For example:

/bin/sh ./libtool --tag=CXX --mode=link g++ -g -O2 -o cellml_corba_server -lxml2 -lomniORB4 -lomnithread --whole-archive cellml_corba_server-Main.o ./libcellml_context.la ./libcellml_context_corba.la ./libcellml.la ./libcellml_corba.la ./libCORBASupport.la ./libltdlc.la g++ -g -O2 -o .libs/cellml_corba_server --whole-archive cellml_corba_server-Main.o -Wl,-bind_at_load /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
creating cellml_corba_server

bioeng21:~/physiome_builds/trees/CellML_DOM_API_OSX cmiss$ nm .libs/cellml_corba_server |grep gWrapperRepo bioeng21:~/physiome_builds/trees/CellML_DOM_API_OSX cmiss$ nm .libs/libCORBASupport.a |grep gWrapperRepo
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
00001a58 b __ZGVZ18gWrapperRepositoryvE2wr
00001a60 b __ZZ18gWrapperRepositoryvE2wr

I understand older libtools gave the -Wl,-all_load flag, which is similar to --whole-archive on the ld from GNU binutils. However, unlike GNU ld, you can't turn off all_load for some archives, and leave it on for others, so you end up messing up the linking of the implicit libraries: ^ioeng21:~/physiome_builds/trees/CellML_DOM_API_OSX cmiss$ g++ -Wl,-all_load -g -O2 -o .libs/cellml_corba_server --whole-archive cellml_corba_server-Main.o -Wl,-bind_at_load /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
/usr/bin/ld: warning multiple definitions of symbol ___eprintf
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/libgcc.a(_eprintf.o) private external definition of ___eprintf in section (__TEXT,__text) /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/libstdc++.dylib(single module) definition of ___eprintf
/usr/bin/ld: warning multiple definitions of symbol ___divdi3
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/libgcc.a(_divdi3.o) private external definition of ___divdi3 in section (__TEXT,__text) /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/libgcc_s.dylib(_divdi3_s.o) definition of ___divdi3
/usr/bin/ld: warning multiple definitions of symbol ___udivdi3
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/libgcc.a(_udivdi3.o) private external definition of ___udivdi3 in section (__TEXT,__text) /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/libgcc_s.dylib(_udivdi3_s.o) definition of ___udivdi3
/usr/bin/ld: warning multiple definitions of symbol ___umoddi3
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/libgcc.a(_umoddi3.o) private external definition of ___umoddi3 in section (__TEXT,__text) /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/libgcc_s.dylib(_umoddi3_s.o) definition of ___umoddi3

(which is presumably why older versions dropped that flag, and caused this bug).

Unless someone finds a better way, I think the correct solution will have to be to unarchive the convenience libraries and link the objects manually.

Best regards,
Andrew Miller





reply via email to

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