Tag Archives: gcc-4.7.2 cannot compute suffix of object fil…

[How to Solve] gcc-4.7.2 cannot compute suffix of object fil…

I intend to learn C++ 11, so I have to change the compiler. After downloading the latest source code, I compile it according to the usual process: 1.

1. Unpack the RPM package:

[root@linuxopt]# tar xjvf gcc-4.0.1.tar.bz2 (unpacked to generate the source directory /opt/gcc-4.0.1)

2. Create the installation target directory:

[root@linux opt]# mkdir /usr/local/gcc-4.0.1/

3. Enter the installation target directory: [root@linux opt]# mkdir /usr/local/gcc-4.0.1/

[root@linux opt]# cd /usr/local/gcc-4.0.1/ (this step is important, when configuring the installation files, you need to execute the configure command in the target directory)

[root@linux opt]# pwd

/usr/local/gcc-4.0.1

4. Configure the installation files.

[root@linux gcc-4.0.1]# % ../gcc-4.1.2/configure –prefix=/usr/local/gcc-4.1.2 –enable-threads=posix –disable-checking –enable–long-long –host=i386-redhat-linux–with-system-zlib –enable-languages=c,c++,java

creating cache ./config.cache

checking host system type… i686-pc-linux-gnu

5. Compile the installation files:

[root@linux gcc-4.0.1]# pwd

/usr/local/gcc-4.0.1

[root@linux gcc-4.0.1]# make (execute compilation in the target directory)

6. Install gcc:</strong

[root@linux gcc-4.0.1]# pwd

/usr/local/gcc-4.0.1

[root@linux gcc-4.0.1]# make install (execute install in the target directory)

 

The above is the installation process of others, I installed the latest Gcc-4.7.2, the steps are almost the same, is the following problem.

But when make, unfortunately, there is a

“checking for suffix of object files… configure: error: cannot compute suffix of object files: cannot compile

See `config.log’ for more details.

make[2]: *** [configure-stage1-target-libgcc] Error 1

make[2]: Leaving directory `/tmp/gcc-4.3.2′

make[1]: *** [stage1-bubble] Error 2

make[1]: Leaving directory `/tmp/gcc-4.3.2′

make: *** [bootstrap] Error 2

Follow the prompts to open the config.log

Find the cause of the error.“when loading shared libraries:libmpc.so.3:cannot open shared object file: No such file or directory”.

So that’s it. Next, add the mpc, gmp, and mpfr lib folders to the LD_LIBRARY_PATH variable decisively.

Note that the three libs here are set according to the path you installed.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mpc-1.0/lib:/usr/local/gmp-5.0.5/lib:/usr/local/mpfr-3.1.1/lib

 

Next, reconfigure

make

and wait for a long time

…………

 

Done!