• Register
1 vote
97 views

Problem :

I am trying to learn the GCC. If I execute the below command then I always face the following error.

make -j4
Error received:
checking for suffix of object files... configure: error: in `/mnt/LFS/source/gcc-4.6.2/x86_64-lfs-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[1]: *** [configure-target-libgcc] Error 1
Can somebody guide me in fixing above error?
8 5 2
3,230 points

2 Answers

1 vote

Solution :

I am expert in GCC I can help you in fixing your error.

If you are trying to build the GCC then you must follow below instructions very carefully. Please do not make below listed common mistakes:

Please do not run your ./configure from the gcc src dir because this is not supported instead you need to run the configure from the outside of your gcc source directory

Also if your GCC links dynamically to a prerequisite libs e.g. GMP/MPFR/MPC then in that case those shared libraries must be present in a dynamic linkers path e.g. LD_LIBRARY_PATH both when you are trying to build the gcc and when trying to use your installed compiler.*"

Please find below the very simple example without the dynamic link to GMP/MPFR/MPC:

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

 

8 4
5,680 points
0 votes

Solution:

This issue is concerned by dyanmic link library path issue when the test programs attempt to link against libmpc/libmpfr/libgmp.

Append below environment variable for allowing ld link against the correct so file:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/mpc/lib/

Then attempt build gcc again.

"*Building GCC is not trivial, however is not difficult in case you follow the instructions carefully. Many people rush into attempting to make it without reading the installation docs rightly and create one or more of these common mistakes:

1) do not run ./configure from gcc src dir (this is not supported) => you require to run configure from outside the gcc source directory

2) Note: if GCC links dynamically to the prerequisite libs (GMP/MPFR/MPC) then the shared libraries must be in the dynamic linker's path (LD_LIBRARY_PATH), both when building gcc and when using the installed compiler.*"

Simple example (without dynamic link to GMP/MPFR/MPC):

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

This error message can arise from a number of different reasons. The best way to figure out which one is to check the logfile '/home/manu/gcc/gcc/i686-pc-linux-gnu/libgcc/config.log' in the example below. Or in the original posters case '/mnt/LFS/source/gcc-4.6.2/x86_64-lfs-linux-gnu/libgcc' and watch for the last error line.

Like any of the GNU projects, GCC is employing the GNU autotools to usually configure the compilation for the specifics of the build system. The configure script thereby uses small test programs - generally named conftest.c - to test in case given functions and/or features are available. In case the compilation of such a test program fails, you'll see an error message :

 checking for suffix of object files... configure: error: in
 `/home/manu/gcc/gcc/i686-pc-linux-gnu/libgcc': 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 `/home/manu/gcc/gcc'

This error message is completely misleading and repeatedly the problem has nothing to do with the message. You have to inspect the file 'config.log' in the directory where the error happened. In the example above, you would have to inspect the 'config.log' file in the directory '/home/manu/gcc/gcc/i686-pc-linux-gnu/libgcc'. There might be various test programs that failed at the time of the configuration, however some of these failures are non-critical. Inspect for the last error entry in the file.

Common reasons for this error message are:

  • Necessary libraries for the GCC build are missing, particularly MPFR, GMP and MPC. In case installed as shared libraries they should be in the runtime linker's search path so they can be put in. Please, pursue the instructions in the answer to Why does my ./configure and make fail?

  • The compiler crashed. Such as in case there is an error such as 'conftest.c: internal compiler error:', this indicates a bug in the compiler. In case you are employing an unmodified version of GCC, please pursue the action to report the bug.

 

10 6 4
31,120 points

Related questions

1 vote
1 answer 720 views
720 views
Problem : I want to run the newly compiled binary on some of the very oldish 32bits RedHat distribution. This binary is compiled C (not C++) on the CentOS 32bits VM running the libc v2.12. RedHat complains about the libc version as below: Error while loading shared ... , that's why it is most likely not using anything new from the libc. Is there any way to reduce the libc version requirement?
asked Jan 2 alecxe 7.5k points
0 votes
1 answer 521 views
521 views
Problem : I am completely new to the Notepad++ and C++ programming language. I am unable to figure out that what has gone wrong in my coding, may be it might look simple to resolved to many. I tried a lot to search for the solution, but without any ... NppExec script taken as below : NPP_SAVE CD $(CURRENT_DIRECTORY) Compiled.exe -c -w "$(FILE_NAME)" Please guide me in resolving this issue.
asked Dec 16, 2019 alecxe 7.5k points
1 vote
1 answer 34 views
34 views
Problem: I want to install one package named speech_tools-2.1-release.tar.gz. After I run the command ./configure in this package, it shows me a message:\ Configure: error: no acceptable C compiler found in $PATH See 'config.log' for more details Any solution would be much appreciated. Thanks.
asked Mar 10 Gavin 15.3k points
0 votes
1 answer 46 views
46 views
Problem : I want to compile my code to test my function to read and print the data file, but I get the compiling error that I don't understand as follows "Error: expected constructor, destructor, or type conversion before ';' token".
asked Jan 24 jwilliam 3.9k points
0 votes
2 answers 21 views
21 views
Problem: Linux uses a logical directory tree to organize files into different folders? True False
asked Apr 18 ArifulIslam 5.7k points