c - glibc 编译错误:错误:'__EI___errno_location' 指定的限制属性低于其目标'
问题描述
帮我找出我尝试编译 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
推荐阅读
- ruby-on-rails - Rails:参数丢失或值为空:admin
- git - 如何撤消“git add --intent-to-add”
- swift - SwiftUI 选择器为所选项目和选择视图分隔文本
- python - AttributeError:“SpooledTemporaryFile”对象没有属性“resize”
- php - 在 Laravel 中执行之前的 Mysql 查询拦截
- node.js - 如何在消息中发送某个(例如第二次或第三次)提及
- amazon-web-services - 无法使用密钥对进行 SSH
- unity3d - Photon kick 从游戏中手动添加玩家
- node.js - MongoDB查询以获取所有文档的数组字段长度的总和
- c# - Couchbase:为什么从 Couchbase SDK 检索时任何时区都会自动转换为本地时区