2

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.

MattG
  • 1,416
  • 2
  • 13
  • 31
  • 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 Aug 26 '13 at 19:05
  • 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 Aug 26 '13 at 19:12
  • 1
    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 Aug 26 '13 at 19:35
  • 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 Aug 26 '13 at 19:40
  • That's not a precise answer. Where are those libmpc things? What -L flags did you find? – Marc Glisse Aug 26 '13 at 21:16
  • The only -L flag I found was the lib64 folder of my previous gcc installation, and that is where the libmpc things are. – MattG Aug 26 '13 at 21:23
  • That's not normal, thanks to download_prerequisites, the makefiles should cause gmp/mpfr/mpc to be built, and -L flags to those new libs added. Also, could you remove libmpc.so (the symlink) from whereever it is? You can easily put it back afterwards if you wish (hoping that you don't end up with incompatible include files and lib). – Marc Glisse Aug 27 '13 at 06:15
  • I added the path of the -L directory to LD_LIBRARY_PATH and the installation worked. – MattG Aug 27 '13 at 14:51

1 Answers1

1

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

MattG
  • 1,416
  • 2
  • 13
  • 31