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

2006-08-14 Thread Andrew Miller

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

00ac t __GLOBAL__D__Z18gWrapperRepositoryv
 a __GLOBAL__D__Z18gWrapperRepositoryv.eh
009c t __GLOBAL__I__Z18gWrapperRepositoryv
 a __GLOBAL__I__Z18gWrapperRepositoryv.eh
0190 T __Z18gWrapperRepositoryv
1820 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
[EMAIL PROTECTED] 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
[EMAIL PROTECTED] 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



___
Bug-libtool mailing list
Bug-libtool@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-libtool


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

2006-08-02 Thread Peter O'Gorman


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


Peter O'Gorman wrote:


On Aug 2, 2006, at 10:24 AM, Andrew Miller wrote:


Hi,

I have just posted a bug regarding libtool on OSX to http:// 
savannah.gnu.org/support/index.php?func=detailitemitem_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:


--whole-archive is not a libtool flag, where do you see  
documentation that states you can pass --whole-archive to libtool?
After looking into this, I couldn't find anywhere, so I guess it  
just ended up in my tree from before libtool was used.


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.


Peter



___
Bug-libtool mailing list
Bug-libtool@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-libtool


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

2006-08-02 Thread Andrew Miller

Peter O'Gorman wrote:


On Aug 2, 2006, at 10:24 AM, Andrew Miller wrote:


Hi,

I have just posted a bug regarding libtool on OSX to 
http://savannah.gnu.org/support/index.php?func=detailitemitem_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:


--whole-archive is not a libtool flag, where do you see documentation 
that states you can pass --whole-archive to libtool?
After looking into this, I couldn't find anywhere, so I guess it just 
ended up in my tree from before libtool was used.


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.

BTW I found out that although the old behaviour results in compiler 
warnings on OSX, they still produce the correct result (otherwise you 
can end up missing symbols which are needed by libraries).


Best regards,
Andrew Miller



___
Bug-libtool mailing list
Bug-libtool@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-libtool