6.14. GMP-6.0.0a

The GMP package contains math libraries. These have useful functions for arbitrary precision arithmetic.

Approximate build time: 1.3 SBU
Required disk space: 65 MB

6.14.1. Installation of GMP

6.14.2. 32-bit Installation

Prepare GMP for 32-bit compilation:

ABI=32 ./configure --prefix=/usr --enable-cxx \
--libdir=/usr/lib32                           \
CC="gcc -m32" CXX="g++ -m32"

The meaning of the new configure options:

ABI=32

Tells the configure script that we are building a 32-bit version of GMP.

--enable-cxx

This parameter enables C++ support

Compile the package:

make
[Important]

Important

The test suite for GMP in this section is considered critical. Do not skip it under any circumstances.

Test the results:

make check 2>&1 | tee gmp-check-log

Ensure that all 188 tests in the test suite passed. Check the results by issuing the following command:

awk '/tests passed/{total+=$2} ; END{print total}' gmp-check-log

Install the package:

make install

Create the 32-bit header file:

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

Clean up the build directory before moving on to the next platform:

make distclean

6.14.3. x32 ABI Installation

Prepare GMP for x32 ABI compilation:

ABI=x32 ./configure --prefix=/usr --enable-cxx \
--libdir=/usr/libx32                          \
CC="gcc -mx32" CXX="g++ -mx32"

The meaning of the new configure options:

ABI=x32

Tells the configure script that we are building an x32 ABI version of GMP.

--enable-cxx

This parameter enables C++ support

Compile the package:

make
[Important]

Important

The test suite for GMP in this section is considered critical. Do not skip it under any circumstances.

Test the results:

make check 2>&1 | tee gmp-check-log

Ensure that all 188 tests in the test suite passed. Check the results by issuing the following command:

awk '/tests passed/{total+=$2} ; END{print total}' gmp-check-log

Install the package:

make install

Create the x32 ABI header file:

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

Clean up the build directory before moving on to the next platform:

make distclean

6.14.4. 64-bit Installation

Prepare GMP for 64-bit compilation:

./configure --prefix=/usr \
            --enable-cxx  \
            --docdir=/usr/share/doc/gmp-6.0.0a

The meaning of the new configure options:

--enable-cxx

This parameter enables C++ support

--docdir=/usr/share/doc/gmp-6.0.0a

This variable specifies the correct place for the documentation.

Compile the package and generate the HTML documentation:

make
make html
[Important]

Important

The test suite for GMP in this section is considered critical. Do not skip it under any circumstances.

Test the results:

make check 2>&1 | tee gmp-check-log

Ensure that all 188 tests in the test suite passed. Check the results by issuing the following command:

awk '/tests passed/{total+=$2} ; END{print total}' gmp-check-log

Install the package and its documentation:

make install
make install-html

Create the 64-bit 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__)
# if defined (__ILP32__)
#  include "gmp-x32.h"
# else
#  include "gmp-64.h"
# endif
#else
# include "gmp-32.h"
#endif

#endif /* __STUB__GMP_H__ */
EOF

6.14.5. Contents of GMP

Installed Libraries: libgmp.{a,so} and libgmpxx.{a,so}
Installed directory: /usr/share/doc/gmp-6.0.0a

Short Descriptions

libgmp

Contains precision math functions

libgmpxx

Contains C++ precision math functions