1、rpm -qi glibc 显示Version : 2.4
2、下载2.7版本
cd /srv
wget http://ftp.gnu.org/pub/gnu/glibc/glibc-2.7.tar.gz
3、解压 tar zxvf glibc-2.7.tar.gz
4、./glibc-2.7/configure #执行configure命令时不能进到glibc-2.7文件夹里面,否则无法执行
5、 安装
cd glibc-2.7
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 参数,我们可以指定软件安装目录;当我们不需要这个软件时,直接删除软件的目录就行了;
要新建一个目录,进入到该目录,使用绝对路径编译安装。
新建一个目录,然后进入该目录,用绝对路径编译。
mkdir/usr/local/glibc
cd /usr/local/glibc
/usr/local/src/glibc-2.7/configure--prefix= /usr/local/glibc
make && make install
(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的规则进行解析
· cd /usr/src
· mkdir glibc-2.11-build
· wget http://ftp.gnu.org/pub/gnu/glibc/glibc-2.11.tar.gz
· tar zxvf glibc-2.11.tar.gz
· cd /usr/src/glibc-2.11-build/
· export CFLAGS="-g -O2 -march=i686"
· /usr/src/glibc-2.11/configure --prefix=/usr/src/glibc-2.11-build/ --with-headers=/usr/include
· make
· make install
注意:
1. 在目录usr/src/glibc-2.11执行configure命令时不能执行,需在外部文件夹glibc-2.11-build 执行,
即不能在glibc当前目录下运行configure。
2. 加上优化开关,export CFLAGS="-g -O2 -march=i686",否则会出现错误,此处的i686请参照自己的机器(执行#arch
,可参考此文:http://lpy999.blog.163.com/blog/static/117372061201352841747588/)
3. 要将glibc-linuxthreads解压到glibc目录下。
下载glibc-linuxthreads:
wget http://ftp.gnu.org/gnu/glibc/glibc-linuxthreads-2.3.2.tar.gz
4. 当有如下错误时:
/home/qt/glibc_build/libc_pic.os: In function`fallocate':
/home/qt/glibc-2.11/io/../sysdeps/unix/sysv/linux/i386/fallocate.c:31:undefined reference to `__call_fallocate'
/home/qt/glibc_build/libc_pic.os: In function`fallocate64':
/home/qt/glibc-2.11/io/../sysdeps/unix/sysv/linux/i386/fallocate64.c:31:undefined reference to `__call_fallocate'
/usr/bin/ld: /home/qt/glibc_build/libc.so: hidden symbol`__call_fallocate' isn't defined
/usr/bin/ld: final link failed: Nonrepresentable sectionon output
collect2: ld 返回 1
make[1]: *** [/home/qt/glibc_build/libc.so] 错误 1
make[1]: Leaving directory `/home/qt/glibc-2.11'
make: *** [all] 错误 2
解决办法:
在/home/qt/glibc-2.11/sysdeps/unix/sysv/linux/i386/fallocate.c中,
extern int __call_fallocate (int fd, int mode, __off64_t offset, __off64_t len)
attribute_hidden;
将上述代码修改为(或注释),
int __call_fallocate (int fd, int mode, __off64_t offset, __off64_t len)
{
return 0;
}
说明:外部函数__call_fallocate没有定义,这里定义为一个本地空函数。
原文转载自:http://blog.csdn.net/one_in_one/article/details/8857696
原文转载自:http://lpy999.blog.163.com/blog/static/11737206120135284731453/