0

I am trying to install gcc-4.9.0 locally. I gave the following command for configuring the install

LD_LIBRARY_PATH=/home/user/gmp-6.0.0/lib:/home/user/mpfr-3.1.2/lib:/home/user/mpc-
1.0.2/lib ./configure --prefix=/home/user/gcc-4.9.0-latest --with-
gmp=/home/user/gmp-6.0.0 --with-mpfr=/home/user/mpfr-3.1.2 --with-
mpc=/home/user/mpc-1.0.2 --enable-languages=c,c++ --disable-multilib

It configured without giving any errors and then when i do make install, i get the following error

gcc-4.9.0> make install
make[1]: Entering directory `/home/user/softwares/gcc-4.9.0/build/gcc-
4.9.0'
/bin/sh ./mkinstalldirs /home/user/gcc-4.9.0-latest /home/user/gcc-4.9.0-latest
/bin/sh: line 0: cd: host-x86_64-unknown-linux-gnu/fixincludes: No such file or    
directory
make[1]: *** [install-fixincludes] Error 1
make[1]: Leaving directory `/home/user/software/gcc-4.9.0/build/gcc-4.9.0'
make: *** [install] Error 2

Can anyone help me solve this?

The machine is running RHEL 4 and the linux kernel is 2.6.9-67.ELsmp

EDIT: I found errors in the config.log file

configure:4970: checking whether g++ accepts -static-libstdc++ -static-libgcc
configure:4987: g++ -o conftest -g -O2   -static-libstdc++ -static-libgcc conftest.cpp    
>&5
g++: unrecognized option `-static-libstdc++'
conftest.cpp:11:2: #error -static-libstdc++ not implemented
configure:4987: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
|
| #if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
| #error -static-libstdc++ not implemented
| #endif
| int main() {}

EDIT2:

I ran make and received the following errors

checking for x86_64-unknown-linux-gnu-gcc... /home/user/software/gcc-4.9.0/host-
x86_64-unknown-linux-gnu/gcc/xgcc -B/home/user/software/gcc-4.9.0/host-x86_64-
unknown-linux-gnu/gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-
unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem 
/usr/local/x86_64-unknown-linux-gnu/sys-include
checking for suffix of object files... configure: error: in `/home/user/software
/gcc-4.9.0/x86_64-unknown-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/user/software/gcc-4.9.0'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/user/gcc-build/gcc-4.9.0'
make: *** [all] Error 2
ab_11
  • 83
  • 1
  • 8
  • The "errors" in the first edit are not significant. The configure script is probing the compiler to see what it can do (and when it can't do something, it throws an error which gets into the log). You only need to worry if the configure script itself throws an error. – ams Jul 01 '14 at 10:51
  • LD_LIBRARY_PATH should also be in the environment for make, I don't think configure records it. – Marc Glisse Nov 09 '14 at 09:14
  • `make clean` and then try again. – lambodar Aug 31 '19 at 05:00

2 Answers2

1

Looks like you built all of the dependencies outside of the gcc packaging. Included is a script that will gather all of the dependencies into the gcc packaging and include them as part of the gcc build:

gcc-4.9.0/contrib/download_prerequisites

That should simplify your initial configuration.

Not sure what compiler and/or version being used to build the 4.9.0 gcc compiler. Assuming 3.4-ish if you are still on RHEL 4. Probably will need to build/install 4.2.x gcc in order to incrementally get the support required to build 4.9.x due to lack of pre-built gcc support for RHEL 4. It's the price of staying on an older platform.

0

Two problems:

First, you should never build the compiler in the source directory. It might appear to work, sometimes, but it's not supported and the compiler developers don't do that, so you shouldn't. Create an external obj directory, and build there:

mkdir obj
cd obj
/path/to/src/configure ...blah...blah...blah

Second, you missed a step:

make
make install

I know lots of projects set up the makefile so that make install just works, but bootstrapping a compiler is a bit more complicated than most projects.

ams
  • 24,923
  • 4
  • 54
  • 75
  • I added the output I received when i ran 'make' into the question itself as EDIT2 – ab_11 Jul 01 '14 at 04:45
  • I spotted another problem, answer updated. Also, you should find the cause of the "cannot compile" in one of the config.log files. That's important. – ams Jul 01 '14 at 11:04
  • I understood my mistake, of building the compiler from the source directory itself and now I am trying to do it from an object directory as you have suggested. Infact 'make' is running currently, let's see if it throws another error or not. I could not find any string as "cannot compile" in the log file though. – ab_11 Jul 01 '14 at 11:16
  • There's more than one `config.log`. It depends what directory was being configured when it failed. – ams Jul 01 '14 at 11:18
  • facing the same issue. have done different directory, make and make install. anyone found any solutions on this? – Naveen Sharma Sep 04 '14 at 20:58
  • @NaveenSharma Did you check the `config.log` files? – ams Sep 04 '14 at 21:15
  • Yes, but as I said, those errors are not interesting. They're just configure detecting that it can't use a specific option. You need to track down the "cannot compute suffix of object files: cannot compile" in the `config.log`, and find out what it was trying to do. The OP seems incapable of doing so. – ams Sep 04 '14 at 21:21
  • @ams, thanks. yea, i had checked that, but thought that might not be relevant since net activity was around static c++. `configure:4385: checking for suffix of executables configure:4392: gcc -o conftest conftest.c >&5 configure:4396: $? = 0 configure:4418: result: configure:4424: checking for suffix of object files configure:4446: gcc -c conftest.c >&5 configure:4450: $? = 0 configure:4471: result: o`. This is the only two times suffix is mentioned. – Naveen Sharma Sep 04 '14 at 21:29
  • @ams, also, i also have a preexisting gcc 4.1.2 which might have its own deps and residuals. I have installed gmp, isl, mpfr, mpc in seperate prefixed locations though. – Naveen Sharma Sep 04 '14 at 21:33
  • If your build is failing with that message then one of the `config.log` files must have the same error message and more details. – ams Sep 04 '14 at 21:48
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/60653/discussion-between-naveen-sharma-and-ams). – Naveen Sharma Sep 04 '14 at 21:49