8.23. GMP-6.3.0

#### Linux From Scratch - Version r13.0-154-systemd

### Chapter 8. Installing Basic System Software

- Prev

  Binutils-2.46.1

- Next

  MPFR-4.2.2

- Up
- Home

# 8.23. GMP-6.3.0

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

Approximate build time: 0.3 SBU
Required disk space: 54 MB

## 8.23.1. Installation of GMP

### Note

If you are building for 32-bit x86, but you have a CPU which is capable of running 64-bit code and you have specified `CFLAGS` in the environment, the configure script will attempt to configure for 64-bits and fail. Avoid this by invoking the configure command below with

    ABI=32 ./configure ...

### Note

The default settings of GMP produce libraries optimized for the host processor. If libraries suitable for processors less capable than the host's CPU are desired, generic libraries can be created by appending the `--host=none-linux-gnu` option to the configure command.

First, make an adjustment for compatibility with gcc-15 and later:

    sed -i '/long long t1;/,+1s/()/(...)/' configure

Prepare GMP for compilation:

    ./configure --prefix=/usr    \
                --enable-cxx     \
                --disable-static \
                --docdir=/usr/share/doc/gmp-6.3.0

The meaning of the new configure options:

`--enable-cxx`

  This parameter enables C++ support

`--docdir=/usr/share/doc/gmp-6.3.0`

  This variable specifies the correct place for the documentation.

Compile the package and generate the HTML documentation:

    make
    make html

### Important

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

Test the results:

    make check

### Caution

The code in gmp is highly optimized for the processor where it is built. Occasionally, the code that detects the processor misidentifies the system capabilities and there will be errors in the tests or other applications using the gmp libraries with the message `Illegal instruction`. In this case, gmp should be reconfigured with the option `--host=none-linux-gnu` and rebuilt.

Ensure that at least 199 tests in the test suite passed. Check the results by issuing the following command:

    cat $(find -name '*.log') | grep -c ^PASS

Install the package and its documentation:

    make install
    make install-html

## 8.23.2. Contents of GMP

Installed libraries: libgmp.so and libgmpxx.so
Installed directory: /usr/share/doc/gmp-6.3.0

### Short Descriptions

`libgmp` | Contains precision math functions
`libgmpxx` | Contains C++ precision math functions

- Prev

  Binutils-2.46.1

- Next

  MPFR-4.2.2

- Up
- Home