How to install GMP, MPFR & BNCpack from source tar balls Update: 2006-10-24 by Tomonori Kouya Part I: Installing GMP 0. Remove the older version of GMP if it has been already installed. ex) % apt-get remove gmp or % yum remove gmp 1. Download the newest version of GMP from http://swox.com/gmp/, and save it on your home directory. 2. Unpack gmp-4.x.x.tar.gz and change current directory to "gmp-4.x.x". % tar zxvf gmp-4.x.x.tar.gz % cd gmp-4.x.x 3. Run the configure script with options you need. % ./configure --prefix=/usr/local --enable-cxx ^^^(1)^^^^ ^^^^^(2)^^^^ (1) Indication of the directory where GMP will be installed (2) Enable to install C++ class library of GMP (CAUTION!) MPFR package included in gmp-4.x.x is old and with unfixed bugs, so it should not be used. Alternatively, you can choose the newest and bug-fixed version of MPFR from http://www.mpfr.org/ 4. Make the library of GMP and install it to the directory which the "prefix" option indicated. % make % su # make install 5. Compile test programs like the followings with GMP to check whether it has been correctly installed. gmp-mpz.c: http://na-inet.jp/tutorial/02/gmp-mpz.c gmp-mpf.c: http://na-inet.jp/tutorial/02/gmp-mpf.c ex) % gcc -I/usr/local gmp-mpz.c -L/usr/local/lib -lgmp -lm % ./a.out Part II: Installing MPFR 0. Remove the older version of MPFR if it has been already installed. ex) % apt-get remove mpfr or % yum remove mpfr 1. Download the newest version of MPFR from http://www.mpfr.org/, and save it on your home directory. 2. Unpack mpfr-2.x.x.tar.gz and change current directory to "mpfr-2.x.x". % tar zxvf mpfr-2.x.x.tar.gz % cd mpfr-2.x.x 3. Run the configure script with options you need. % ./configure --prefix=/usr/local ^^^(1)^^^^ (1) Indication of the directory where MPFR will be installed 4. Make the library of MPFR and install it to the directory which the "prefix" option indicated. % make % su # make install 5. Compile test programs with MPFR like the followings to check whether it has been correctly installed. mpfr.c: http://na-inet.jp/tutorial/02/mpfr.c ex) % gcc -I/usr/local mpfr.c -L/usr/local/lib -lmpfr -lgmp -lm % ./a.out Part III: Installing BNCpack (without parallelized program with MPI) 1. Download the newest version of BNCpack from http://na-inet.jp/na/bnc/, and save it on your home directory. 2. Unpack bnc-0.xx.tar.gz and change current directory to "bnc-0.xx". % tar zxvf bnc-0.xx.tar.gz % cd bnc-0.xx 3. Edit "bncmake.inc" to fit your enviroment, especially GMPPREFIX=/usr/local MPFRPREFIX=/usr/local DEFS = -DUSE_GMP -DUSE_MPFR are very importrant so as to run mutiple precision floating point computations. 4. Make the library of BNCpack and install it to the directory which the "prefix" option indicated in "bncmake.inc". % make % su # make install 5. Compile test programs with BNCpack like the followingsto check whether it has been correctly installed. bnc1-1.c: http://na-inet.jp/tutorial/02/bnc1-1.c ex) % gcc -I/usr/local bnc1-1.c -L/usr/local/lib -lbnc -lmpfr -lgmp -lm % ./a.out