Re: Problem linking with static libraries on Darwin (not the architecture being linked)

2012-10-18 Thread Bob Friesenhahn



$ make CFLAGS='-arch x86_64' CXXFLAGS='-arch x86_64' LDFLAGS='-framework 
CoreFoundation -framework CoreServices 
-L$HOME/build/sfAgent/libs/Release_Static/lib'


But when the build goes to link an executable:


/bin/sh ./libtool --tag=CXX   --mode=link c++  -arch x86_64  -framework 
CoreFoundation -framework CoreServices 
-L/Users/bradenmcdaniel/build/sfAgent/libs/Release_Static/lib -o xqilla 
xqilla-commandline.o libxqilla.la -lpthread 
/Users/bradenmcdaniel/build/my/install/root/lib/libxerces-c.a 
/Users/bradenmcdaniel/build/my/install/root/lib/libcurl.a 
/Users/bradenmcdaniel/build/my/install/root/lib/libssl.a 
/Users/bradenmcdaniel/build/my/install/root/lib/libcrypto.a
libtool: link: c++ -arch x86_64 -o xqilla xqilla-commandline.o 
-Wl,-bind_at_load  -L/Users/bradenmcdaniel/build/my/install/root/lib 
./.libs/libxqilla.a -lpthread 
/Users/bradenmcdaniel/build/my/install/root/lib/libxerces-c.a 
/Users/bradenmcdaniel/build/my/install/root/lib/libcurl.a 
/Users/bradenmcdaniel/build/my/install/root/lib/libssl.a 
/Users/bradenmcdaniel/build/my/install/root/lib/libcrypto.a -framework 
CoreServices -framework CoreFoundation
ld: warning: ignoring file ./.libs/libxqilla.a, file was built for archive 
which is not the architecture being linked (x86_64): ./.libs/libxqilla.a
Undefined symbols for architecture x86_64:
  NSFixupFilter::NSFixupFilter(EventHandler*, XPath2MemoryManager*), 
referenced from:
  _main in xqilla-commandline.o
  NSFixupFilter::~NSFixupFilter(), referenced from:
  _main in xqilla-commandline.o

(…and many more symbols that would be resolved by libxqilla.)

Has anyone else seen this sort of thing?  And might this warning from the 
linker indicate something other than what it claims?


It looks like the program called 'c++' (is it GCC? clang?) is either 
not passing the -arch option down to 'ld' or 'ld' does not respond to 
it.


You might try adding

  LDFLAGS=-Wl,-arch,x86_64

and/or add '-v' to CXXFLAGS to cause the compiler to dump the details 
of what it is doing so you can see the arguments it is passing to the 
linker.


Also please check that ./.libs/libxqilla.a really does contain 64-bit 
objects.  Some linkers use the mode from the first object file they 
encounter.


Bob
--
Bob Friesenhahn
bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,http://www.GraphicsMagick.org/___
https://lists.gnu.org/mailman/listinfo/libtool


Problem linking with static libraries on Darwin (not the architecture being linked)

2012-10-17 Thread Braden McDaniel
I'm experiencing a problem linking with static libraries on Darwin (Mountain 
Lion).  I'm getting this warning:

 ld: warning: ignoring file ./.libs/libxqilla.a, file was built for archive 
 which is not the architecture being linked (x86_64): ./.libs/libxqilla.a

…even though I'm pretty confident that the objects in libxqilla.a were built 
with -arch x86_64 (like everything else built here).

Backing up a bit, I have doctored things in the xqilla build a bit in order to 
create a static library and use some static libraries as dependencies.  
configure was run thusly:

 $ ../../Source/XQilla/configure --with-xerces=$HOME/build/my/install/root 
 --disable-shared CC=cc CXX=c++ CFLAGS='-arch x86_64' CXXFLAGS='-arch x86_64' 
 LDFLAGS=-framework CoreFoundation -framework CoreServices 
 -L$HOME/build/my/install/root/lib 
 LIBS=$HOME/build/my/install/root/lib/libxerces-c.a 
 $HOME/build/my/install/root/lib/libcurl.a 
 $HOME/build/my/install/root/lib/libssl.a 
 $HOME/build/my/install/root/lib/libcrypto.a

…and when I build, I override CFLAGS, CXXFLAGS, and LDFLAGS (to account for 
problematic settings of these variables in the Makefile):

 $ make CFLAGS='-arch x86_64' CXXFLAGS='-arch x86_64' LDFLAGS='-framework 
 CoreFoundation -framework CoreServices 
 -L$HOME/build/sfAgent/libs/Release_Static/lib'

But when the build goes to link an executable:

 /bin/sh ./libtool --tag=CXX   --mode=link c++  -arch x86_64  -framework 
 CoreFoundation -framework CoreServices 
 -L/Users/bradenmcdaniel/build/sfAgent/libs/Release_Static/lib -o xqilla 
 xqilla-commandline.o libxqilla.la -lpthread 
 /Users/bradenmcdaniel/build/my/install/root/lib/libxerces-c.a 
 /Users/bradenmcdaniel/build/my/install/root/lib/libcurl.a 
 /Users/bradenmcdaniel/build/my/install/root/lib/libssl.a 
 /Users/bradenmcdaniel/build/my/install/root/lib/libcrypto.a
 libtool: link: c++ -arch x86_64 -o xqilla xqilla-commandline.o 
 -Wl,-bind_at_load  -L/Users/bradenmcdaniel/build/my/install/root/lib 
 ./.libs/libxqilla.a -lpthread 
 /Users/bradenmcdaniel/build/my/install/root/lib/libxerces-c.a 
 /Users/bradenmcdaniel/build/my/install/root/lib/libcurl.a 
 /Users/bradenmcdaniel/build/my/install/root/lib/libssl.a 
 /Users/bradenmcdaniel/build/my/install/root/lib/libcrypto.a -framework 
 CoreServices -framework CoreFoundation
 ld: warning: ignoring file ./.libs/libxqilla.a, file was built for archive 
 which is not the architecture being linked (x86_64): ./.libs/libxqilla.a
 Undefined symbols for architecture x86_64:
   NSFixupFilter::NSFixupFilter(EventHandler*, XPath2MemoryManager*), 
 referenced from:
   _main in xqilla-commandline.o
   NSFixupFilter::~NSFixupFilter(), referenced from:
   _main in xqilla-commandline.o
(…and many more symbols that would be resolved by libxqilla.)

Has anyone else seen this sort of thing?  And might this warning from the 
linker indicate something other than what it claims?

Braden


___
https://lists.gnu.org/mailman/listinfo/libtool