Build installs different "gmp.h" for 32- and 64-bit ABI's.

Jason Vas Dias jason.vas.dias at
Mon Jan 3 14:59:59 CET 2011

This is still a problem with gmp-5.0.1 -
and is the only problem I have found with GMP on my linux x86_64 host -
All "make check" tests pass for both x86 (ABI==32) and x86_64 (ABI==64) 
builds, and the "GMP_LIMB_BITS" #define is the ONLY /usr/include/gmp*.h 
header file difference. 

This breaks builds of software that depends on gmp - eg. building 
the Parma Polyhedra Library (ppl-0.11) fails for 64-bit if the 32-bit
gmp.h is installed, and for 32-bit if the 64-bit gmp.h is installed.

IMHO,  the upstream gmp library source should not be depending on 
distribution maintainers fixing this problem in order to support multi-arch /
multi-lib platforms, as for instance Thomas Woerner<twoerner at>
does for Redhat distros by supplying a wrapper gmp.h (see attached gmp-wrapper.h) ,
which replaces /usr/include/gmp.h with a file that conditionally includes "gmp-<arch>.h" ,
which is the gmp.h produced by the GMP build .

If it really is true that GMP_LIMB_BITS will be the ONLY difference on ALL multi-lib
platforms, then something like this must be done :

 1. modify the mpn/$arch/gmp-mparam.h for multi-arch platforms (platforms that support
    conditional 32-bit or 64-bit compilation) to define both "GMP_LIMB_BITS" and "GMP_LIMB_BITS_64" 

 2. modify @ line 33 :

   #ifdef _LP64

    I think you can trust the _LP64 cpp pre-defined macro on all multi-lib platforms
    as they are part of the standard UNIX ABI specifications.

Otherwise if there are going to be other differences in gmp.h on other multi-arch platforms
then an approach such as Thomas' should be used.

PLEASE, please can the GMP developers indicate whether they intend to fix this problem or not -
otherwise I'll attempt to develop and submit a comprehensive patch to fix this problem.

Thanks & Regards,
Jason Vas Dias <jason.vas.dias at> a software engineer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gmp-wrapper.h
Type: text/x-chdr
Size: 2136 bytes
Desc: not available
URL: <>

More information about the gmp-bugs mailing list