GMP

From CBLFS
Revision as of 12:28, 30 May 2007 by 71.224.57.6 (talk)
Jump to navigationJump to search
Download Source: ftp://ftp.gnu.org/gnu/gmp/gmp-4.3.1.tar.bz2

Introduction to GMP

According to their site, "GMP is a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating point numbers. There is no practical limit to the precision except the ones implied by the available memory in the machine GMP runs on. GMP has a rich set of functions, and the functions have a regular interface. The main target applications for GMP are cryptography applications and research, Internet security applications, algebra systems, computational algebra research, etc.GMP is carefully designed to be as fast as possible, both for small operands and for huge operands. The speed is achieved by using fullwords as the basic arithmetic type, by using fast algorithms, with highly optimized assembly code for the most common inner loops for a lot of CPUs, and by a general emphasis on speed."

Project Homepage: http://gmplib.org/

Dependencies

Non-Multilib

Compile the package:

./configure --prefix=/usr --enable-cxx \
    --enable-mpbsd &&
make

Run the test suite

make check

Install the package

make install

Multilib

32Bit

Compile the package:

CC="gcc ${BUILD32}" ./configure --prefix=/usr \
    --host=${CLFS_TARGET32} --enable-cxx \
    --enable-mpbsd &&
make

Install the package

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

Command Explanations

--enable-cxx: Enables C++ support.

--enable-mpbsd: Configures make to build the Berkeley MP compatibility library.

N32

Compile the package:

CC="gcc ${BUILDN32}" ./configure --prefix=/usr \
    --libdir=/usr/lib32 --enable-cxx \
    --enable-mpbsd &&
make

Install the package

make install &&
mv -v /usr/include/gmp{,-n32}.h

64Bit

Compile the package:

CC="gcc ${BUILD64}" ./configure --prefix=/usr \
    --libdir=/usr/lib64 --enable-cxx \
    --enable-mpbsd &&
make

Install the package

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

Creating a Stub Header (Multilib Only)

Creating a Generic Stub Header

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

Creating a Stub Header For Mips

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

#include <sgidefs.h>

#if (_MIPS_SIM == _ABIO32)
# include "gmp-32.h"
#elif (_MIPS_SIM == _ABIN32)
# include "gmp-n32.h"
#elif (_MIPS_SIM == _ABI64)
# include "gmp-64.h"
#endif

#endif /* __STUB__GMP_H__ */
EOF

Contents

Installed Programs: None
Installed Libraries: libgmp.{a,la,so}, libgmpxx.{a,la,so}
Installed Directories: None

Short Descriptions

libgmp.{a,la,so} contains the definitions for GNU multiple precision functions.
libgmpxx.{a,la,so} contains a C++ class wrapper for GMP types.