Install New GCC Versions in User Space

Before Install

Perhaps the most common error might be imcompatible versions of gmp, mpfr, and mpc on linux machines.

First notice that mpfr and mpc depend on gmp. Therefore, we download a gmp package from internet, which could any version that satisfies the critieria. I perfer one most close to the minimum requirement.

./configure --prefix=... --enable-shared
make
make install

Next, we install mpfr, as mpc depends on both mpfr and gmp. Please remember add --with-gmp= in the configuration phase.

./configure --prefix=... --enable-shared --with-gmp=...
make
make install

Finally, install mpc before installing gcc, setting --with-gmp and --with-mpfr to the above directories.

./configure --prefix=... --enable-shared --with-gmp=... --with-mpfr=...
make
make install

Install GCC

Nice work as you have installed above trivial prerequisites.

At outset, we unset these environment variables to make sure the purity 

unset LIBRARY_PATH C_INCLUDE_PATH CPLUS_INCLUDE_PATH LD_LIBRARY_PATH 

In the configuration phase, please add above gmp, mpfr, and mpc libraries.

./configure --prefix=... --enable-shared --with-gmp=... --with-mpfr=... --with-mpc=...

If there is no 32-bit system library on the machine, add --disable-multilib.

Using shared dynamic linking, we also set new LIBRARY_PATH C_INCLUDE_PATH CPLUS_INCLUDE_PATH LD_LIBRARY_PATH to ensure the system could find gmp, mpc and mpfr libraries.

Some annoying troubles might occur due to the incorrect environment variables. For instance, if we forget to remove ":" at the end of a variable, unexpected problems could happen.

评论

此博客中的热门博文

Following the Guide--An Odd Problem with Linking MKL

Programming KNL--Architecture