setting CPU_TYPE when cross-compiling from Linux to Windows

Marc Glisse marc.glisse at inria.fr
Sat Dec 28 23:52:06 UTC 2019


On Sat, 28 Dec 2019, Claude Heiland-Allen wrote:

> I use Linux.  I have a program (that uses GMP via MPFR) that I 
> cross-compile for Windows and run in Wine.
>
> I would like to test the new zen-specific optimizations on my AMD Ryzen 
> 7 2700X CPU, but I can't seem to get it to work:
>
> ```
> hg clone https://gmplib.org/repo/gmp/
> cd gmp
> ./.bootstrap
> GMP_CPU_TYPE="zen" \
> 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++" \
> CPPFLAGS="-D__USE_MINGW_ANSI_STDIO" \
> ./configure --build=x86_64-pc-linux-gnu --host=x86_64-w64-mingw32 \
>   --prefix=/home/claude/winNATIVE
> ...
> config.status: linking mpn/x86_64/k8/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:         x86_64-w64-mingw32
>   ABI:               64
>   Install prefix:    /home/claude/winNATIVE
>   Compiler:          x86_64-w64-mingw32-gcc
>   Static libraries:  yes
>   Shared libraries:  no
>
> configure: If wine64 is installed, use make check TESTS_ENVIRONMENT=wine64.
> ```
>
> Notice that it is linking `x86_64/k8` instead of `x86_64/zen`.
>
> Compiling natively on Linux with `GMP_CPU_TYPE=zen` works fine (and some 
> test programs are faster), but unfortunately my main program is 
> Windows-only.  I do not have Microsoft Windows to test a native build there.
>
> How can I do this?

Hello,

did you read the documentation? 
https://gmplib.org/manual/Build-Options.html indicates to use the host 
triplet to specify the cpu. Where did you read about this use of 
GMP_CPU_TYPE? As far as I can tell, it is only useful at runtime, and only 
if you have a fat build and passed some options to configure.

-- 
Marc Glisse


More information about the gmp-bugs mailing list