Ubuntu24.04环境编译glibc-2.40错误记录
本文记录了在Ubuntu24.04-x86_64 gcc-13.2.0
环境下编译glibc-2.40
出现的一系列错误以及解决方法。
问题1
wctomb.c:57:1: error: ‘artificial’ attribute ignored [-Werror=attributes]
57 | libc_hidden_def (wctomb)
解决方法
增加CFLAGS
参数:../configure CFLAGS="-U_FORTIFY_SOURCE"
相关引用
Build fail on Ubuntu 24.04 (sourceware.org)
问题2
In file included from <command-line>:
./../include/libc-symbols.h:75:3: error: #error "glibc cannot be compiled without optimization"
75 | # error "glibc cannot be compiled without optimization"
| ^~~~~
In file included from <command-line>:
./../include/libc-symbols.h:75:3: error: #error "glibc cannot be compiled without optimization"
75 | # error "glibc cannot be compiled without optimization"
| ^~~~~
In file included from <command-line>:
./../include/libc-symbols.h:75:3: error: #error "glibc cannot be compiled without optimization"
75 | # error "glibc cannot be compiled without optimization"
| ^~~~~
In file included from <command-line>:
./../include/libc-symbols.h:75:3: error: #error "glibc cannot be compiled without optimization"
75 | # error "glibc cannot be compiled without optimization"
| ^~~~~
In file included from <command-line>:
./../include/libc-symbols.h:75:3: error: #error "glibc cannot be compiled without optimization"
75 | # error "glibc cannot be compiled without optimization"
| ^~~~~
In file included from <command-line>:
./../include/libc-symbols.h:75:3: error: #error "glibc cannot be compiled without optimization"
75 | # error "glibc cannot be compiled without optimization"
| ^~~~~
make[2]: *** [../o-iterator.mk:9: /home/blduan/projects/open_source/glibc-2.40/build/stdlib/inlines.os] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [../o-iterator.mk:9: /home/blduan/projects/open_source/glibc-2.40/build/stdlib/divrem.os] Error 1
make[2]: *** [../o-iterator.mk:9: /home/blduan/projects/open_source/glibc-2.40/build/stdlib/mul.os] Error 1
make[2]: *** [../o-iterator.mk:9: /home/blduan/projects/open_source/glibc-2.40/build/stdlib/divmod_1.os] Error 1
make[2]: *** [../o-iterator.mk:9: /home/blduan/projects/open_source/glibc-2.40/build/stdlib/mod_1.os] Error 1
make[2]: *** [../o-iterator.mk:9: /home/blduan/projects/open_source/glibc-2.40/build/stdlib/wctomb.os] Error 1
make[2]: Leaving directory '/home/blduan/projects/open_source/glibc-2.40/stdlib'
make[1]: *** [Makefile:484: stdlib/subdir_lib] Error 2
make[1]: Leaving directory '/home/blduan/projects/open_source/glibc-2.40'
make: *** [Makefile:9: all] Error 2
解决方法
../configure CFLAGS="-U_FORTIFY_SOURCE -O2"
- 原文作者:生如夏花
- 原文链接:https://blduan.top/post/%E5%BC%80%E6%BA%90%E4%B8%89%E6%96%B9/ubuntu24.04%E7%8E%AF%E5%A2%83%E7%BC%96%E8%AF%91glibc-2.40%E9%94%99%E8%AF%AF%E8%AE%B0%E5%BD%95/
- 版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议进行许可,非商业转载请注明出处(作者,原文链接),商业转载请联系作者获得授权。