The weak getauxval in CentOS 6 #23582

issue Perlover opened this issue on November 24, 2021
  1. Perlover commented at 3:53 PM on November 24, 2021: contributor

    <!-- This issue tracker is only for technical issues related to Bitcoin Core. General bitcoin questions and/or support requests are best directed to the Bitcoin StackExchange at https://bitcoin.stackexchange.com. For reporting security issues, please read instructions at https://bitcoincore.org/en/contact/. If the node is "stuck" during sync or giving "block checksum mismatch" errors, please ensure your hardware is stable by running memtest and observe CPU temperature with a load-test tool such as linpack before creating an issue! -->

    <!-- Describe the issue -->

    Expected behavior

    The ./configure of v22.0 defines two macros: HAVE_STRONG_GETAUXVAL &amp; 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

    <!--- What behavior did you expect? -->

    The configure at CentOS 6 should define macros as:

    HAVE_STRONG_GETAUXVAL='0'
    HAVE_WEAK_GETAUXVAL='0'
    

    And compiling without errors

    Actual behavior

    <!--- What was the actual behavior (provide screenshots if the issue is GUI-related)? -->

    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

    <!--- How reliably can you reproduce the issue, what are the steps to do so? -->

    System information

    /etc/centos-release: CentOS release 6.10 (Final)

    <!-- What version of Bitcoin Core are you using, where did you get it (website, self-compiled, etc)? -->

    <!-- What type of machine are you observing the error on (OS/CPU and disk type)? -->

    <!-- GUI-related issue? What is your operating system and its version? If Linux, what is your desktop environment and graphical shell? -->

    <!-- Any extra information that might be useful in the debugging process. -->

    <!--- This is normally the contents of a `debug.log` or `config.log` file. Raw text or a link to a pastebin type site are preferred. -->

  2. Perlover added the label Bug on Nov 24, 2021
  3. MarcoFalke commented at 4:19 PM on November 24, 2021: member

    CentOS 6 reached EOL already a year ago. I'd recommend that you upgrade to an operating system that ships security and maintenance updates.

  4. MarcoFalke added the label Questions and Help on Nov 24, 2021
  5. MarcoFalke removed the label Bug on Nov 24, 2021
  6. MarcoFalke added the label Build system on Nov 24, 2021
  7. Perlover commented at 5:01 PM on November 24, 2021: contributor

    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) 
    
  8. Perlover commented at 5:16 PM on November 24, 2021: contributor

    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.

  9. Perlover commented at 5:28 PM on November 24, 2021: contributor

    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.

  10. MarcoFalke commented at 6:29 PM on November 24, 2021: member

    Weak getauxval was removed in commit 7f81f5459ffa93e9269715cf604cfaf1f8ff59f8

  11. Perlover closed this on Nov 24, 2021

  12. DrahtBot locked this on Nov 24, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-26 06:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me