This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Multilib seems to fail for mingw-w64 build
- From: FX <fxcoudert at gmail dot com>
- To: GCC Development <gcc at gcc dot gnu dot org>
- Cc: ktietz70 at googlemail dot com, 10walls at gmail dot com
- Date: Fri, 13 Jan 2017 13:25:53 +0100
- Subject: Multilib seems to fail for mingw-w64 build
- Authentication-results: sourceware.org; auth=none
Hi,
I am trying to compile a multilib-enabled GCC cross-compiler targetting mingw-w64. I have the mingw-w64 headers installed, the CRT built for both 32- and 64-bit, and installed (with libs in $ROOT/x86_64-w64-mingw32/lib32 and $ROOT/x86_64-w64-mingw32/lib respectively).
Building the compiler itself work, but it fails to link 32-bit libgcc because it is not looking for the mingw libraries in the right place. The configure line is:
../gcc-src/configure --prefix=$ROOT --with-sysroot=$ROOT --disable-werror --target=x86_64-w64-mingw32 --enable-targets=all
but when it gets to link 32-bit libgcc_s_sjlj-1.dll, it fails because it is searching for 32-bit libmingwthrd.a in the 64-bit library directory:
/Users/fx/devel/mingw-w64/cross/x86_64-w64-mingw32/bin/ld: skipping incompatible /Users/fx/devel/mingw-w64/cross/x86_64-w64-mingw32/lib/libmingwthrd.a when searching for -lmingwthrd
The reason behind that is simply that, when building 32-bit libgcc, the wrong flags are passed to xgcc:
-L$ROOT/x86_64-w64-mingw32/lib -L$ROOT/mingw/lib -isystem $ROOT/x86_64-w64-mingw32/include -isystem $ROOT/mingw/include -B$ROOT/x86_64-w64-mingw32/bin/ -B$ROOT/x86_64-w64-mingw32/lib/ -isystem $ROOT/x86_64-w64-mingw32/include -isystem $ROOT/x86_64-w64-mingw32/sys-include
These flags all refer to lib instead of lib32.
I can reproduce the problem with both GCC trunk and GCC 6.3.0. Have I missed a configuration flag? Otherwise it seems like a bug in the multilib setup, because the target configuration file seems correct:
$ cat gcc/config/i386/t-mingw-w64
MULTILIB_OPTIONS = m64/m32
MULTILIB_DIRNAMES = 64 32
MULTILIB_OSDIRNAMES = ../lib ../lib32
Any help in debugging this would be appreciated.
Thanks,
FX