libgcc_s.so.1 mysql_libgcc_s.so.1的版本问题

在运行程序时遇到错误提示缺少GCC_4.2.0版本的libgcc_s.so.1,尝试升级GCC,通过源码编译安装GCC 4.2.0,但在编译过程中出现错误。最终通过替换旧版本的libgcc_s.so.1为新安装目录下的版本解决了问题。
摘要由CSDN通过智能技术生成

运行文件提示:

/usr/local/tools/fetion: /lib/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/local/tools/fetion/lib/libstdc++.so.6)

查看/lib/libgcc_s.so.1文件存在,是一个链接

[root@localhost tools]# ll /lib/libgcc_s.so.1

lrwxrwxrwx 1 root root 28 3月 14 08:16 /lib/libgcc_s.so.1 -> libgcc_s-3.4.3-20041213.so.1

查看系统的gcc版本是 gcc (GCC) 3.4.3

[root@localhost ~]# gcc --version

gcc (GCC) 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)

于是想升级GCC,没有找到GCC_4.2.0的rpm包,直接下载源码包了

一、升级前信息

[root@localhost ~]# gcc -v

Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.3/specs

Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux

Thread model: posix

gcc version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)

[root@localhost ~]# gcc --version

gcc (GCC) 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)

Copyright (C) 2004 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.

二、升级过程

[root@localhost ~]#wget http://ftp.gnu.org/pub/pub/gnu/gcc/gcc-4.2.0/gcc-4.2.0.tar.bz2

[root@localhost ~]# tar jxf gcc-4.2.0.tar.bz2

[root@localhost ~]# mkdir /usr/gcc4

[root@localhost ~]# cd /gcc-4.2.0

[root@localhost gcc-4.2.0]#./configure--prefix=/usr/gcc4

[root@localhost gcc-4.2.0]# make clean

[root@localhost gcc-4.2.0]# make

漫长啊,经过几个小时编译(资料说所有的组件几乎都要编译一遍)进行下一步

[root@localhost gcc-4.2.0]# make check

这里是不是测试吗?漫长的编译中在看鸟哥的教程学习的,怎么提示有错误了,不管了

make[1]: Entering directory `/root/gcc-4.2.0'

make[2]: Entering directory `/root/gcc-4.2.0/host-i686-pc-linux-gnu/fixincludes'

autogen -T http://www.cnblogs.com/./fixincludes/check.tpl http://www.cnblogs.com/./fixincludes/inclhack.def

make[2]: autogen:命令未找到

make[2]: *** [check] 错误 127

make[2]: Leaving directory `/root/gcc-4.2.0/host-i686-pc-linux-gnu/fixincludes'

make[1]: *** [check-fixincludes] 错误 2

make[1]: Leaving directory `/root/gcc-4.2.0'

make: *** [do-check] 错误 2

[root@localhost gcc-4.2.0]# make install

........

----------------------------------------------------------------------

Libraries have been installed in:

/usr/gcc4/lib

If you ever happen to want to link against installed libraries

in a given directory, LIBDIR, you must either use libtool, and

specify the full pathname of the library, or use the `-LLIBDIR'

flag during linking and do at least one of the following:

- add LIBDIR to the `LD_LIBRARY_PATH' environment variable

during execution

- add LIBDIR to the `LD_RUN_PATH' environment variable

during linking

- use the `-Wl,--rpath -Wl,LIBDIR' linker flag

- have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for

more information, such as the ld(1) and ld.so(8) manual pages.

----------------------------------------------------------------------

查看版本还是旧版本信息,回头细想,才发现上面的是安装GCC而不是升级操作,后面把把新安装的库链接指向,删除旧库链接指看下。

....

旧版是用源码安装的,which gcc或者whereis gcc查看所在路径

[root@localhost bin]# which gcc

/usr/bin/gcc

[root@localhost bin]# whereis gcc

gcc: /usr/bin/gcc /usr/lib/gcc /usr/libexec/gcc /usr/share/man/man1/gcc.1.gz

分别用新安装的/usr/gcc4/lib/下的gcc、g++、gcj指向替换相应旧的文件夹/usr/lib文件

[root@localhost ~]# cd /usr/lib

[root@localhost bin]# mv gcc gcc_bak

[root@localhost bin]# mv g++ g++_bak

[root@localhost bin]# mv gcj gcj_bak

[root@localhost bin]# ln -sv /usr/gcc4/bin/gcc gcc

[root@localhost bin]# ln -sv /usr/gcc4/bin/g++ g++

[root@localhost bin]# ln -sv /usr/gcc4/bin/gcj gcj

ldconfig -v重新加载库?先用后面再理解了

[root@localhost bin]# ldconfig -v

[root@localhost bin]# gcc -v

使用内建 specs。

目标:i686-pc-linux-gnu

配置为:./configure --prefix=/usr/gcc4

线程模型:posix

gcc 版本 4.2.0

OK,gcc 版本更新了,回头运行程序看下

/usr/local/tools/fetion: /lib/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/local/tools/fetion/lib/libstdc++.so.6)

xxd,折腾这么久还是给个原始错误

[root@localhost ~]# find / -name libgcc*

/lib/libgcc_s-3.4.3-20041213.so.1(链接的文件)

/lib/libgcc_s.so.1 (提示的文件)

......

/usr/gcc4/lib/libgcc_s.so.1 (新安装目录下的文件)

gcc4相同结构目录下也有这个libgcc_s.so.1文件,替换试下

[root@localhost ~]# mv /lib/libgcc_s.so.1 /lib/libgcc_s.so.1_bak

[root@localhost ~]# ln -s /usr/gcc4/lib/libgcc_s.so.1 /lib/libgcc_s.so.1

再运行程序就可以了

三、后记 1、gcc4应该安装在/usr/local/gcc4目录下的 2、有朋友建议 Red Hat用rpm -ivh gcc-4.1.2-33.i386.rpm这种方式安装会好一点 3、在centos4上相同的问题我直接用yum update gcc这条命令也可以把问题解决

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值