Ivan Ivanovich
Ivan Ivanovich

Reputation: 948

glibc compiling error with: error: '__EI___errno_location' specifies less restrictive attributes than its target '

help me figure out the error i try to compiling glibc 2.24 and i have following error:

 ./../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)
|       | ^~~~~~~~~~~~~~~~

i try to solve this error with:

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 */

but when compiling the error is repeated, tell me how to solve the error?

Upvotes: 2

Views: 2747

Answers (2)

buffy
buffy

Reputation: 79

Piece of advice: try to get your distribution's glibc source(which is patched) first,

For example on ubuntu:

sudo apt-get source glibc

should download current glibc version;

I found the official glibc repo couldn't pass the compile phase, always encountering some kind of mystical errors.

Upvotes: 0

Ivan Ivanovich
Ivan Ivanovich

Reputation: 948

it solved by ./configure --disable-werror

Upvotes: 8

Related Questions