GMP 6.3.0: Failure building on MinGW (defaulting to ABI=64)

2023-12-10 Thread Simon Sobisch

Problem when building from 6.3.0 release tarball:

libtool: compile:  ../mpn/m4-ccas --m4=m4 gcc -c -DHAVE_CONFIG_H -I. 
-I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_x86_64_add_n -Wno-attribute 
x86_64_add_n.asm  -DDLL_EXPORT -DPIC -o .libs/x86_64_add_n.o
m4  -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -DOPERATION_x86_64_add_n 
-DDLL_EXPORT -DPIC x86_64_add_n.asm >tmp-x86_64_add_n.s
 gcc -c -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I.. 
-DOPERATION_x86_64_add_n -Wno-attribute tmp-x86_64_add_n.s -DDLL_EXPORT 
-DPIC -o .libs/x86_64_add_n.o

tmp-x86_64_add_n.s: Assembler messages:
tmp-x86_64_add_n.s:112: Error: bad register name `%rdi'
tmp-x86_64_add_n.s:113: Error: bad register name `%rsi'
tmp-x86_64_add_n.s:114: Error: bad register name `%rcx'
tmp-x86_64_add_n.s:115: Error: bad register name `%rdx'
tmp-x86_64_add_n.s:116: Error: bad register name `%r8'
tmp-x86_64_add_n.s:117: Error: bad register name `%r9'
tmp-x86_64_add_n.s:119: Error: bad register name `%rsp)'
tmp-x86_64_add_n.s:121: Error: bad register name `%rcx'
tmp-x86_64_add_n.s:123: Error: bad register name `%r8'
tmp-x86_64_add_n.s:124: Error: `jrcxz' is only supported in 64-bit mode
[...]
make[2]: *** [x86_64_add_n.lo] Error 1


Environment:

$ ./config.guess && gcc --version && as --version
haswell-pc-mingw32

gcc.exe (MinGW.org GCC Build-2) 9.2.0

