本篇内容介绍了“编译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.gz
wget http://ftp.gnu.org/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.15
cd 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"
在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");
在glibc源码目录下找到文件 sysdeps/unix/sysv/linux/i386/sysdep.h ,约在30行左右:#include <tls.h>
在其后增加代码:
#if defined __i686 && defined __ASSEMBLER__
#undef __i686
#define __i686 __i686
#endif
make all && make install
ldd --version
如下则成功安装
ldd (GNU libc) 2.15
Copyright (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.
“编译glibc遇到的错误 Error: invalid identifier for ".ifdef"怎么解决”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。
原文链接:https://my.oschina.net/u/2366984/blog/3102331