glibc-2.9安装笔记


Redhat5默认安装glibc版本是2.5,想要更新到glibc-2.9。从gnu网址下载glibc-2.9,解压后可以从中找到文件INSTALL和FAQ。
INSTALL讲解安装过程,FAQ讲解常见的问题。
安装环境为:redhat5,gcc-4.1.2,原始glib-2.5
安装过程如下:
1、查看redhat系统glibc版本,直接执行libc.so.6文件即可得知。
# /lib/libc.so.6
 
2、INSTALL文件里说明了安装该版本的glibc的前提条件,安装前需要仔细查看。
 
3、configure过程
glibc不允许在源码目录树下编译,必须新建一个目录来configure和build,这样一旦出错就将整个目录移除即可。
# cd /home/glibc-2.9   //glibc-2.9源文件目录
# cd ../
# mkdir glibc-2.9-build  //新建的用于configure和build的目录
# cd /home/glibc-2.9-build //此时,我们处于glibc-2.9-build目录下
 
configure有很多选项,但是需要制定的是prefix,用于指定glibc安装的位置,默认是安装在/usr/lcoal下
glibc强烈建议不要安装到这个目录下,而是改为--prefix=/usr,这会将glibc安装为linux系统的标准库。
--------------------------------------------------------------------------- 
`configure' takes many options, but the only one that is usually mandatory is `--prefix'.  This option tells `configure' where you want glibc installed. This defaults to `/usr/local', but the normal setting to install as the standard system library is `--prefix=/usr' for GNU/Linux systems.
 
# ../glibc-2.9/configure --prefix=/usr
 
4、make过程
在make之前需要指明系统cpu型号,否则可能出现如下错误:
------------------------------------------------------ 
/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]: *** Error 1
make: *** Error 2
----------------------------------------------------- 
查看系统cpu型号:
# uname -a
Linux localhost.localdomain 2.6.18-238.el5 #1 SMP Sun Dec 19 14:24:47 EST 2010 i686 i686 i386 GNU/Linux
该系统cpu为i686
 
指明系统cpu型号的方法如下:在/home/glibc-2.9-build/目录下创建configparms文件。
# echo "CFLAGS += -march=i686" > configparms
然后make即可
# make
 
5、make check过程,直接make check即可
# make check
 
6、make dvi过程,安装GNU C Library Reference Manual,若不安装则可以省去此步。
在线文档网址为 http://www.kernel.org/doc/man-pages/
 
7、make install过程,即安装glibc
# make install
# /lib/libc.so.6
GNU C Library stable release version 2.9, by Roland McGrath et al.
 
参考http://blog.sina.com.cn/s/blog_a5cf7b9a010110ic.html


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM