本站致力于分享传播知识!

解决’GLIBC_2.17′ not found问题时遇到的坑

网上有很多解决’GLIBC_2.17′ not found问题的帖子。

无非就是如下的一些操作命令:

1. glibc下载
从http://www.gnu.org/software/libc/ 下载源代码。我下载的版本是2.17,链接地址是http://ftp.gnu.org/gnu/glibc/glibc-2.17.tar.gz。
2. 安装
具体步骤如下:
[[email protected] ~]# tar zxvf glibc-2.17.tar.gz -C /home/xinkedl/
[[email protected] ~]# cd /home/xinkedl/glibc-2.17
[[email protected] glibc-2.14]# mkdir /home/xinkedl/glibc-2.17/build
[[email protected] glibc-2.14]# cd build
[[email protected] build]# ../configure –prefix=/home/xinkedl/glibc217
[[email protected] build]# make -j8
[[email protected] build]# make install
如果没有碰到坑,那么恭喜你已经完成了安装,后续也就是库环境设置了。

下面先说一下遇到的坑:

1、在make过程中出现如下错误:

/usr/bin/install: `include/limits.h' and `/opt/glibc-2.17/include/limits.h' are the same file

在经过google后,不太理解相关帖子的含义,后来自行修炼后,明白了。

原因就是楼主解压的glic-2.17.tar.gz源码和编译时定义的目录../configure –prefix=/home/software/glibc-2.17放到了一起。

所以解决方法就是:

tar zxvf glibc-2.17.tar.gz -C /home/software/
../configure –prefix=/opt/glibc-2.17
只要将编译定义目录和源码目录区分开就ok了。

2、在make install过程中出现如下错误:

Can't open configuration file /home/xinkedl/glibc-2.17/etc/ld.so.conf: No such file or directory

就是缺少了必要的编译文件ld.so.conf。通过find命令找到对应的文件位置(可以略过)。

[[email protected] build]# find / -name “ld.so.conf”
/etc/ld.so.conf

然后我们执行命令把此文件拷贝到对应的文件目录下去,然后继续编译。

[[email protected] build]# cp /etc/ld.so.conf /home/xinkedl/glibc217/etc/
[[email protected] build]# make install
Congratulations! 编译成功!

最后就是设置环境变量,因为glibc库使用广泛,为了避免污染当前系统环境,在使用时候定义一下环境变量。

执行命令

[[email protected] ~]# export LD_LIBRARY_PATH=/home/xinkedl/glibc217/lib:$LD_LIBRARY_PATH
将库的位置临时定位在/home/xinkedl/glibc217/lib位置。