This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: 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: Thu, 19 Jan 2017 21:38:11 +0100
- Subject: Re: Multilib seems to fail for mingw-w64 build
- Authentication-results: sourceware.org; auth=none
- References: <88EC942B-E26B-476A-8241-117D69CC5A3F@gmail.com>
Hi,
Help from a build maintainer needed :)
I am trying to find why mingw-w64 won’t build as a GCC cross-compiler with multilib (see full report below). It fails in building 32-bit libgcc, because we’re passing it the wrong flags. From toplevel configure, we have:
FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET#' -L${prefix}/${target}/lib -L${prefix}/mingw/lib -isystem ${prefix}/${target}/include -isystem ${prefix}/mingw/include’
However this is wrong: these flags should be dependent on whether we link 32 or 64-bit, as 32-bit libraries are in ${prefix}/${target}/lib32, and 64-bit libraries are in ${prefix}/${target}/lib.
Anyone knows how we can make toplevel configure aware of the multilib nature of the system?
Cheers,
FX
PS: The gcc specs know how to deal with that, as we have in the target configuration file:
$ cat gcc/config/i386/t-mingw-w64
MULTILIB_OPTIONS = m64/m32
MULTILIB_DIRNAMES = 64 32
MULTILIB_OSDIRNAMES = ../lib ../lib32
> Le 13 janv. 2017 à 13:25, FX <fxcoudert@gmail.com> a écrit :
>
> 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
>