10.11. GMP-5.1.3 64 Bit

GMP is a library for arithmetic on arbitrary precision integers, rational numbers, and floating-point numbers.

10.11.1. Installation of GMP

[Note]

Note

If you are compiling this package on a different CPU than you plan to run the CLFS system on, you must replace GMP's config.guess and config.sub wrappers with the originals. This will prevent GMP from optimizing for the wrong CPU. You can make this change with the following command:

mv -v config{fsf,}.guess
mv -v config{fsf,}.sub

Prepare GMP for compilation:

CC="gcc -isystem /usr/include ${BUILD64}" \
CXX="g++ -isystem /usr/include ${BUILD64}" \
LDFLAGS="-Wl,-rpath-link,/usr/lib64:/lib64 ${BUILD64}" \
  ./configure --prefix=/usr \
    --libdir=/usr/lib64 --enable-cxx

Compile the package:

make
[Important]

Important

The test suite for GMP is considered critical. Do not skip it under any circumstance.

Test the results:

make check

Install the package:

make install

Create the 64bit header file:

mv -v /usr/include/gmp{,-64}.h

Finally, create a stub header in the place of the originals:

cat > /usr/include/gmp.h << "EOF"
/* gmp.h - Stub Header  */
#ifndef __STUB__GMP_H__
#define __STUB__GMP_H__

#if defined(__x86_64__) || \
    defined(__sparc64__) || \
    defined(__arch64__) || \
    defined(__powerpc64__) || \
    defined (__s390x__)
# include "gmp-64.h"
#else
# include "gmp-32.h"
#endif

#endif /* __STUB__GMP_H__ */
EOF

10.11.2. Contents of GMP

Installed libraries: libgmp.[a,so], libgmpxx.[a,so], libmp.[a,so]

Short Descriptions

libgmp

Contains the definitions for GNU multiple precision functions.

libgmpxx

Contains a C++ class wrapper for GMP types.

libmp

Contains the Berkeley MP compatibility library.