Configure fails on 32-bit platform

Niels Möller nisse at lysator.liu.se
Mon Feb 12 09:44:23 UTC 2018


Vincent Lefevre <vincent at vinc17.net> writes:

> That said, perhaps GMP might be improved to detect the ABI by a
> simple parsing of $CFLAGS when provided by the user (in case values
> like -m32 or -m64 are standard).

In Nettle, I try to detect the ABI used by the configured C compiler,
with a configure test like

  case "$host_cpu" in
    [x86_64 | amd64])
      AC_TRY_COMPILE([
  #if defined(__x86_64__) || defined(__arch64__)
  #error 64-bit x86
  #endif
      ], [], [
        ABI=32
      ], [
        ABI=64
      ])
      ;;
  ...

(and the above misses x32). That's a bit verbose, but I think it's less
brittle than trying to parse compiler flags. For one, how would we know
which ABI the compiler uses by default?

The result is used when selecting assembly code.

But then the way I recommend to configure ABI is still not to set
CFLAGS, but to set CC. E.g.,

  ./configure CC='gcc -m32' CXX='g++ -m32'

Regards,
/Niels

-- 
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