centos 编译安装glibc-2.12.1

在使用daikon建议的kvasir工具时,碰到一些问题,首先是因为该工具比较老,只支持内核最高为2.6的linux系统,其次需要的glibc版本最高为2.11(实在忍不住想吐个槽)。最后我把linux系统换成了fedora14,用yum安装的glibc版本是2.13,只好手动安装2.11版本的glibc。

  • tar -xvf glibc-2.5.tar.gz

  • cd glibc-2.5 

  • mkdir glibc-2.11-build 

  • cd glibc-2.11-build/ 

  • export CFLAGS="-g -O2 -march=i686"

  • ../configure --prefix=/repo/root/TEST_PACKAGES/robot/PACKAGES/glibc-2.5 --with-headers=/usr/include

  • make 

  • make install

注意:

1.   在目录usr/src/glibc-2.11执行configure命令时不能执行,需在外部文件夹glibc-2.11-build 执行

2.   加上优化开关,export CFLAGS="-g -O2 -march=i686",否则会出现错误,此处的i686请参照自己的机器

3.    当有如下错误时:

checking whether ranlib is necessary... no
checking LD_LIBRARY_PATH variable... contains current directory
configure: error:
*** LD_LIBRARY_PATH shouldn't contain the current directory when
*** building glibc. Please change the environment variable
*** and run configure again.
解决办法:查看LD_LIBRARY_PATH  echo $LD_LIBRARY_PATH,我的打印的是/usr/lib/qt44/lib:

configure里说:LD_LIBRARY_PATH不能以终结符作为开始和最后一个字符,不能有2个终结符连在一起,所以修改下LD_LIBRARY_PATH即可,export LD_LIBRARY_PATH=/usr/lib/qt44/lib

4.   当有如下错误时:

configure: error: gcc must provide the  header

解决办法:get the cpuid.h file from official GCC respositories> (http://gcc.gnu.org/viewcvs/tags/gcc_4_4_2_release/gcc/config/i386/cpuid.h?view=co)> and put it into /usr/include(上面指定的--with-headers)

5.   当有如下错误时:

../sysdeps/i386/fpu/s_frexp.S: Assembler messages:
../sysdeps/i386/fpu/s_frexp.S:66: Error: invalid identifier for “.ifdef”
../sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1′
../sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1′
../sysdeps/i386/fpu/s_frexp.S:66: Error: Missing symbol name in directive
../sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1′
../sysdeps/i386/fpu/s_frexp.S:66: Error: Missing symbol name in directive
../sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `.’
../sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1′
../sysdeps/i386/fpu/s_frexp.S:66: Error: expected comma after name `’ in .size directive
../sysdeps/i386/fpu/s_frexp.S:66: Error: “.endif” without “.if”
../sysdeps/i386/fpu/s_frexp.S:66: Error: junk `.get_pc_thunk.dx’ after expression
make[2]: *** [/opt/mylinux/build/glibc-build/math/s_frexp.os] Error 1
make[2]: Leaving directory `/opt/mylinux/build/glibc-2.12.2/math’
make[1]: *** [math/subdir_lib] Error 2
make[1]: Leaving directory `/opt/mylinux/build/glibc-2.12.2′
make: *** [all] Error 2

修改两个文件:

       * sysdeps/unix/sysv/linux/i386/sysdep.h: Re-define __i686.
       * nptl/sysdeps/pthread/pt-initfini.c: Ditto.


Index: sysdeps/unix/sysv/linux/i386/sysdep.h
===================================================================
--- sysdeps/unix/sysv/linux/i386/sysdep.h	(revision 1469)
+++ sysdeps/unix/sysv/linux/i386/sysdep.h	(working copy)
@@ -29,6 +29,10 @@
 #include <dl-sysdep.h>
 #include <tls.h>
 
+#if defined __i686 && defined __ASSEMBLER__
+#undef __i686
+#define __i686 __i686
+#endif
 
 /* For Linux we can use the system call table in the header file
 	/usr/include/asm/unistd.h
Index: nptl/sysdeps/pthread/pt-initfini.c
===================================================================
--- nptl/sysdeps/pthread/pt-initfini.c	(revision 1469)
+++ nptl/sysdeps/pthread/pt-initfini.c	(working copy)
@@ -45,6 +45,11 @@
 /* Embed an #include to pull in the alignment and .end directives. */
 asm ("\n#include \"defs.h\"");
 
+asm ("\n#if defined __i686 && defined __ASSEMBLER__");
+asm ("\n#undef __i686");
+asm ("\n#define __i686 __i686");
+asm ("\n#endif");
+
 /* The initial common code ends here. */
 asm ("\n/*@HEADER_ENDS*/");
 

5.   当以上问题都解决时,make  make install吧,由于东西比较多,需要些时间,大概半小时左右。

 

 

转载于:https://my.oschina.net/activehealth/blog/686340

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值