打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
解决编译glibc遇到的错误 Error: invalid identifier for ".ifdef"

由于CentOS6系统默认的glibc版本较低,在尝试编译升级时遇到了Error: invalid identifier for ".ifdef",在此记录解决方案。

编译安装

官网下载:ftp://ftp.gnu.org/gnu/glibc/

下载并编译安装

wget http://ftp.gnu.org/gnu/glibc/glibc-2.15.tar.gzwget http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gztar -zxf glibc-2.15.tar.gztar -zxf glibc-ports-2.15.tar.gzmv glibc-ports-2.15 glibc-2.15/portsmkdir 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/binmake 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 NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.Written by Roland McGrath and Ulrich Drepper.
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
编译内核出错:invalid option `abi=aapcs-linux'
_GNU_SOURCE和__USE_GNU的差别
系统调用
GNU工具链的构成和使用
unix出错头文件errno .h
预处理命令之条件编译(#ifdef,#else,#endif,#if等)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服