1
votes

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.

1
Did you exactly follow the instructions from step 1, or did you first try something else and only then run the contrib script? Can you look through the logs for the command line that created cc1 (should contain "-o cc1")? - Marc Glisse
I followed the instructions sequentially; I didn't try anything beforehand. The command line that creates cc1 is very large, anything I should be looking for in particular? - MattG
Any -L flag related to MPC. Then check that there is indeed a libmpc.a in that directory, and no libmpc.so. Then check that there isn't a libmpc.so in any of the other paths pointed to by a -L flag. - Marc Glisse
Both libmpc.a and libmpc.so@ are present! libmpc.so.1@ and libmpc.so.2 are also there. Are these interfering with the MPC download in the source folder? - MattG
That's not a precise answer. Where are those libmpc things? What -L flags did you find? - Marc Glisse

1 Answers

1
votes

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