帮我找出错误 我尝试编译 glibc 2.24,但出现以下错误:
./../include/libc-symbols.h:413:26: error: '__EI___errno_location' specifies less restrictive attributes than its target '__errno_location': 'const', 'nothrow' [-Werror=missing-attributes]
| 413 | extern __typeof (name) __EI_##name \
| | ^~~~~
| ./../include/libc-symbols.h:417:29: note: in expansion of macro '__hidden_ver1'
| 417 | # define hidden_def(name) __hidden_ver1(__GI_##name, name, name);
| | ^~~~~~~~~~~~~
| ./../include/libc-symbols.h:468:32: note: in expansion of macro 'hidden_def'
| 468 | # define libc_hidden_def(name) hidden_def (name)
| | ^~~~~~~~~~
| errno-loc.c:28:1: note: in expansion of macro 'libc_hidden_def'
| 28 | libc_hidden_def (__errno_location)
| | ^~~~~~~~~~~~~~~
| errno-loc.c:24:1: note: '__EI___errno_location' target declared here
| 24 | __errno_location (void)
| | ^~~~~~~~~~~~~~~~
我尝试用以下方法解决此错误:
diff -Naur glibc_orig/include/libc-symbols.h glibc/include/libc-symbols.h
--- glibc_orig/include/libc-symbols.h 2021-08-26 10:16:34.327141852 +0300
+++ glibc/include/libc-symbols.h 2021-08-26 12:08:13.654205932 +0300
@@ -388,6 +388,7 @@
versioned_symbol (libc, __real_foo, foo, GLIBC_2_1);
libc_hidden_ver (__real_foo, foo) */
+
#if defined SHARED && !defined NO_HIDDEN
# ifndef __ASSEMBLER__
# define __hidden_proto_hiddenattr(attrs...) \
@@ -403,6 +404,10 @@
__hidden_asmname1 (__USER_LABEL_PREFIX__, name)
# define __hidden_asmname1(prefix, name) __hidden_asmname2(prefix, name)
# define __hidden_asmname2(prefix, name) #prefix name
+
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wmissing-attributes"
+
# define __hidden_ver1(local, internal, name) \
extern __typeof (name) __EI_##name __asm__(__hidden_asmname (#internal)); \
extern __typeof (name) __EI_##name \
@@ -759,5 +764,6 @@
#else
# define inhibit_loop_to_libcall
#endif
+#pragma GCC diagnostic pop
#endif /* libc-symbols.h */
但是编译的时候又重复报错,请问如何解决这个错误?
解决了
./configure --disable-werror
建议:首先获取您的发行版的 glibc 源代码(已修补); 以ubuntu为例:
sudo apt-get source glibc
应该下载当前的 glibc 版本;
我发现官方的glibc repo无法通过编译阶段,总是出现某种神秘的错误。