setting CPU_TYPE when cross-compiling from Linux to Windows

Claude Heiland-Allen claude at mathr.co.uk
Sat Dec 28 22:18:42 UTC 2019


Hi,

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?


Claude
-- 
https://mathr.co.uk



More information about the gmp-bugs mailing list