The GMP package contains math libraries. These have useful functions for arbitrary precision arithmetic.
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
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
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:
awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log
Install the package and its documentation:
make install make install-html
Clean previous build:
make distclean
Generic libraries can be created by running the following:
cp -v configfsf.guess config.guess cp -v configfsf.sub config.sub
Prepare GMP for compilation:
CFLAGS="-m32 -O2 -pedantic -fomit-frame-pointer -mtune=generic -march=i686" \
CXXFLAGS="$CFLAGS" \
ABI="32" \
PKG_CONFIG_PATH="/usr/lib32/pkgconfig" \
./configure --prefix=/usr \
--host=i686-pc-linux-gnu \
--disable-static \
--enable-cxx \
--libdir=/usr/lib32 \
--includedir=/usr/include/m32/gmp
The meaning of the new configure options:
--includedir=/usr/include/m32/gmp
The headers for GMP differ between architectures. Since dealing with GMP is a delicate matter, the headers must be separated per architecture. On a per-package basis, the header path for GMP will overriden, like in the case of Nettle in GLFS.
Compile the package:
sed -i 's/$(exec_prefix)\/include/$\(includedir\)/' Makefile make
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 199 tests in the test suite passed. Check the results by issuing the following command:
awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log
Install the package:
make DESTDIR=$PWD/DESTDIR install cp -Rv DESTDIR/usr/lib32/* /usr/lib32 cp -Rv DESTDIR/usr/include/m32/* /usr/include/m32/ rm -rf DESTDIR