The weak getauxval in CentOS 6
Perlover opened this issue · comments
Expected behavior
The ./configure
of v22.0 defines two macros: HAVE_STRONG_GETAUXVAL
& HAVE_WEAK_GETAUXVAL
Judging by the code, the file sys/auxv.h to be included when one from these macros are defined.
The CentOS 6.* doesn't have a file sys/auxv.h
The configure at CentOS 6 should define macros as:
HAVE_STRONG_GETAUXVAL='0'
HAVE_WEAK_GETAUXVAL='0'
And compiling without errors
Actual behavior
The ./configure
should define macros as:
HAVE_STRONG_GETAUXVAL='0'
HAVE_WEAK_GETAUXVAL='1'
Errors of compilation:
randomenv.cpp:57:10: fatal error: sys/auxv.h: No such file or directory
57 | #include <sys/auxv.h>
| ^~~~~~~~~~~~
To reproduce
System information
/etc/centos-release: CentOS release 6.10 (Final)
CentOS 6 reached EOL already a year ago. I'd recommend that you upgrade to an operating system that ships security and maintenance updates.
I have additional info. I think this will help, since the execution of the configuration script is not exactly what was intended:
config.log:
configure:27082: checking for strong getauxval support in the system headers
configure:27101: g++ -std=c++17 -c -g -O2 -fno-extended-identifiers -I/home/bitcoin/include -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS conftest.cpp >&5
conftest.cpp:74:14: fatal error: arm_acle.h: No such file or directory
74 | #include <arm_acle.h>
| ^~~~~~~~~~~~
compilation terminated.
configure:27101: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "Bitcoin Core"
| #define PACKAGE_TARNAME "bitcoin"
| #define PACKAGE_VERSION "22.0.0"
| #define PACKAGE_STRING "Bitcoin Core 22.0.0"
| #define PACKAGE_BUGREPORT "https://github.com/bitcoin/bitcoin/issues"
| #define PACKAGE_URL "https://bitcoincore.org/"
| #define HAVE_CXX17 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define USE_ASM 1
| #define ENABLE_SSE41 1
| #define ENABLE_AVX2 1
| #define ENABLE_SHANI 1
| #define HAVE___INT128 1
| #define HAVE_PTHREAD 1
| #define HAVE_DECL_STRERROR_R 1
| #define HAVE_STRERROR_R 1
| #define STRERROR_R_CHAR_P 1
| #define HAVE_ENDIAN_H 1
| #define HAVE_BYTESWAP_H 1
| #define HAVE_STDIO_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_SELECT_H 1
| #define HAVE_SYS_PRCTL_H 1
| #define HAVE_SYS_SYSCTL_H 1
| #define HAVE_DECL_GETIFADDRS 1
| #define HAVE_DECL_FREEIFADDRS 1
| #define HAVE_DECL_STRNLEN 1
| #define HAVE_DECL_FORK 1
| #define HAVE_DECL_SETSID 1
| #define HAVE_DECL_PIPE2 1
| #define HAVE_DECL_LE16TOH 1
| #define HAVE_DECL_LE32TOH 1
| #define HAVE_DECL_LE64TOH 1
| #define HAVE_DECL_HTOLE16 1
| #define HAVE_DECL_HTOLE32 1
| #define HAVE_DECL_HTOLE64 1
| #define HAVE_DECL_BE16TOH 1
| #define HAVE_DECL_BE32TOH 1
| #define HAVE_DECL_BE64TOH 1
| #define HAVE_DECL_HTOBE16 1
| #define HAVE_DECL_HTOBE32 1
| #define HAVE_DECL_HTOBE64 1
| #define HAVE_DECL_BSWAP_16 1
| #define HAVE_DECL_BSWAP_32 1
| #define HAVE_DECL_BSWAP_64 1
| #define HAVE_BUILTIN_CLZL 1
| #define HAVE_BUILTIN_CLZLL 1
| #define HAVE_MALLOC_INFO 1
| #define HAVE_MALLOPT_ARENA_MAX 1
| #define HAVE_POSIX_FALLOCATE 1
| #define HAVE_DEFAULT_VISIBILITY_ATTRIBUTE 1
| #define HAVE_THREAD_LOCAL 1
| #define HAVE_GMTIME_R 1
| #define HAVE_FDATASYNC 1
| #define HAVE_O_CLOEXEC 1
| /* end confdefs.h. */
|
| #include <arm_acle.h>
| #include <arm_neon.h>
| #include <sys/auxv.h>
|
| int
| main ()
| {
|
| getauxval(AT_HWCAP);
|
| ;
| return 0;
| }
configure:27107: result: no
configure:27113: checking for weak getauxval support in the compiler
configure:27133: g++ -std=c++17 -c -g -O2 -fno-extended-identifiers -I/home/bitcoin/include -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS conftest.cpp >&5
configure:27133: $? = 0
configure:27134: result: yes
Here your configure thinks that weak getauxval is OK but I made the temporarely script for testing (1.txt):
/* confdefs.h */
#define PACKAGE_NAME "Bitcoin Core"
#define PACKAGE_TARNAME "bitcoin"
#define PACKAGE_VERSION "22.0.0"
#define PACKAGE_STRING "Bitcoin Core 22.0.0"
#define PACKAGE_BUGREPORT "https://github.com/bitcoin/bitcoin/issues"
#define PACKAGE_URL "https://bitcoincore.org/"
#define HAVE_CXX17 1
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define HAVE_DLFCN_H 1
#define LT_OBJDIR ".libs/"
#define USE_ASM 1
#define ENABLE_SSE41 1
#define ENABLE_AVX2 1
#define ENABLE_SHANI 1
#define HAVE___INT128 1
#define HAVE_PTHREAD 1
#define HAVE_DECL_STRERROR_R 1
#define HAVE_STRERROR_R 1
#define STRERROR_R_CHAR_P 1
#define HAVE_ENDIAN_H 1
#define HAVE_BYTESWAP_H 1
#define HAVE_STDIO_H 1
#define HAVE_STDLIB_H 1
#define HAVE_UNISTD_H 1
#define HAVE_STRINGS_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_SELECT_H 1
#define HAVE_SYS_PRCTL_H 1
#define HAVE_SYS_SYSCTL_H 1
#define HAVE_DECL_GETIFADDRS 1
#define HAVE_DECL_FREEIFADDRS 1
#define HAVE_DECL_STRNLEN 1
#define HAVE_DECL_FORK 1
#define HAVE_DECL_SETSID 1
#define HAVE_DECL_PIPE2 1
#define HAVE_DECL_LE16TOH 1
#define HAVE_DECL_LE32TOH 1
#define HAVE_DECL_LE64TOH 1
#define HAVE_DECL_HTOLE16 1
#define HAVE_DECL_HTOLE32 1
#define HAVE_DECL_HTOLE64 1
#define HAVE_DECL_BE16TOH 1
#define HAVE_DECL_BE32TOH 1
#define HAVE_DECL_BE64TOH 1
#define HAVE_DECL_HTOBE16 1
#define HAVE_DECL_HTOBE32 1
#define HAVE_DECL_HTOBE64 1
#define HAVE_DECL_BSWAP_16 1
#define HAVE_DECL_BSWAP_32 1
#define HAVE_DECL_BSWAP_64 1
#define HAVE_BUILTIN_CLZL 1
#define HAVE_BUILTIN_CLZLL 1
#define HAVE_MALLOC_INFO 1
#define HAVE_MALLOPT_ARENA_MAX 1
#define HAVE_POSIX_FALLOCATE 1
#define HAVE_DEFAULT_VISIBILITY_ATTRIBUTE 1
#define HAVE_THREAD_LOCAL 1
#define HAVE_GMTIME_R 1
#define HAVE_FDATASYNC 1
#define HAVE_O_CLOEXEC 1
/* end confdefs.h. */
#ifdef __linux__
unsigned long getauxval(unsigned long type) __attribute__((weak));
#define AT_HWCAP 16
#endif
int
main ()
{
getauxval(AT_HWCAP);
;
return 0;
}
And I have rerun it:
$ g++ -std=c++17 -c -g -O2 -fno-extended-identifiers -I/home/bitcoin/include -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS 1.txt
g++: warning: 1.txt: linker input file unused because linking not done
$ echo $?
0
So there not worked C++ test file but the shell returns code is zero (OK). I think this test should not be passed as OK.
My gcc compiled in home directory is:
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/bitcoin/libexec/gcc/x86_64-pc-linux-gnu/11.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --prefix=/home/bitcoin LDFLAGS='-L/home/bitcoin/lib -L/home/bitcoin/lib64 -L/usr/local/lib64 -L/lib64 -L/usr/lib64' CPPFLAGS=-I/home/bitcoin/include --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.2.0 (GCC)
So your test file assumes testing that the system has a getauxval
function if there is no sys/auxv.h
file, but in fact it does not fulfill its role, since there is no linking during the test, as reported by gcc (as warning) and gcc returns the code 0 (OK). I believe that the testing is not being performed correctly and it is supposed to be fixed somehow.
Continued: I renamed 1.txt in 1.cpp
Then I ran the command:
$ g++ -std=c++17 -c -g -O2 -fno-extended-identifiers -I/home/bitcoin/include -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS 1.cpp
$ echo $?
0
I tried without -c:
$ g++ -std=c++17 -g -O2 -fno-extended-identifiers -I/home/bitcoin/include -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS 1.cpp
$ echo $?
0
But when I run:
$ ./a.out
Segmentation fault (core dumped)
$ echo $?
139
I still think that this testing (weak getauxval) is not being performed correctly. Your script assumes weak getauxval as true
, but in fact it is false
. @MarcoFalke , your suggestion to change the operating system is just to get away from trying to fix the test problem.