0

I'm trying to compile node-5.1.0 in CentOS 6.7 but is asking for g++ 4.8 or above.

[root@ws node-v5.1.0]# ./configure
WARNING: C++ compiler too old, need g++ 4.8 or clang++ 3.4 (CXX=g++)
...

First I've installed "Development Tools":

[root@ws node-v5.1.0]# yum groupinstall 'Development Tools'

After I check g++ version:

[root@ws node-v5.1.0]# g++ -v
...
gcc version 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) 

Though that version isn't enough then I perform a little research and found a possible way to install/upgrade g++. I have found this and I followed every step:

[root@ws node-v5.1.0]# wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo

[root@ws node-v5.1.0]# yum install devtoolset-2-gcc devtoolset-2-binutils

[root@ws node-v5.1.0]# /opt/rh/devtoolset-2/root/usr/bin/gcc --version
gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15
...

I tried the same command again for compile NodeJS:

[root@ws node-v5.1.0]# ./configure
WARNING: C++ compiler too old, need g++ 4.8 or clang++ 3.4 (CXX=g++)

But as you can see I got the same error regarding g++ version which make me ask:

  • how can I pass new installed gcc version to ./configure?
  • there is any other way to use or set that version as default?

Note: by version I mean the one at /opt/rh/devtoolset-2/root/usr/bin/gcc if it's complete secure to change to that one

Update

After post the question I've found this and follow the same steps:

[root@ws node-v5.1.0]# export CC=/opt/rh/devtoolset-2/root/usr/bin/gcc
[root@ws node-v5.1.0]# export CPP=/opt/rh/devtoolset-2/root/usr/bin/cpp
[root@ws node-v5.1.0]# export CXX=/opt/rh/devtoolset-2/root/usr/bin/c++

But results is the same:

[root@ws node-v5.1.0]# ./configure
WARNING: C++ compiler too old, need g++ 4.8 or clang++ 3.4 (CXX=g++)
  • Why do you need to compile node? how about using binaries? – risyasin Nov 18 '15 at 15:43
  • @risyasin I can use binaries for sure by downloading them and place somewhere but I think this is not the recommended/right way, if you have some docs about this please share with me but I don't know how to get this working after use binaries – ReynierPM Nov 18 '15 at 16:01
  • 1
    Just download the binaries x64 or 86 which is your platform. extract into /usr. so you will have 2 executable in /usr/bin. node & npm. I really don't think it will make a difference compiling vs using precompiled ones. in your case you can even break dependencies of other packages in your system. – risyasin Nov 18 '15 at 20:23
  • 1
    You don't need compiling unless you have changed the nodejs sources or the libraries such as openssl. if you are using distro provided libraries without changing their sources. then you really do not need it. – risyasin Nov 18 '15 at 20:35
1
  • update dev3 and enable -scl enable devtoolset-3 bash -./configure
  • make sure from nodjs dir
1

Import CERN's GPG key:

sudo rpm --import http://ftp.scientificlinux.org/linux/scientific/5x/x86_64/RPM-GPG-KEYs/RPM-GPG-KEY-cern

Save repository information as /etc/yum.repos.d/slc6-devtoolset.repo on your system:

wget -O /etc/yum.repos.d/slc6-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo Install:

sudo yum install devtoolset-2

Enable the environment:

scl enable devtoolset-2 bash

Test the environment:

$ gcc --version gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15) ...

$ g++ --version g++ (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15) ...

Extracted from this gist.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.