邢栋博客

邢栋博客,Action博客,记录工作和生活中的点点滴滴

centos7下gcc升级
=====下载地址=====
https://ftp.gnu.org/gnu/gcc/

=====下载gcc和相关依赖=====
wget https://ftp.gnu.org/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.gz
tar -zxvf gcc-5.4.0.tar.gz
cd gcc-5.4.0
./contrib/download_prerequisites //相关依赖


=====建立存放编译文件的文件夹+编译=====
mkdir gcc-build-5.4.0
cd gcc-build-5.4.0/
../configure --prefix=/usr/local/gcc5 --enable-languages=c,c++,go  --disable-multilib
make  //耗时很长很长
make install 

=====复制命令=====
rm -f /usr/bin/gcc
rm -f /usr/bin/g++
ln -s /usr/local/gcc5/bin/gcc /usr/bin/gcc
ln -s /usr/local/gcc5/bin/g++ /usr/bin/g++


=====关联新的动态库=====
cd /usr/local/gcc5/lib64/
cp libstdc++.so.6.0.21 /usr/lib64/
rm -rf /usr/lib64/libstdc++.so.6
ln -s libstdc++.so.6.0.21 libstdc++.so.6
linux centos编译node报错

linux centos编译node报错
WARNING: C++ compiler too old, need g++ 4.8 or clang++ 3.4 (CXX=g++)
我查看了我的版本是
[root@Action node-v4.2.3]# g++ --version
g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16)
Copyright (C) 2010 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.

于是我只好安装4.8版本,从网上找到了方法
这里我用的是root用户
cd ~
http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-4.8.1/gcc-4.8.1.tar.gz
tar zxvf gcc-4.8.1.tar.gz
cd gcc-4.8.1
./contrib/download_prerequisites  //下载所需要的依赖包
cd ..
mkdir gcc-build-4.8.1
../gcc-4.8.1/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
make 
make install

//如果是64位系统,则下面为lib64/
cp ~/gcc-build-4.8.1/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.18 /usr/lib 
ln -sf /usr/lib/libstdc++.so.6.0.18 /usr/lib/libstdc++.so.6
下面查看版本
g++ --version
[root@Action gcc.4.8.1]# g++ --version
g++ (GCC) 4.8.1
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.


优惠券
广告位-淘宝
最新微语