由于CentOS6系统默认的glibc版本较低,在尝试编译升级时遇到了Error: invalid identifier for ".ifdef",在此记录解决方案。 编译安装下载并编译安装wget http://ftp./gnu/glibc/glibc-2.15.tar.gz wget http://ftp./gnu/glibc/glibc-ports-2.15.tar.gz tar -zxf glibc-2.15.tar.gz tar -zxf glibc-ports-2.15.tar.gz mv glibc-ports-2.15 glibc-2.15/ports mkdir glibc-build-2.15cd glibc-build-2.15../glibc-2.15/configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin make all && make install 解决错误sysdeps/i386/fpu/s_frexp.S:66: Error: invalid identifier for ".ifdef" 1.修改文件pt-initfini.c在glibc源码目录下找到文件 nptl/sysdeps/pthread/pt-initfini.c,约在46行左右:asm ("\n#include \"defs.h\""); 在其后增加代码: asm ("\n#if defined __i686 && defined __ASSEMBLER__");asm ("\n#undef __i686");asm ("\n#define __i686 __i686");asm ("\n#endif"); 2.修改文件sysdep.h在glibc源码目录下找到文件 sysdeps/unix/sysv/linux/i386/sysdep.h ,约在30行左右:#include <tls.h> 在其后增加代码: #if defined __i686 && defined __ASSEMBLER__ #undef __i686 #define __i686 __i686 #endif 3.重新编译make all && make install 判断当前GLIBC版本ldd --version 如下则成功安装 ldd (GNU libc) 2.15Copyright (C) 2012 Free Software Foundation, Inc.This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.Written by Roland McGrath and Ulrich Drepper. |
|