You are not logged in.

#1 2011-04-10 04:48:04

Malvineous
Member
From: Brisbane, Australia
Registered: 2011-02-03
Posts: 193
Website

[SOLVED] mingw32 cross compile won't link with static libraries

Hi all,

I'm trying to cross compile an app I have written to i486-mingw32.  I'm running Arch 64-bit (under which it compiles fine natively), and I have installed the mingw32 binaries along with mingw32-boost-static from AUR.

All seems well, but unfortunately when I cross compile my code libtool refuses to link to the static Boost 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.

This then leads to undefined references as the library is not linked in.  But as I *want* the static version of the library, does anyone know how to tell libtool to accept the .a file and link it?

Last edited by Malvineous (2011-05-02 02:44:48)

Offline

#2 2011-05-02 02:44:13

Malvineous
Member
From: Brisbane, Australia
Registered: 2011-02-03
Posts: 193
Website

Re: [SOLVED] mingw32 cross compile won't link with static libraries

Just to follow up on this, I discovered the problem.  It turns out libtool was doing the correct thing, and refusing to link the static library in with the shared one (otherwise later this could result in something being defined multiple times.)  The undefined references were unrelated to the error above, and the code that was causing them (in a different Boost header file) could be easily #defined out.

When the time came to link the actual executables, libtool did include all the necessary libraries and everything worked as it should!

Offline

Board footer

Powered by FluxBB