0

I can't seem to be able to compile Node.js on CentOS 6.6 (64 bits) GCC v4.9.2

$ ./configure
Node.js configure error: No acceptable C compiler found!

        Please make sure you have a C compiler installed on your system and/or
        consider adjusting the CC environment variable if you installed
        it in a non-standard prefix.

More details:

$ which gcc
/usr/bin/gcc

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc/libexec/gcc/x86_64-unknown-linux-gnu/4.9.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-current/configure --enable-languages=c,c++,fortran --enable-multilib --prefix=/usr/local/gcc
Thread model: posix
gcc version 4.9.2 (GCC)

$ which python
/usr/bin/python

$ python --version
Python 2.6.6

I have tried to set CC..

$ CC="/usr/local/gcc/bin/gcc"

$ set | grep CC
CC=/usr/local/gcc/bin/gcc

but it leads to the same error.

Any ideas?


Edit 1 - Michael's Question

What happened to the compiler the system came up with?

I have installed a newer version of the compiler (v4.9.2) in /usr/local/gcc, and removed the original compiler (v4.4.7) and tried to replace it that way:

yum remove -y gcc gcc-c++ cpp

sudo mv /usr/bin/g++  /usr/bin/g++_old
sudo mv /usr/bin/c++ /usr/bin/c++_old

sudo ln -s -f /usr/local/gcc/bin/gcc  /usr/bin/gcc
sudo ln -s -f /usr/local/gcc/bin/g++  /usr/bin/g++
sudo ln -s -f /usr/local/gcc/bin/c++ /usr/bin/c++
sudo ln -s -f /usr/local/gcc/bin/cpp /usr/bin/cpp
sudo ln -s -f /usr/local/gcc/bin/gfortran /usr/bin/gfortran
sudo ln -s -f /usr/local/gcc/bin/gcov /usr/bin/gcov

sudo cp /usr/local/gcc/lib64/libstdc++.so.6.0.20 /usr/lib64/.
sudo mv /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6.bak
sudo ln -s -f /usr/lib64/libstdc++.so.6.0.20 /usr/lib64/libstdc++.so.6

I am doing this because I am installing HHVM on this system which needs a recent compiler.

Mick
  • 203
  • 2
  • 7
  • 1
    That compiler setup may work for hhvm, but it's pretty useless for anything else. You should be [using CentOS 7](https://github.com/facebook/hhvm/wiki/Building-and-installing-hhvm-on-CentOS-7.x), anyway, as it won't require you to replace the compiler, and more things will be current. – Michael Hampton Aug 24 '15 at 23:45
  • OK, awesome point. I will give CentOS 7 a go. However, how can I keep both compilers on the same system? (meaning one maintained with Yum and the other compiled manually). Is there any chance you could post this as an answer to help me out? That would be greatly appreciated. – Mick Aug 24 '15 at 23:50
  • 1
    Actually it's quite difficult to have two gcc versions on the same system. You could do something like use a Software Collection, but I personally don't like those as they are not very easy to use. Overall, basing the system on C7 will pretty much solve all your problems anyway and be more future proof. – Michael Hampton Aug 24 '15 at 23:53
  • Crystal clear - thank you. Not sure if we should leave this without an answer. Could you sum this up in one sentence and I accept your answer? – Mick Aug 25 '15 at 00:03

1 Answers1

1

That compiler setup may work for hhvm, but it's pretty useless for anything else. It's quite difficult to have two gcc versions on the same system. You could do something like use a Software Collection, but I personally don't like those as they are not very easy to use.

You should be using CentOS 7, anyway, as it won't require you to replace the compiler, and more things will be current. Overall, basing the system on C7 will pretty much solve all your problems anyway and be more future proof.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940