[SOLVED] Re: setting CPU_TYPE when cross-compiling from Linux to Windows

Niels Möller nisse at lysator.liu.se
Fri Jan 3 12:15:28 UTC 2020


Claude Heiland-Allen <claude at mathr.co.uk> writes:

> Aha, thanks for this tip, I found an incantation that works:
>
> ```
> CC=x86_64-w64-mingw32-gcc \
> CC_FOR_BUILD=x86_64-linux-gnu-gcc \
> CPPFLAGS=-D__USE_MINGW_ANSI_STDIO \
> LDFLAGS="-static-libgcc -static-libstdc++" \
> ./configure \
>   --build=x86_64-linux-gnu \
>   --host=x86_64-w64-mingw32 \
>   --enable-fat \
>   --enable-static \
>   --disable-shared \
>   --prefix=/home/claude/wintmp/
> ```
>
> The `CPPFLAGS` is necessary to avoid test failure in printf/scanf.

That's a known problem, maybe it should somehow be enabled by default by
gmp's configure, but I don't fully understand the implications.

Not sure why the setting of LDFLAGS and CC_FOR_BUILD are needed though,
can you explain?

Also, I think it's generally recomended to set CC and other variables
affecting configure as arguments to the configure script rather than in
the environment, i.e.,

  ./configure CC=... 

rather than

  CC=... ./configure

> I
> found that `make check` works (I have binfmt support enabled so wine
> is invoked automatically), but `make check TESTS_ENVIRONMENT=wine64`
> as suggested fails:
>
> ```
> make[5]: Entering directory '/home/claude/wintmp/src/gmp/tests'
> wine: Bad EXE format for Z:\bin\bash..

It seems that's a bad suggestion these days, thanks for reporting. I'm
fairly confident it used to work with some older version of automake,
before the current fancier test framework.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.


More information about the gmp-bugs mailing list