Steps to reproduce: 1. Install MSYS2. 2. Open the MSYS2 MinGW 64-bit environment (not the MSYS2 MSYS environment, which is used like Cygwin). 3. Install the required packages to build gmp using "pacman -S", including "make" and "mingw-w64-x86_64-toolchain", which includes gcc for the mingw target. Note that the plain "gcc" package is for the Cygwin environment and should not be used. 4. Download gmp-6.2.1 and extract it. 5. Call the "configure" script in the gmp-6.2.1 directory from a newly created out-of-tree build directory without arguments, using an absolute path (not relative path). 6. The configure script fails with "error: Oops, mp_limb_t doesn't seem to work".
The root cause seems to be that the configure script generates C files
which it tries to compile. These files include UNIX style absolute paths
for include files, such as #include "/home/Emil/gmp-6.2.1/gmp-h.in". These
absolute UNIX style paths are not allowed/usable in the MinGW environment.
Instead relative paths or Windows style paths with "X:\" prefix must be
used. Forward slashes however work fine as path separator.
When calling the "configure" script using a relative paths, it works fine
though.
This issue arised when I tried to build a cross compiler using crosstool-NG
in MSYS2. Apparently crosstool-NG compiles its own version of GMP by
calling GMP's "configure" script using an absolute path, and therefore the
build of the cross compiler fails. I had to change crosstool-NG to use a
relative path using `realpath --relative-to=.
"${CT_SRC_DIR}/gmp/configure"`, then it worked.
https://github.com/msys2/MINGW-packages/issues/6711 describes that it is
not possible to use absolute paths with gcc under mingw.
GMP version: 6.2.1 pre-packaged
configure options: none
configure stderr:
configure: WARNING: gmp.h doesnt recognise compiler "inline", inlines will
be unavailable
configure: WARNING: gmp.h doesnt recognise <stdio.h>, FILE prototypes will
be unavailable
configure: error: Oops, mp_limb_t doesn't seem to work
configure stdout:
in separate attached file with config.log
gcc -v:
Using built-in specs.
COLLECT_GCC=E:\msys64\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=E:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-10.3.0/configure --prefix=/mingw64
--with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32
--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32
--with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include
--libexecdir=/mingw64/lib --enable-bootstrap --enable-checking=release
--with-arch=x86-64 --with-tune=generic
--enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit --enable-shared
--enable-static --enable-libatomic --enable-threads=posix --enable-graphite
--enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes
--enable-libstdcxx-time=yes --disable-libstdcxx-pch
--disable-libstdcxx-debug --enable-lto --enable-libgomp --disable-multilib
--disable-rpath --disable-win32-registry --disable-nls --disable-werror
--disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64
--with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64
--with-pkgversion='Rev7, Built by MSYS2 project' --with-bugurl=
https://github.com/msys2/MINGW-packages/issues --with-gnu-as --with-gnu-ld
--with-boot-ldflags='-pipe
-Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high
-Wl,--disable-dynamicbase -static-libstdc++ -static-libgcc'
'LDFLAGS_FOR_TARGET=-pipe
-Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high'
--enable-linker-plugin-flags='LDFLAGS=-static-libstdc++\ -static-libgcc\
-pipe\
-Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high\
-Wl,--stack,12582912'
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.3.0 (Rev7, Built by MSYS2 project)
uname -a:
MINGW64_NT-10.0-19042 Emil-Dell 3.2.0-340.x86_64 2021-08-02 16:30 UTC
x86_64 Msys
<<attachment: log_files.zip>>
_______________________________________________ gmp-bugs mailing list [email protected] https://gmplib.org/mailman/listinfo/gmp-bugs
