Re: libtool won't link with static libraries (solved)
*** Warning: Trying to link with static lib archive /usr/i486-mingw32/lib/libboost_filesystem-mt-s.a. *** I have the capability to make that library automatically link in when *** you link to this library. But I can only do this if you have a *** shared version of the library, which you do not appear to have *** because the file extensions .a of this argument makes me believe *** that it is just a static archive that I should not use here. Ok, finally figured out what's going on here. libtool is in fact doing the correct thing, the static library should not be linked in with the shared library I am building (otherwise things could end up being defined multiple times when linked against the shared library.) The undefined references I was getting were in fact unrelated to the error, and were caused by issues between Boost and mingw32. Luckily a simple #define could remove the offending code and everything compiled successfully, with the above warning still appearing. When the time came to compile actual executables, libtool correctly linked in both the shared and static libraries as requested, so everything now works as expected! Cheers, Adam. ___ https://lists.gnu.org/mailman/listinfo/libtool
Re: libtool won't link with static libraries
*** Warning: Trying to link with static lib archive /usr/i486-mingw32/lib/libboost_filesystem-mt-s.a. *** I have the capability to make that library automatically link in when *** you link to this library. But I can only do this if you have a *** shared version of the library, which you do not appear to have *** because the file extensions .a of this argument makes me believe *** that it is just a static archive that I should not use here. I've discovered that if I manually add the .a files back into the g++ command that libtool runs, then it will be linked correctly. So the problem is definitely due to libtool discarding the .a files given to it instead of listing them along with the other libraries when it calls g++. Does anyone know what could cause this? Or how to force libtool to pass the filename through as-is? Thanks, Adam. ___ https://lists.gnu.org/mailman/listinfo/libtool
Re: libtool won't link with static libraries
On Wednesday, April 27, 2011 22:49:11 Adam Nielsen wrote: I'm trying to cross-compile a library under Linux to produce a Win32 .dll. It needs to link in with static Boost libraries (which were also cross compiled on the same machine) but libtool seems to refuse to do this: *** Warning: Trying to link with static lib archive /usr/i486-mingw32/lib/libboost_filesystem-mt-s.a. *** I have the capability to make that library automatically link in when *** you link to this library. But I can only do this if you have a *** shared version of the library, which you do not appear to have *** because the file extensions .a of this argument makes me believe *** that it is just a static archive that I should not use here. This is the libtool command in question - but as it is all handled by autoconf I'm not sure what I'm doing wrong! /bin/sh ../libtool --tag=CXX --mode=link i486-mingw32-g++ -g -O2 -release 0.1 -version-info 0 -no-undefined -o libblah.la -rpath /usr/i486-mingw32/local/lib blah1.lo blah2.lo /usr/i486-mingw32/lib/libboost_system-mt-s.a /usr/i486-mingw32/lib/libboost_filesystem-mt-s.a /usr/i486-mingw32/lib/libboost_system-mt-s.a -L/usr/i486-mingw32/local/lib -lblah3 I get a second error the same as the first for the other .a file. The two libraries are definitely not being linked, because the next step in the process results in: .libs/blah.o: In function `__static_initialization_and_destruction_0': /usr/lib/gcc/i486-mingw32/4.5.2/../../../../i486-mingw32/include/boost/syst em/error_code.hpp:214: undefined reference to `boost::system::generic_category()' /usr/lib/gcc/i486-mingw32/4.5.2/../../../../i486-mingw32/include/boost/syst em/error_code.hpp:215: undefined reference to `boost::system::generic_category()' /usr/lib/gcc/i486-mingw32/4.5.2/../../../../i486-mingw32/include/boost/syst em/error_code.hpp:216: undefined reference to `boost::system::system_category()' collect2: ld returned 1 exit status when statically linking, order is significant -mike signature.asc Description: This is a digitally signed message part. ___ https://lists.gnu.org/mailman/listinfo/libtool
Re: libtool won't link with static libraries
*** Warning: Trying to link with static lib archive /usr/i486-mingw32/lib/libboost_filesystem-mt-s.a. *** I have the capability to make that library automatically link in when *** you link to this library. But I can only do this if you have a *** shared version of the library, which you do not appear to have *** because the file extensions .a of this argument makes me believe *** that it is just a static archive that I should not use here. when statically linking, order is significant -mike I just tried putting the .a files first, before any of the object files, as well as before and after the object file where the undefined references appear, but in every case I get the libtool warnings that it's not linking the library and then of course the resulting undefined references. Where should I be placing the libraries on the command line so that libtool will not ignore them? Thanks, Adam. ___ https://lists.gnu.org/mailman/listinfo/libtool
libtool won't link with static libraries
Hi all, I'm trying to cross-compile a library under Linux to produce a Win32 .dll. It needs to link in with static Boost libraries (which were also cross compiled on the same machine) but libtool seems to refuse to do this: *** Warning: Trying to link with static lib archive /usr/i486-mingw32/lib/libboost_filesystem-mt-s.a. *** I have the capability to make that library automatically link in when *** you link to this library. But I can only do this if you have a *** shared version of the library, which you do not appear to have *** because the file extensions .a of this argument makes me believe *** that it is just a static archive that I should not use here. This is the libtool command in question - but as it is all handled by autoconf I'm not sure what I'm doing wrong! /bin/sh ../libtool --tag=CXX --mode=link i486-mingw32-g++ -g -O2 -release 0.1 -version-info 0 -no-undefined -o libblah.la -rpath /usr/i486-mingw32/local/lib blah1.lo blah2.lo /usr/i486-mingw32/lib/libboost_system-mt-s.a /usr/i486-mingw32/lib/libboost_filesystem-mt-s.a /usr/i486-mingw32/lib/libboost_system-mt-s.a -L/usr/i486-mingw32/local/lib -lblah3 I get a second error the same as the first for the other .a file. The two libraries are definitely not being linked, because the next step in the process results in: .libs/blah.o: In function `__static_initialization_and_destruction_0': /usr/lib/gcc/i486-mingw32/4.5.2/../../../../i486-mingw32/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()' /usr/lib/gcc/i486-mingw32/4.5.2/../../../../i486-mingw32/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()' /usr/lib/gcc/i486-mingw32/4.5.2/../../../../i486-mingw32/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()' collect2: ld returned 1 exit status Can anyone offer any pointers as to what might be going on? Why won't libtool use the static library? Many thanks, Adam. ___ https://lists.gnu.org/mailman/listinfo/libtool