public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Multilib seems to fail for mingw-w64 build
@ 2017-01-13 12:25 FX
  2017-01-19 20:38 ` FX
  0 siblings, 1 reply; 2+ messages in thread
From: FX @ 2017-01-13 12:25 UTC (permalink / raw)
  To: GCC Development; +Cc: ktietz70, 10walls

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Multilib seems to fail for mingw-w64 build
  2017-01-13 12:25 Multilib seems to fail for mingw-w64 build FX
@ 2017-01-19 20:38 ` FX
  0 siblings, 0 replies; 2+ messages in thread
From: FX @ 2017-01-19 20:38 UTC (permalink / raw)
  To: GCC Development; +Cc: ktietz70, 10walls

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
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-19 20:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-13 12:25 Multilib seems to fail for mingw-w64 build FX
2017-01-19 20:38 ` FX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).