Skip to content

Instantly share code, notes, and snippets.

@giwa
Last active December 6, 2023 07:36
Show Gist options
  • Save giwa/b1fb1e44dc0a7d270881 to your computer and use it in GitHub Desktop.
Save giwa/b1fb1e44dc0a7d270881 to your computer and use it in GitHub Desktop.
Install g++/gcc 4.8.2 in CentOS 6.6 ref: http://qiita.com/giwa/items/28c754d8fc2936c0f6d2
$ wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
$ yum install devtoolset-2-gcc devtoolset-2-binutils
$ yum install devtoolset-2-gcc-c++ devtoolset-2-gcc-gfortran
$ /opt/rh/devtoolset-2/root/usr/bin/gcc --version
gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
scl enable devtoolset-2 bash
source /opt/rh/devtoolset-2/enable
@srikanthjeeva
Copy link

This worked! Thanks!

@leoxk
Copy link

leoxk commented Nov 21, 2016

works, thank you.

@wyabhinav
Copy link

Works like a charm. Thanks :D

@Lemon-Liu
Copy link

Lemon-Liu commented Jul 23, 2017

when typed the code
yum install devtoolset-2-gcc devtoolset-2-binutils
and
yum install devtoolset-2-gcc-c++ devtoolset-2-gcc-gfortran.
the following error came out:

http://people.centos.org/tru/devtools-2/6Server/x86_64/RPMS/repodata/repomd.xml:` [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: testing-devtools-2-centos-6Server. Please verify its path and try again

How can I fix this problem?

@Lemon-Liu
Copy link

Lemon-Liu commented Jul 23, 2017

oh~
I fix the problem by edit the file /etc/yum.repos.d/devtools-2.repo:
change the
http://people.centos.org/tru/devtools-2/$releasever/$basearch/RPMS
to
http://people.centos.org/tru/devtools-2/6/x86_64/RPMS
and then follow the code above, it works.
thanks a lot!
and for reference for those like me.

@vip3r011
Copy link

vip3r011 commented Sep 25, 2018

to make native gcc use exports:
export CC=/opt/rh/devtoolset-2/root/usr/bin/gcc
export CPP=/opt/rh/devtoolset-2/root/usr/bin/cpp
export CXX=/opt/rh/devtoolset-2/root/usr/bin/c++

i used this way to compile swoole-4.2.1 on centos 6.9 php 7.1

@ashimloves
Copy link

Saved my life after googling here and there for like 3 hours.... phew.. Thanks mate.
In my case I was not able to install couchbase on CentOS 6.8 with g++ 4.7.
Below was the error (hopefully Google indexes it and people can find solution to this error easily).
/root/.node-gyp/8.14.0/include/node/v8-platform.h:133:11: error: overriding ‘virtual v8::Platform::~Platform() noexcept (true)’ make: *** [Release/obj.target/couchbase_impl/src/couchbase_impl.o] Error 1 make: Leaving directory /opt/executron/node_modules/couchbase/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 2.6.32-573.8.1.el6.x86_64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /opt/executron/node_modules/couchbase
gyp ERR! node -v v8.14.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! couchbase@2.6.2 install: prebuild-install || node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the couchbase@2.6.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-12-08T15_04_39_398Z-debug.log
`

@ForeverYoung1208
Copy link

tank you!!! This really helps to install sassc ruby gem (it needs g++ compiler more than 4.5.0) on old centos systems!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment