linux:/lib/libc.so.6: version `glibc_2.7′ not found及编译glibc

来源:互联网 发布:数据抓取技术 编辑:程序博客网 时间:2024/05/18 03:10

更多精彩内容,请见:http://www.16boke.com


by zxy,Java/C++编程交流群:168424095

 

linux服务器运行一个编译生成好的源代码,提示错误信息:

/lib/libc.so.6: version `glibc_2.7′ not found

按照如下所示,正确安装glibc_2.7,不过程序依旧报这个错,把源代码复制一份,重新编译,运行OK。

升级glibc

yum update glibc  

问题依旧。用命令查看glibc库的信息

rpm -qi glibc  

显示系统的glibc库版本为2.5

CentOS中用更新命令到2.5已经是最新版本了,只好手动下载 glibc 2.7 的源码包编译安装更新:

地址:http://ftp.gnu.org/pub/gnu/glibc/glibc-2.7.tar.gz

3 cd /srv

4 wget http://ftp.gnu.org/pub/gnu/glibc/glibc-2.7.tar.gz  (如果提示找不到,在别的地方下好后,拷进来)

5 tar zxvf glibc-2.7.tar.gz  

6 ./glibc-2.7/configure  #执行configure命令时不能进到glibc-2.7文件夹里面,否则无法执行  

7 cd glibc-2.7  

8 make && make install  #如果执行失败的话,直接执行make install

遇到问题,首先要运行configure命令

(1)

*** On GNU/Linux systems the GNU C Library should not be installed into

*** /usr/local since this might make your system totally unusable.

*** We strongly advise to use a different prefix.  For details read the FAQ.

*** If you really mean to do this, run configure again using the extra

*** parameter `--disable-sanity-checks'.

可以这么解决->>>>>>>>>>>>

大多以tar.gz   tar.bz2打包软件,大多是通过   ./configure   ;make   ;make   install   来安装的;有的软件是直接make;make   install   ; 
我们可以通过./configure   --help   来查看配置软件的功能;大多软件是提供./configure   配置软件的功能的;少数的也没有,如果没有的就不用./configure   ;直接make;make   install   就行了; 
./configure   比较重要的一个参数是   --prefix   ,用--prefix   参数,我们可以指定软件安装目录;当我们不需要这个软件时,直接删除软件的目录就行了; 
比如我们可以指定fcitx   安装到   /opt/fcitx   目录中; 
[root@localhost   fcitx]#./configure   --prefix=/opt/fcitx 

(2)

/root/source/glibc-build/libc_pic.os: In function `__libc_fork':
/root/source/glibc-2.7/posix/../nptl/sysdeps/unix/sysv/linux/i386/../fork.c:76: undefined reference to `__sync_bool_compare_and_swap_4'
/root/source/glibc-build/libc_pic.os: In function `__nscd_drop_map_ref':
/root/source/glibc-2.7/nscd/nscd-client.h:320: undefined reference to `__sync_fetch_and_add_4'
/root/source/glibc-build/libc_pic.os: In function `nscd_getpw_r':
/root/source/glibc-2.7/nscd/nscd_getpw_r.c:232: undefined reference to `__sync_fetch_and_add_4'
/root/source/glibc-build/libc_pic.os: In function `__nscd_drop_map_ref':
/root/source/glibc-2.7/nscd/nscd-client.h:320: undefined reference to `__sync_fetch_and_add_4'
/root/source/glibc-build/libc_pic.os: In function `nscd_getgr_r':
/root/source/glibc-2.7/nscd/nscd_getgr_r.c:321: undefined reference to `__sync_fetch_and_add_4'
/root/source/glibc-build/libc_pic.os: In function `__nscd_drop_map_ref':
/root/source/glibc-2.7/nscd/nscd-client.h:320: undefined reference to `__sync_fetch_and_add_4'
/root/source/glibc-build/libc_pic.os:/root/source/glibc-2.7/nscd/nscd_gethst_r.c:400: more undefined references to `__sync_fetch_and_add_4' follow
/root/source/glibc-build/libc_pic.os: In function `__nscd_get_map_ref':
/root/source/glibc-2.7/nscd/nscd_helper.c:404: undefined reference to `__sync_val_compare_and_swap_4'
/root/source/glibc-build/libc_pic.os: In function `*__GI___libc_freeres':
/root/source/glibc-2.7/malloc/set-freeres.c:39: undefined reference to `__sync_bool_compare_and_swap_4'
collect2: ld returned 1 exit status
make[1]: *** [/root/source/glibc-build/libc.so] Error 1
make[1]: Leaving directory `/root/source/glibc-2.7'
make: *** [all] Error 2

 

碰到这个问题需要为为CFLAGS添加march选项。

echo "CFLAGS += -march=i486" > configparms

执行make命令时会将configparms里的内容按照MakeFile的规则进行解析。


更多精彩内容,请见:http://www.16boke.com

原创粉丝点击