环境:centos6.9最小桌面安装
需要软件包:gcc,gcc5.5
两个安装包可在ftp服务器上下载
Yum 源 centos6
yum clean all
yum -y install gcc
gcc
gcc -verson
gcc -version
yum -y install gcc
yum -y install gcc –nogpgcheck
rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm
yum install gcc
rpm --import https://packages.microsoft.com/keys/microsoft.asc
yum -y install ca-certificates
yum -y install ca-certificates –nogpgcheck
yum -y update nss --nogpgcheck
rpm -ivh openssl-libs-1.0.2k-8.el7.x86_64.rpm
ls
strings /lib64/libc.so.6 | grep GLIBC
cd /home/admin/linux/glibc2.17
ls
rpm -ivh glibc-2.17-55.el6.x86_64.rpm glibc-static-2.17-55.el6.x86_64.rpm glibc-common-2.17-55.el6.x86_64.rpm glibc-utils-2.17-55.el6.x86_64.rpm glibc-devel-2.17-55.el6.x86_64.rpm nscd-2.17-55.el6.x86_64.rpm glibc-headers-2.17-55.el6.x86_64.rpm
rpm -ivh glibc-2.17-55.el6.x86_64.rpm glibc-static-2.17-55.el6.x86_64.rpm glibc-common-2.17-55.el6.x86_64.rpm glibc-utils-2.17-55.el6.x86_64.rpm glibc-devel-2.17-55.el6.x86_64.rpm nscd-2.17-55.el6.x86_64.rpm glibc-headers-2.17-55.el6.x86_64.rpm --nodep
rpm -ivh glibc-2.17-55.el6.x86_64.rpm glibc-static-2.17-55.el6.x86_64.rpm glibc-common-2.17-55.el6.x86_64.rpm glibc-utils-2.17-55.el6.x86_64.rpm glibc-devel-2.17-55.el6.x86_64.rpm nscd-2.17-55.el6.x86_64.rpm glibc-headers-2.17-55.el6.x86_64.rpm
rpm --help
rpm -ivh glibc-2.17-55.el6.x86_64.rpm glibc-static-2.17-55.el6.x86_64.rpm glibc-common-2.17-55.el6.x86_64.rpm glibc-utils-2.17-55.el6.x86_64.rpm glibc-devel-2.17-55.el6.x86_64.rpm nscd-2.17-55.el6.x86_64.rpm glibc-headers-2.17-55.el6.x86_64.rpm --nodeps
strings /lib64/libc.so.6 | grep GLIBC
rpm -ivh glibc-2.17-55.el6.x86_64.rpm glibc-static-2.17-55.el6.x86_64.rpm glibc-common-2.17-55.el6.x86_64.rpm glibc-utils-2.17-55.el6.x86_64.rpm glibc-devel-2.17-55.el6.x86_64.rpm nscd-2.17-55.el6.x86_64.rpm glibc-headers-2.17-55.el6.x86_64.rpm --nodeps
rpm -ivh glibc-2.17-55.el6.x86_64.rpm glibc-static-2.17-55.el6.x86_64.rpm glibc-common-2.17-55.el6.x86_64.rpm glibc-utils-2.17-55.el6.x86_64.rpm glibc-devel-2.17-55.el6.x86_64.rpm nscd-2.17-55.el6.x86_64.rpm glibc-headers-2.17-55.el6.x86_64.rpm --nodeps --
rpm --help
rpm -ivh glibc-2.17-55.el6.x86_64.rpm glibc-static-2.17-55.el6.x86_64.rpm glibc-common-2.17-55.el6.x86_64.rpm glibc-utils-2.17-55.el6.x86_64.rpm glibc-devel-2.17-55.el6.x86_64.rpm nscd-2.17-55.el6.x86_64.rpm glibc-headers-2.17-55.el6.x86_64.rpm --nodeps --force
strings /lib64/libc.so.6 | grep GLIBC
yum install openssl-libs
cd ..
ls
rpm -ivh openssl-libs-1.0.2k-8.el7.x86_64.rpm
rpm -ivh openssl-libs-1.0.2k-8.el7.x86_64.rpm –force
yum -y update nss --nogpgcheck
yum install dotnet-sdk-3.0
1.使用winscp把gcc文件夹和gcc5.5文件夹放到/tmp文件夹下
2.打开终端,使用命令cd /tmp/gcc 进入gcc文件夹中
使用命令rpm -ivh *rpm 安装gcc文件夹下所有的rpm包
开始安装gcc5.5
使用命令cd /tmp/gcc5.5进入gcc5.5文件夹下
/** 解压 */
使用命令tar -xjvf gmp-4.3.2.tar.bz2 -C /usr //解压文件到/usr文件夹下
cd /usr/gmp-4.3.2 //进入文件夹
/** 创建编译目录 */
mkdir gmp-build //创建文件夹
cd gmp-build //进到文件夹下
/** 执行配置 */
../configure --prefix=/usr/local/gmp-4.3.2 //prefix表示后面将要安装到的目录位置
/** 编译 */
make //当gmp-build文件下有makefile文件时使用make进行编译
/** 安装 */
make install //make编译成功后下使用make install安装
./configure -prefix=/usr/local/mpfr-2.4.2
使用命令cd /tmp/gcc5.5进入gcc5.5文件夹下
/** 解压 */
使用命令cd /tmp/gcc5.5进入gcc5.5文件夹下
使用命令tar -xjvf mpfr-2.4.2.tar.bz2 -C /usr //解压文件到/usr文件夹下
cd /usr/mpfr-2.4.2 //进入文件夹
/** 创建编译目录 */
mkdir mpfr-build //创建文件夹
cd mpfr-build //进到文件夹下
/** 执行配置 prefix表示后面将要安装到的目录位置 */
../configure --prefix=/usr/local/mpfr-2.4.2 --with-gmp=/usr/local/gmp-4.3.2
/** 编译 */
make //当mpfr-build文件下有makefile文件时使用make进行编译
/** 安装 */
make install //make编译成功后下使用make install安装
./configure -prefix=/usr/local/mpc-0.8.1
使用命令cd /tmp/gcc5.5进入gcc5.5文件夹下
/** 解压 */
使用命令tar -xzvf mpc-0.8.1.tar.gz -C /usr //解压文件到/usr文件夹下
cd /usr/mpfr-2.4.2 //进入文件夹
/** 创建编译目录 */
mkdir mpc-build //创建文件夹
cd mpc-build //进到文件夹下
/** 执行配置 复制如果报下面错误,此错误结果为无makefile文件,可以手打一遍 */
../configure --prefix=/usr/local/mpc-0.8.1 --with-gmp=/usr/local/gmp-4.3.2 --with-mpfr=/usr/local/mpfr-2.4.2
/** 编译 */
make //当mpc-build文件下有makefile文件时使用make进行编译
/** 安装 */
make install //make编译成功后下使用make install安装
使用命令cd /tmp/gcc5.5进入gcc5.5文件夹下
/** 解压 */
使用命令tar -xzvf gcc-5.5.0.tar.gz -C /usr //解压文件到/usr文件夹下
cd /usr/gcc-5.5.0 //进入文件夹
/** 创建编译目录 */
mkdir gcc-build //创建文件夹
cd gcc-build //进到文件夹下
/** 执行配置 prefix表示后面将要安装到的目录位置 */
../configure --prefix=/usr/local/gcc-5.5.0 --enable-threads=posix --disable-checking --disable-multilib --enable-languages=c,c++ --with-gmp=/usr/local/gmp-4.3.2/ -with-mpfr=/usr/local/mpfr-2.4.2/ --with-mpc=/usr/local/mpc-0.8.1/
当使用../configure报下方错误时
是缺少gcc-c++包,请根据上方步骤进入gcc文件夹中安装所有rpm包
命令为rpm -ivh *rpm
/** 添加环境变量 */
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/gmp-4.3.2/lib/:/usr/local/mpc-0.8.1/lib/:/usr/local/mpfr-2.4.2/lib/
/** 编译 */
make //当mpc-build文件下有makefile文件时使用make进行编译
使用命令make进行编译没通过报以下错误
原因为配置的环境变量出错,请重新仔细看你之前所安装的三个源码包的路径是否准确
/** 安装 */
make install //make编译成功后下使用make install安装
三 配置环境变量并验证是否可用
/** 重新设置gcc环境变量,更新系统gcc版本号 */
mkdir /usr/gcc447backup/ //创建文件夹
mv /usr/bin/{gcc,g++} /usr/gcc447backup //把原版本的4.4.7的gcc备份
cd /usr/bin/ //进入文件夹
ln -s /usr/local/gcc-5.4.0/bin/gcc gcc //配置gcc环境变量
ln -s /usr/local/gcc-5.4.0/bin/g++ g++ //配置g++环境变量
/** 验证是否可用 */
gcc -v
安装成功后如果报以下错误
error while loading shared libraries: libmpc.so.2: cannot open shared object file: No such file or directory
解决办法
cd /usr/lib //进入文件
ln -s -f /usr/local/mpc-0.8.1/lib/libmpc.so.2 解决报错
默认动态库升级完成。重新运行以下命令检查动态库
ar -x libstdc++6_6.3.0-18+deb9u1_arm64.deb
tar xvf data.tar.xz
cp libstdc++.so.6.0.22 /usr/lib64
cd /usr/lib64
rm -rf libstdc++.so.6
ln -s libstdc++.so.6.0.22 libstdc++.so.6
strings /usr/lib64/libstdc++.so.6 | grep GLIBC
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/gmp-4.3.2/lib/:/usr/local/mpc-0.8.1/lib/:/usr/local/mpfr-2.4.2/lib/
安装icu4c需要这个。
cp libstdc++.so.6 /usr/lib64
ICU Package
我们使用源码的方式安装icu. 我选择的是59.1版本,输入以下命令:
wget http://download.icu-project.org/files/icu4c/59.1/icu4c-59_1-src.tgz
tar -xzvf icu4c-59_1-src.tgz
cd icu/source
./configure --prefix=/usr/local/icu
make
make install
参看是否安装成功:
[root@gumis02 ~]# icu-config --version
59.1
[root@gumis02 ~]# icuinfo
icuinfo: error while loading shared libraries: libicutu.so.59: cannot open shared object file: No such file or directory
看到安装成功了,但是查看具体信息会提示缺少 libicutu.so.59,其他缺少的dll,同样处理。
输入以下命令查找,并映射so文件:
[root@gumis02 ~]# find / -name libicutu.so.59
/home/NetCoreSdk/icu/source/lib/libicutu.so.59
/home/NetCoreSdk/icu2/source/lib/libicutu.so.59
/usr/lib/libicutu.so.59
/usr/local/icu/lib/libicutu.so.59
[root@gumis02 ~]# ln -s /usr/local/icu/lib/libicutu.so.59 /lib64/
[root@gumis02 ~]# ln -s /usr/local/icu/lib/libicui18n.so.59 /lib64/
[root@gumis02 ~]# ln -s /usr/local/icu/lib/libicuuc.so.59 /lib64/
[root@gumis02 ~]# ln -s /usr/local/icu/lib/libicudata.so.59 /lib64/
[root@gumis02 ~]# ln -s /usr/local/icu/lib/libicudata.so.59 /lib64/
[root@gumis02 ~]# icuinfo
Copyright (C) 2016 and later: Unicode, Inc. and others. License & terms of use: http://www.unicode.org/copyright.html
icu4c
International Components for Unicode for C/C++
59.1
9.0
4000
Linux
zh_CN
zh-CN
UTF-8
icudt59l
31.0.1
2017b
PRC
64
0
4
0
x86_64-unknown-linux-gnu
x86_64-unknown-linux-gnu
gcc
g++
1
1
1
ICU Initialization returned: U_ZERO_ERROR
Plugins are disabled.
rpm -ivh glibc-2.17-55.el6.x86_64.rpm glibc-static-2.17-55.el6.x86_64.rpm glibc-common-2.17-55.el6.x86_64.rpm glibc-utils-2.17-55.el6.x86_64.rpm glibc-devel-2.17-55.el6.x86_64.rpm nscd-2.17-55.el6.x86_64.rpm glibc-headers-2.17-55.el6.x86_64.rpm --nodeps --force
strings /lib64/libc.so.6 | grep GLIBC
yum install openssl-libs
cd ..
ls
rpm -ivh openssl-libs-1.0.2k-8.el7.x86_64.rpm
rpm -ivh openssl-libs-1.0.2k-8.el7.x86_64.rpm --force