Hardcoded value of GMP_LIMB_BITS impedes bi-arch builds

Niels Möller nisse at lysator.liu.se
Wed Sep 30 15:14:27 UTC 2020

Jan Engelhardt <jengelh at inai.de> writes:

> When ./configure has run, the GMP_LIMB_BITS define in gmp.h is hardcoded 
> to 32 or 64, depending on arch. This makes it impossible to use that 
> header file for a x86_64-driven build with gcc -m32.

For what it's worth, debian multilib installs would have two separate
header files,


belonging to different arch versions of the packages, libgmp-dev:amd64
and libgmp-dev:i386, respectively.

> 	#define GMP_LIMB_BITS (sizeof(mp_limb_t) * CHAR_BIT)

As Torbjörn said, that doesn't work, since GMP_LIMB_BITS is expected to
be a constant known to the preprocessor, which is ignorant of C things
like types and sizeof. You'd need a gmp-h.in with something like

#ifdef @ALT_ARCH@

and corresponding configure.ac setup. Not sure it's worth the effort,
since the multilib organization works fine, and works for *all*
libraries with arch-dependent headers.


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