GNU assembler (GNU Binutils) 2.32
This assembler was configured for a target of `mingw32'.


configure options:

./configure --prefix=/mingw --enable-fat \
   --enable-shared --disable-static


configure outputs:

using ABI="64"
  CC="gcc"
  CFLAGS="-Wno-attribute"
  CPPFLAGS=""
  MPN_PATH=" x86_64/coreihwl x86_64/coreisbr x86_64/coreinhm 
x86_64/core2 x86_64 generic"


checking if the assembler knows about the mulx instruction... no
configure: WARNING: 
+--

configure: WARNING: | WARNING WARNING WARNING
configure: WARNING: | Host CPU has the mulx instruction, but it can't be
configure: WARNING: | assembled by
configure: WARNING: | gcc -c
configure: WARNING: | Older x86 instructions will be used.
configure: WARNING: | This will be an inferior build.
configure: WARNING: 
+--


configure: summary of build options:

  Version:   GNU MP 6.3.0
  Host type: haswell-pc-mingw32
  ABI:   64
  Install prefix:/mingw
  Compiler:  gcc
  Static libraries:  no
  Shared libraries:  yes


As the issue "obviously" is the ABI that doesn't match I've tried with 
ABI=32, which works a bit better, to then error with:



libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I.. 
-DOPERATION_fat_com -c fat_com.c  -DDLL_EXPORT -DPIC -o .libs/fat_com.o

In file included from ../gmp-impl.h:147,
 from ../mpn/generic/com.c:31,
 from .././mpn/x86/fat/com.c:32,
 from fat_com.c:10:
../fib_table.h:4:1: warning: data definition has no type or storage class
4 | Error, error, this data is for 64 bits
  | ^
../fib_table.h:4:1: warning: type defaults to 'int' in declaration of 
'Error' [-Wimplicit-int]
../fib_table.h:4:8: warning: type defaults to 'int' in declaration of 
'error' [-Wimplicit-int]

4 | Error, error, this data is for 64 bits
  |^
../fib_table.h:4:20: error: expected '=', ',', ';', 'asm' or 
'__attribute__' before 'data'

4 | Error, error, this data is for 64 bits
  |^~~~
make[2]: *** [fat_com.lo] Error 1


This error seems to be related to changing the ABI after the initial 
configure. Using "make distclean" fixes this.


I therefore think that something like `AC_ARG_VAR([ABI], [Application 
Binary Interface to use])` (maybe also reference 
https://gmplib.org/manual/ABI-and-ISA in its description) should be 
added to configure.ac to make that error on an ABI change and also 
adding this missing piece to configure's help output.



Using the right ABI all tests pass.


Rechecked with GMP 6.2.1 - the ABI needs to be specified there manually, 
too, the same warning is seen in the output.



Just to let you know: make check resulted in multiple occurrences of

  libtool: warning: '-no-install' is ignored for haswell-pc-mingw32
  libtool: warning: assuming '-no-fast-install' instead


Side note, just FYI: to build without warnings on MinGW (also with 
recent MSYS2) the following additional option needs to be specified

  CFLAGS="-Wno-attributes -Wno-ignored-attributes"

Simon
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: GMP 6.3.0: Failure building on MinGW (defaulting to ABI=64)

2023-12-10 Thread Marc Glisse

On Sun, 10 Dec 2023, Simon Sobisch wrote:


$ ./config.guess && gcc --version && as --version


gcc -v file.c
gives more information about the assembler that is really used.


gcc.exe (MinGW.org GCC Build-2) 9.2.0


gcc-9 is old. Isn't mingw.org abandoned? I thought everyone had moved to 
mingw-w64.org.



using ABI="64"
 CC="gcc"
 CFLAGS="-Wno-attribute"


Specifying CFLAGS yourself is not a great idea, it prevents GMP from 
adding nice optimization flags. If you really want to pass -Wno-attribute, 
either put it in CPPFLAGS, or run configure once without CFLAGS to see 
what GMP wants to use, and add -Wno-attribute to that.


This error seems to be related to changing the ABI after the initial 
configure. Using "make distclean" fixes this.


I therefore think that something like `AC_ARG_VAR([ABI], [Application Binary 
Interface to use])` (maybe also reference 
https://gmplib.org/manual/ABI-and-ISA in its description) should be added to 
configure.ac to make that error on an ABI change and also adding this missing 
piece to configure's help output.


You mean this?
https://gmplib.org/repo/gmp-6.3/file/tip/configure.ac#l455

I think it has been there for a while.

--
Marc Glisse
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


gmp 6.3.0 build failure on macOS 10.14.6 (Mojave) using Homebrew

2023-12-10 Thread Russ Gutwin
Hope this helps you and others:
bash-3.2$ more tests/mpz/test-suite.log

   GNU MP 6.3.0: tests/mpz/test-suite.log


# TOTAL: 64
# PASS:  57
# SKIP:  0
# XFAIL: 0
# FAIL:  7
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: t-bin
===

FAIL t-bin (exit status: 132)

FAIL: t-fac_ui
==

FAIL t-fac_ui (exit status: 132)

FAIL: t-mfac_uiui
=

FAIL t-mfac_uiui (exit status: 132)

FAIL: t-primorial_ui


FAIL t-primorial_ui (exit status: 132)

FAIL: t-hamdist
===

FAIL t-hamdist (exit status: 132)

FAIL: t-popcount


FAIL t-popcount (exit status: 132)

FAIL: t-nextprime
=

FAIL t-nextprime (exit status: 132)

Other details are as follows:
==> Formula
Path: 
/Users/russgutwin/Library/Caches/Homebrew/downloads/493bd833806b18608ad2a7ebabf4bc0769f6758080d63aee6a1c808e0383ab76--gmp.rb
==> Configuration
HOMEBREW_VERSION: 4.1.24-12-gc32bd1c
ORIGIN: https://github.com/Homebrew/brew
HEAD: c32bd1c7cc0c3b1b914845bddfeda53f4d877a3f
Last commit: 3 days ago
Core tap origin: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 187d25afa55827b232da42d50f1006e2d7039f5a
Core tap last commit: 18 hours ago
Core tap branch: master
Core tap JSON: 10 Dec 09:46 UTC
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: pico
HOMEBREW_MAKE_JOBS: 2
HOMEBREW_NO_AUTO_UPDATE: set
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 3.1.4 => 
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: dual-core 64-bit penryn
Clang: 11.0.0 build 1100
Git: 2.43.0 => /usr/local/bin/git
Curl: 7.54.0 => /usr/bin/curl
macOS: 10.14.6-x86_64
CLT: 11.3.1.0.1.1576735732
Xcode: 11.3.1
==> ENV
HOMEBREW_CC: clang
HOMEBREW_CXX: clang++
MAKEFLAGS: -j2
CMAKE_PREFIX_PATH: /usr/local
CMAKE_INCLUDE_PATH: 
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/libxml2:/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
CMAKE_LIBRARY_PATH: 
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
PKG_CONFIG_LIBDIR: 
/usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.14
HOMEBREW_GIT: git
HOMEBREW_SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
ACLOCAL_PATH: /usr/local/share/aclocal
PATH: 
/usr/local/Homebrew/Library/Homebrew/shims/mac/super:/usr/local/opt/autoconf/bin:/usr/local/opt/automake/bin:/usr/local/opt/libtool/bin:/usr/bin:/bin:/usr/sbin:/sbin

This preceded the build’s ‘Test Summary’, before the build failure:
/Applications/Xcode.app/Contents/Developer/usr/bin/make  check-TESTS
PASS: t-addsub
PASS: t-cmp
PASS: t-mul
PASS: t-mul_i
PASS: t-tdiv
PASS: t-tdiv_ui
PASS: t-fdiv
PASS: t-fdiv_ui
PASS: t-cdiv_ui
PASS: reuse
PASS: t-gcd_ui
PASS: t-lcm
PASS: t-invert
PASS: t-gcd
PASS: dive_ui
PASS: t-sqrtrem
PASS: dive
PASS: io
PASS: t-inp_str
PASS: logic
PASS: t-bit
PASS: convert
PASS: t-powm
PASS: t-pow
PASS: t-div_2exp
PASS: t-root
PASS: t-perfsqr
PASS: t-perfpow
PASS: t-jac
../../test-driver: line 107: 82346 Illegal instruction: 4  "$@" > $log_file 2>&1
FAIL: t-bin
PASS: t-get_d
PASS: t-get_d_2exp
PASS: t-get_si
PASS: t-powm_ui
PASS: t-set_d
PASS: t-set_si
PASS: t-lucm
../../test-driver: line 107: 82479 Illegal instruction: 4  "$@" > $log_file 2>&1
FAIL: t-fac_ui
../../test-driver: line 107: 82494 Illegal instruction: 4  "$@" > $log_file 2>&1
FAIL: t-mfac_uiui
../../test-driver: line 107: 82517 Illegal instruction: 4  "$@" > $log_file 2>&1
FAIL: t-primorial_ui
PASS: t-fib_ui
PASS: t-lucnum_ui
PASS: t-scan
PASS: t-fits
PASS: t-divis_2exp
PASS: t-cong
PASS: t-cong_2exp
PASS: t-sizeinbase
PASS: t-divis
PASS: t-set_str
PASS: t-cmp_d
PASS: t-cmp_si
../../test-driver: line 107: 82784 Illegal instruction: 4  "$@" > $log_file 2>&1
FAIL: t-hamdist
PASS: t-aorsmul
PASS: t-oddeven
../../test-driver: line 107: 82827 Illegal instruction: 4  "$@" > $log_file 2>&1
FAIL: t-popcount
PASS: t-set_f
PASS: t-import
PASS: t-export
PASS: t-pprime_p
../../test-driver: line 107: 82938 Illegal instruction: 4  "$@" > $log_file 2>&1
FAIL: t-nextprime
PASS: t-io_raw
PASS: t-limbs
PASS: t-remove

___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: gmp 6.3.0 build failure on macOS 10.14.6 (Mojave) using Homebrew

2023-12-10 Thread Marc Glisse

Hello,

could you give a bit more info (see 
https://gmplib.org/manual/Reporting-Bugs)?


3 things in particular:

* what did config.guess identify your system as

* what arguments did you pass to configure

* could you run one of the failing tests in a debugger until it complains 
about the illegal instruction, then ask it to disassemble the current 
instruction (and neighbors), and tell us what this illegal instruction is?


On Sun, 10 Dec 2023, Russ Gutwin wrote:


Hope this helps you and others:
bash-3.2$ more tests/mpz/test-suite.log

  GNU MP 6.3.0: tests/mpz/test-suite.log


# TOTAL: 64
# PASS:  57
# SKIP:  0
# XFAIL: 0
# FAIL:  7
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: t-bin
===

FAIL t-bin (exit status: 132)

FAIL: t-fac_ui
==

FAIL t-fac_ui (exit status: 132)

FAIL: t-mfac_uiui
=

FAIL t-mfac_uiui (exit status: 132)

FAIL: t-primorial_ui


FAIL t-primorial_ui (exit status: 132)

FAIL: t-hamdist
===

FAIL t-hamdist (exit status: 132)

FAIL: t-popcount


FAIL t-popcount (exit status: 132)

FAIL: t-nextprime
=

FAIL t-nextprime (exit status: 132)

Other details are as follows:
==> Formula
Path: 
/Users/russgutwin/Library/Caches/Homebrew/downloads/493bd833806b18608ad2a7ebabf4bc0769f6758080d63aee6a1c808e0383ab76--gmp.rb
==> Configuration
HOMEBREW_VERSION: 4.1.24-12-gc32bd1c
ORIGIN: https://github.com/Homebrew/brew
HEAD: c32bd1c7cc0c3b1b914845bddfeda53f4d877a3f
Last commit: 3 days ago
Core tap origin: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 187d25afa55827b232da42d50f1006e2d7039f5a
Core tap last commit: 18 hours ago
Core tap branch: master
Core tap JSON: 10 Dec 09:46 UTC
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: pico
HOMEBREW_MAKE_JOBS: 2
HOMEBREW_NO_AUTO_UPDATE: set
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 3.1.4 => 
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: dual-core 64-bit penryn
Clang: 11.0.0 build 1100
Git: 2.43.0 => /usr/local/bin/git
Curl: 7.54.0 => /usr/bin/curl
macOS: 10.14.6-x86_64
CLT: 11.3.1.0.1.1576735732
Xcode: 11.3.1
==> ENV
HOMEBREW_CC: clang
HOMEBREW_CXX: clang++
MAKEFLAGS: -j2
CMAKE_PREFIX_PATH: /usr/local
CMAKE_INCLUDE_PATH: 
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/libxml2:/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
CMAKE_LIBRARY_PATH: 
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
PKG_CONFIG_LIBDIR: 
/usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.14
HOMEBREW_GIT: git
HOMEBREW_SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
ACLOCAL_PATH: /usr/local/share/aclocal
PATH: 
/usr/local/Homebrew/Library/Homebrew/shims/mac/super:/usr/local/opt/autoconf/bin:/usr/local/opt/automake/bin:/usr/local/opt/libtool/bin:/usr/bin:/bin:/usr/sbin:/sbin

This preceded the build’s ‘Test Summary’, before the build failure:
/Applications/Xcode.app/Contents/Developer/usr/bin/make  check-TESTS
PASS: t-addsub
PASS: t-cmp
PASS: t-mul
PASS: t-mul_i
PASS: t-tdiv
PASS: t-tdiv_ui
PASS: t-fdiv
PASS: t-fdiv_ui
PASS: t-cdiv_ui
PASS: reuse
PASS: t-gcd_ui
PASS: t-lcm
PASS: t-invert
PASS: t-gcd
PASS: dive_ui
PASS: t-sqrtrem
PASS: dive
PASS: io
PASS: t-inp_str
PASS: logic
PASS: t-bit
PASS: convert
PASS: t-powm
PASS: t-pow
PASS: t-div_2exp
PASS: t-root
PASS: t-perfsqr
PASS: t-perfpow
PASS: t-jac
../../test-driver: line 107: 82346 Illegal instruction: 4  "$@" > $log_file 2>&1
FAIL: t-bin
PASS: t-get_d
PASS: t-get_d_2exp
PASS: t-get_si
PASS: t-powm_ui
PASS: t-set_d
PASS: t-set_si
PASS: t-lucm
../../test-driver: line 107: 82479 Illegal instruction: 4  "$@" > $log_file 2>&1
FAIL: t-fac_ui
../../test-driver: line 107: 82494 Illegal instruction: 4  "$@" > $log_file 2>&1
FAIL: t-mfac_uiui
../../test-driver: line 107: 82517 Illegal instruction: 4  "$@" > $log_file 2>&1
FAIL: t-primorial_ui
PASS: t-fib_ui
PASS: t-lucnum_ui
PASS: t-scan
PASS: t-fits
PASS: t-divis_2exp
PASS: t-cong
PASS: t-cong_2exp
PASS: t-sizeinbase
PASS: t-divis
PASS: t-set_str
PASS: t-cmp_d
PASS: t-cmp_si
../../test-driver: line 107: 82784 Illegal instruction: 4  "$@" > $log_file 2>&1
FAIL: t-hamdist
PASS: t-aorsmul
PASS: t-oddeven
../../test-driver: line 107: 82827 Illegal instruction: 4  "$@" > $log_file 2>&1
FAIL: t-popcount
PASS: t-set_f
PASS: t-import
PASS: t-export
PASS: t-pprime_p
../../test-driver: line 107: 82938 Illegal instruction: 4  "$@" > $log_file 2>&1
FAIL: t-nextprime
PASS: t-io_raw
PASS: t-limbs
PASS: t-remove

___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


--
Marc Glisse
___
gmp-bugs mailing list