Discussion:
[Mingw-cross-env-list] incorrect link search directories and libraries
Richard Crozier
2017-05-29 11:10:26 UTC
Permalink
I'm cross compiling an autotools project, and hoping someone on this
list might be able to help me with an issue I have.

I configured like this:

./configure --host=x86_64-w64-mingw32.static CXXFLAGS="-D_P_WAIT=0
-static -static-libgcc -static-libstdc++" CFLAGS="-D_P_WAIT=0"
--enable-static --disable-shared

I get an error like below

libtool: link: x86_64-w64-mingw32.static-g++ -D_P_WAIT=0 -static-libgcc
-static-libstdc++ -pthread -pthread -Wl,--export-all-symbols -o
mbdyn.exe mbdyn.o ../mbdyn/base/.libs/libbase.a
-L/opt/mxe/usr/x86_64-w64-mingw32.static/lib -L/opt/mxe/usr/mingw/lib
aero/.libs/libaero.a struct/.libs/libstruct.a elec/.libs/libelec.a
thermo/.libs/libthermo.a hydr/.libs/libhydr.a base/.libs/libbase.a
../libraries/libmbc/.libs/libmbc_static.a
-L/usr/lib/gcc/x86_64-linux-gnu/4.8
-L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu
-L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib
-L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu
-L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../..
-lgfortran -lquadmath /usr/lib/x86_64-linux-gnu/libltdl.so -ldl
../libraries/libmbwrap/.libs/libmbwrap.a
../libraries/libann/.libs/libmbann.a
-L/opt/mxe/usr/lib/gcc/x86_64-w64-mingw32.static/5.4.0
-L/opt/mxe/usr/lib/gcc/x86_64-w64-mingw32.static/5.4.0/../../../../x86_64-w64-mingw32.static/lib/../lib
-L/opt/mxe/usr/lib/gcc/x86_64-w64-mingw32.static/5.4.0/../../../../x86_64-w64-mingw32.static/lib
/home/rcrozier/src/mbdyn/libraries/liby12/.libs/liby12.a
/opt/mxe/usr/lib/gcc/x86_64-w64-mingw32.static/5.4.0/libgfortran.a
-lmingw32 -lmoldname -lmingwex -lmsvcrt
/opt/mxe/usr/lib/gcc/x86_64-w64-mingw32.static/5.4.0/libquadmath.a
-ladvapi32 -lshell32 -luser32 -lkernel32
/opt/mxe/usr/x86_64-w64-mingw32.static/lib/libltdl.a -pthread
-L/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libltdl.so: error adding symbols: File in
wrong format
collect2: error: ld returned 1 exit status
make[2]: *** [mbdyn.exe] Error 1

In the last command there are several -L entries like

-L/usr/lib/x86_64-linux-gnu

It also links explicitly to

/usr/lib/x86_64-linux-gnu/libltdl.so

but I actually want to link only to,

/opt/mxe/usr/x86_64-w64-mingw32.static/lib/libltdl.a

which is also specified in the command. libltdl is produced by an MXE
package.

If I remove the -L entries which aren't pointing to mxe tools
directories and the reference to libltdl.so and run the command manually
this completes successfully and mbdyn.exe is produced, and it runs on a
windows machine.

My question then is, where do these entries come from? Are they
something my configure script will be generating, or is it something MXE
adds? Can anyone suggest how might I prevent them from being added?

Regards,

Richard

Loading...