Compiling gcc-4.8.1: "libmpc.so.2 cannot open shared object file download prerequisites"

MattG picture MattG · Aug 26, 2013 · Viewed 8.6k times · Source

Many people appear to have encountered this problem. The GNU website strongly recommends running

./contrib/download_prerequisites

in the source directory to avoid problems with linking MPC, MPFR and GMP. The following link contains the instructions I've followed: http://gcc.gnu.org/wiki/InstallingGCC which I've listed here:

tar xzf gcc-4.8.1.tar.gz
cd gcc-4.8.1
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-4.8.1/configure --prefix=$HOME/gcc-4.8.1-install
make
make install

The FAQ at this url: http://gcc.gnu.org/wiki/FAQ#configure_suffix claims that the compilation will have no problem finding MPC related files so long as they are located in a subdirectory of the gcc-4.8.1 source directory. Running

./contrib/downlaod_prerequisites

downloads MPC in the correct location, yet I still get this error after running make:

checking for x86_64-unknown-linux-gnu-gcc... /home/xxxx/gcc-4.8.1-build/./gcc/xgcc -B/home/xxxx/gcc-4.8.1-build/./gcc/ -B/home/xxxx/gcc-4.8.1-install/x86_64-unknown-linux-gnu/bin/ -B/home/xxxx/gcc-4.8.1-install/x86_64-unknown-linux-gnu/lib/ -isystem /home/xxxx/gcc-4.8.1-install/x86_64-unknown-linux-gnu/include -isystem /home/xxxx/gcc-4.8.1-install/x86_64-unknown-linux-gnu/sys-include   
checking for suffix of object files... configure: error: in `/home/xxxx/gcc-4.8.1-build/x86_64-unknown-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.

Opening /home/xxxx/gcc-4.8.1-build/x86_64-unknown-linux-gnu/libgcc/config.log reveals the following error:

/home/mgiamou/gcc-4.8.1-build/./gcc/cc1: error while loading shared libraries: libmpc.so.2: cannot open shared object file: No such file or directory

The GNU FAQs (http://gcc.gnu.org/wiki/FAQ#configure_suffix) say that this error is symptomatic of not having properly installed MPC. Any help would be much appreciated.

Answer

MattG picture MattG · Sep 27, 2013

I didn't have the latest version of binutils installed. Be sure to have the latest version whenever installing the latest gcc.