setting CPU_TYPE when cross-compiling from Linux to Windows

Niels Möller nisse at
Sun Dec 29 19:25:13 UTC 2019

Claude Heiland-Allen <claude at> writes:

> However trying the method suggested in the documentation also fails,
> but in a different way:
> ```
> CC_FOR_BUILD="gcc" \
> CPP_FOR_BUILD="gcc -E" \
> CFLAGS="-march=native -O3 -fomit-frame-pointer" \
> CXXFLAGS="-march=native -O3 -fomit-frame-pointer" \
> LDFLAGS="-static-libgcc -static-libstdc++" \
> ./configure --build=zen-pc-linux-gnu --host=zen-w64-mingw32 \
>   --prefix=/home/claude/winNATIVE
> ...
> config.status: linking mpn/x86_64/zen/gmp-mparam.h to gmp-mparam.h
> config.status: executing libtool commands
> configure: summary of build options:
>   Version:           GNU MP 6.1.99
>   Host type:         zen-w64-mingw32
>   ABI:               64
>   Install prefix:    /home/claude/winNATIVE
>   Compiler:          gcc
>   Static libraries:  yes
>   Shared libraries:  no
> configure: If wine64 is installed, use make check TESTS_ENVIRONMENT=wine64.
> ```
> Notice it uses compiler `gcc` instead of `x86_64-w64-mingw32-gcc`,
> which leads to a build for Linux, not Windows.

Autoconf has a convenience feature to automatically pick a
cross-compiler based on the host triplet. But that works only if
cross-compiler name and host-triplet match perfectly. Otherwise, you
must specify the correct cross compiler explicitly, with

> Trying a fat build (thanks for the pointer to this method, I think
> it's what I really need) also fails, at `make check`:

Can't say why this fails. If you have tried different configs in the
same build tree, try starting over from make distclean.


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