v0.21.0 fails to compile on raspbian with clang #21294

issue rebroad openend this issue on February 24, 2021
  1. rebroad commented at 1:15 pm on February 24, 2021: contributor

    Getting these errors:-

    make[3]: Leaving directory ‘/home/pi/src/bitcoin-core-v0.21’ /bin/bash ../libtool –tag=CXX –preserve-dup-deps –mode=link clang++ -std=c++11 -O0 -g3 -ftrapv -Wstack-protector -fstack-protector-all -Wall -Wextra -Wgnu -Wformat -Wformat-security -Wvla -Wshadow-field -Wswitch -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunused-variable -Wdate-time -Wconditional-uninitialized -Wsign-compare -Woverloaded-virtual -Wunreachable-code-loop-increment -Wno-unused-parameter -Wno-self-assign -Wno-unused-local-typedef -Wno-deprecated-register -Wno-implicit-fallthrough -fPIE -Wl,-z,relro -Wl,-z,now -Wl,-z,separate-code -pie -pthread -lpthread -o bitcoind bitcoind-bitcoind.o libbitcoin_server.a libbitcoin_wallet.a libbitcoin_common.a libbitcoin_util.a univalue/libunivalue.la libbitcoin_consensus.a crypto/libbitcoin_crypto_base.a leveldb/libleveldb.a crc32c/libcrc32c.a leveldb/libmemenv.a secp256k1/libsecp256k1.la -L/usr/lib/arm-linux-gnueabihf -lboost_system -lboost_filesystem -lboost_thread -lpthread -ldb_cxx -lminiupnpc -levent_pthreads -levent -levent -lsqlite3 libtool: link: clang++ -std=c++11 -O0 -g3 -ftrapv -Wstack-protector -fstack-protector-all -Wall -Wextra -Wgnu -Wformat -Wformat-security -Wvla -Wshadow-field -Wswitch -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunused-variable -Wdate-time -Wconditional-uninitialized -Wsign-compare -Woverloaded-virtual -Wunreachable-code-loop-increment -Wno-unused-parameter -Wno-self-assign -Wno-unused-local-typedef -Wno-deprecated-register -Wno-implicit-fallthrough -fPIE -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,-z -Wl,separate-code -pie -pthread -o bitcoind bitcoind-bitcoind.o -lpthread libbitcoin_server.a libbitcoin_wallet.a libbitcoin_common.a libbitcoin_util.a univalue/.libs/libunivalue.a libbitcoin_consensus.a crypto/libbitcoin_crypto_base.a leveldb/libleveldb.a crc32c/libcrc32c.a leveldb/libmemenv.a secp256k1/.libs/libsecp256k1.a -L/usr/lib/arm-linux-gnueabihf -lboost_system -lboost_filesystem -lboost_thread -lpthread -ldb_cxx -lminiupnpc -levent_pthreads -levent -levent /usr/lib/arm-linux-gnueabihf/libsqlite3.so -pthread /usr/bin/ld: bitcoind-bitcoind.o: in function std::chrono::duration<long long, std::ratio<1ll, 1000000ll> > std::chrono::__duration_cast_impl<std::chrono::duration<long long, std::ratio<1ll, 1000000ll> >, std::ratio<1000ll, 1ll>, long long, false, true>::__cast<long long, std::ratio<1ll, 1000ll> >(std::chrono::duration<long long, std::ratio<1ll, 1000ll> > const&)': /usr/bin/../lib/gcc/arm-linux-gnueabihf/8/../../../../include/c++/8/chrono:168: undefined reference to __mulodi4’ /usr/bin/ld: libbitcoin_server.a(libbitcoin_server_a-init.o): in function AppInitParameterInteraction(ArgsManager const&)': /home/pi/src/bitcoin-core-v0.21/src/init.cpp:1102: undefined reference to __mulodi4’ /usr/bin/ld: /home/pi/src/bitcoin-core-v0.21/src/init.cpp:1103: undefined reference to __mulodi4' /usr/bin/ld: /home/pi/src/bitcoin-core-v0.21/src/init.cpp:1103: undefined reference to __mulodi4’ /usr/bin/ld: libbitcoin_server.a(libbitcoin_server_a-init.o): in function AppInitMain(util::Ref const&, NodeContext&, interfaces::BlockAndHeaderTipInfo*)': /home/pi/src/bitcoin-core-v0.21/src/init.cpp:1532: undefined reference to __mulodi4’ /usr/bin/ld: libbitcoin_server.a(libbitcoin_server_a-init.o):/home/pi/src/bitcoin-core-v0.21/src/init.cpp:1532: more undefined references to `__mulodi4’ follow clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [Makefile:8343: bitcoind] Error 1 make[2]: Leaving directory ‘/home/pi/src/bitcoin-core-v0.21/src’ make[1]: *** [Makefile:19347: all-recursive] Error 1 make[1]: Leaving directory ‘/home/pi/src/bitcoin-core-v0.21/src’ make: *** [Makefile:801: all-recursive] Error 1

    Seems similar to this issue, so I’m assuming it has something to do with the choice to use clang - https://github.com/android/ndk/issues/506

  2. rebroad added the label Bug on Feb 24, 2021
  3. MarcoFalke commented at 1:36 pm on February 24, 2021: member
    What version of the OS? What are the steps to reproduce?
  4. jarolrod commented at 5:57 am on February 26, 2021: member
    Upstream bug report about undefined references to __mulodi4: https://bugs.llvm.org/show_bug.cgi?id=16404
  5. rebroad renamed this:
    v0.21.1 fails to compile on raspbian with clang
    v0.21.0 fails to compile on raspbian with clang
    on Mar 19, 2021
  6. rebroad commented at 7:43 pm on March 19, 2021: contributor
    @MarcoFalke raspbian buster with all the latest updates
  7. hebasto commented at 11:30 am on May 7, 2021: member

    The same error while compiling master (eb9a1fe03779bf05062b70f14190cb23ff42b46f) on ODROID-HC1 + Armbian 21.02.3 Focal:

    0  CXXLD    test/fuzz/fuzz
    1/usr/bin/ld: test/fuzz/fuzz-multiplication_overflow.o: in function `void (anonymous namespace)::TestMultiplicationOverflow<long long>(FuzzedDataProvider&)':
    2./test/fuzz/multiplication_overflow.cpp:30: undefined reference to `__mulodi4'
    3clang: error: linker command failed with exit code 1 (use -v to see invocation)
    

    Clang bug: https://bugs.llvm.org/show_bug.cgi?id=28629

    As a workaround, the --disable-fuzz-binary option could be passed to the configure script.

  8. MarcoFalke commented at 12:30 pm on May 7, 2021: member
    Also happens on intel 32-bit with sanitizers enabled
  9. MarcoFalke commented at 12:33 pm on May 7, 2021: member

    Maybe it can be worked around with a linker flag? https://bugs.llvm.org/show_bug.cgi?id=16404#c12

    You can link with builtins by providing –rtlib=compiler-rt.

    This line works for me: ./bin/clang a.cc -fsanitize=integer -rtlib=compiler-rt -lgcc_s

  10. hebasto commented at 1:27 pm on May 7, 2021: member

    Maybe it can be worked around with a linker flag? https://bugs.llvm.org/show_bug.cgi?id=16404#c12

    Seems to work for me. But it needs more investigation to apply flags in the correct way.

  11. fanquake closed this on Jul 29, 2021

  12. sidhujag referenced this in commit bb887e3e4d on Jul 29, 2021
  13. rebroad commented at 7:48 am on December 19, 2021: contributor

    This is still an issue:-

    0  CXXLD    qt/bitcoin-qt
    1qt/libbitcoinqt.a(qt_libbitcoinqt_a-rpcconsole.o): In function `bool std::__detail::__raise_and_add<unsigned long>(unsigned long&, int, unsigned char)':
    2/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/charconv:410: undefined reference to `__muloti4'
    3libbitcoin_server.a(libbitcoin_server_a-mining.o): In function `_ZSt10from_charsIlENSt9enable_ifIXsr22__is_int_to_chars_typeIT_EE5valueESt17from_chars_resultE4typeEPKcS6_RS1_i':
    4/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/charconv:632: undefined reference to `__muloti4'
    5clang: error: linker command failed with exit code 1 (use -v to see invocation)
    6Makefile:5767: recipe for target 'qt/bitcoin-qt' failed
    7make: *** [qt/bitcoin-qt] Error 1
    
  14. hebasto commented at 9:13 am on December 19, 2021: member

    @rebroad

    This is still an issue:-

    0  CXXLD    qt/bitcoin-qt
    1qt/libbitcoinqt.a(qt_libbitcoinqt_a-rpcconsole.o): In function `bool std::__detail::__raise_and_add<unsigned long>(unsigned long&, int, unsigned char)':
    2/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/charconv:410: undefined reference to `__muloti4'
    3libbitcoin_server.a(libbitcoin_server_a-mining.o): In function `_ZSt10from_charsIlENSt9enable_ifIXsr22__is_int_to_chars_typeIT_EE5valueESt17from_chars_resultE4typeEPKcS6_RS1_i':
    4/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/charconv:632: undefined reference to `__muloti4'
    5clang: error: linker command failed with exit code 1 (use -v to see invocation)
    6Makefile:5767: recipe for target 'qt/bitcoin-qt' failed
    7make: *** [qt/bitcoin-qt] Error 1
    

    Because #21882 has not been backported to 0.21.

  15. MarcoFalke commented at 4:48 pm on December 20, 2021: member

    Maybe this is a compiler bug?

    I can reproduce with:

    0clang version 7.0.0-3~ubuntu0.18.04.1 (tags/RELEASE_700/final)
    1Target: aarch64-unknown-linux-gnu
    
     0  CXXLD    bitcoind
     1libbitcoin_server.a(libbitcoin_server_a-rest.o): In function `bool std::__detail::__raise_and_add<unsigned long>(unsigned long&, int, unsigned char)':
     2/usr/bin/../lib/gcc/aarch64-linux-gnu/8/../../../../include/c++/8/charconv:410: undefined reference to `__muloti4'
     3libbitcoin_server.a(libbitcoin_server_a-mining.o): In function `bool std::__detail::__raise_and_add<unsigned long>(unsigned long&, int, unsigned char)':
     4/usr/bin/../lib/gcc/aarch64-linux-gnu/8/../../../../include/c++/8/charconv:410: undefined reference to `__muloti4'
     5libbitcoin_server.a(libbitcoin_server_a-mining.o): In function `_ZSt10from_charsIlENSt9enable_ifIXsr22__is_int_to_chars_typeIT_EE5valueESt17from_chars_resultE4typeEPKcS6_RS1_i':
     6/usr/bin/../lib/gcc/aarch64-linux-gnu/8/../../../../include/c++/8/charconv:632: undefined reference to `__muloti4'
     7libbitcoin_server.a(libbitcoin_server_a-dbwrapper.o): In function `bool std::__detail::__raise_and_add<unsigned long>(unsigned long&, int, unsigned char)':
     8/usr/bin/../lib/gcc/aarch64-linux-gnu/8/../../../../include/c++/8/charconv:410: undefined reference to `__muloti4'
     9libbitcoin_util.a(libbitcoin_util_a-strencodings.o): In function `bool std::__detail::__raise_and_add<unsigned long>(unsigned long&, int, unsigned char)':
    10/usr/bin/../lib/gcc/aarch64-linux-gnu/8/../../../../include/c++/8/charconv:410: undefined reference to `__muloti4'
    11libbitcoin_util.a(libbitcoin_util_a-strencodings.o):/usr/bin/../lib/gcc/aarch64-linux-gnu/8/../../../../include/c++/8/charconv:632: more undefined references to `__muloti4' follow
    12/usr/bin/ld: libbitcoin_util.a(libbitcoin_util_a-threadnames.o)(.debug_info+0x37): R_AARCH64_ABS64 used with TLS symbol _ZL13g_thread_nameB5cxx11
    13clang: error: linker command failed with exit code 1 (use -v to see invocation)
    14Makefile:5709: recipe for target 'bitcoind' failed
    

    It works fine with clang-8, however.

    0clang version 8.0.0-3~ubuntu18.04.2 (tags/RELEASE_800/final)
    1Target: aarch64-unknown-linux-gnu
    

    https://packages.debian.org/buster-backports/clang-8

  16. MarcoFalke added the label Upstream on Dec 20, 2021
  17. fanquake deleted a comment on Dec 21, 2021
  18. hebasto commented at 10:34 am on January 3, 2022: member

    It seems there are two different bugs.

    First one is about __mulodi4 symbol, see the OP, and it should be fixed in #21882.

    Second one is about __muloti4 symbol, see #21294 (comment) and #21294 (comment).

    The latter looks like an upstream bug:

  19. hebasto commented at 1:41 pm on January 3, 2022: member

    Also can reproduce for master (d69af93223c4008c3255f7e4848ff05d78c514fa) on ODROID-HC1 + Armbian 21.08.8 Focal

     0$ clang-7 --version
     1clang version 7.0.1-12 (tags/RELEASE_701/final)
     2Target: armv7l-unknown-linux-gnueabihf
     3Thread model: posix
     4InstalledDir: /usr/bin
     5$ make
     6...
     7  CXXLD    bitcoind
     8/usr/bin/ld: libbitcoin_server.a(libbitcoin_server_a-mining.o): in function `bool std::__detail::__raise_and_add<unsigned long long>(unsigned long long&, int, unsigned char)':
     9/usr/bin/../lib/gcc/arm-linux-gnueabihf/10/../../../../include/c++/10/charconv:405: undefined reference to `__muloti4'
    10/usr/bin/ld: libbitcoin_server.a(libbitcoin_server_a-mining.o): in function `_ZSt10from_charsIxENSt9enable_ifIXsr5__or_ISt5__or_IJSt7is_sameINSt9remove_cvIT_E4typeEaES2_IS6_sES2_IS6_iES2_IS6_lES2_IS6_xEEES1_IJS2_IS6_hES2_IS6_tES2_IS6_jES2_IS6_mES2_IS6_yEEES2_IcS6_EEE5valueESt17from_chars_resultE4typeEPKcSO_RS4_i':
    11/usr/bin/../lib/gcc/arm-linux-gnueabihf/10/../../../../include/c++/10/charconv:634: undefined reference to `__muloti4'
    12/usr/bin/ld: libbitcoin_util.a(libbitcoin_util_a-strencodings.o): in function `bool std::__detail::__raise_and_add<unsigned long long>(unsigned long long&, int, unsigned char)':
    13/usr/bin/../lib/gcc/arm-linux-gnueabihf/10/../../../../include/c++/10/charconv:405: undefined reference to `__muloti4'
    14/usr/bin/ld: libbitcoin_util.a(libbitcoin_util_a-strencodings.o): in function `_ZSt10from_charsIxENSt9enable_ifIXsr5__or_ISt5__or_IJSt7is_sameINSt9remove_cvIT_E4typeEaES2_IS6_sES2_IS6_iES2_IS6_lES2_IS6_xEEES1_IJS2_IS6_hES2_IS6_tES2_IS6_jES2_IS6_mES2_IS6_yEEES2_IcS6_EEE5valueESt17from_chars_resultE4typeEPKcSO_RS4_i':
    15/usr/bin/../lib/gcc/arm-linux-gnueabihf/10/../../../../include/c++/10/charconv:634: undefined reference to `__muloti4'
    16/usr/bin/ld: libbitcoin_util.a(libbitcoin_util_a-strencodings.o): in function `bool std::__detail::__raise_and_add<unsigned long long>(unsigned long long&, int, unsigned char)':
    17/usr/bin/../lib/gcc/arm-linux-gnueabihf/10/../../../../include/c++/10/charconv:405: undefined reference to `__muloti4'
    18/usr/bin/ld: libbitcoin_util.a(libbitcoin_util_a-strencodings.o):/usr/bin/../lib/gcc/arm-linux-gnueabihf/10/../../../../include/c++/10/charconv:405: more undefined references to `__muloti4' follow
    19clang: error: linker command failed with exit code 1 (use -v to see invocation)
    20make[2]: *** [Makefile:6409: bitcoind] Error 1
    21...
    

    No errors with clang-8+.

  20. MarcoFalke referenced this in commit e7db4e245a on Mar 12, 2022
  21. DrahtBot locked this on Jan 3, 2023

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: 2024-11-21 21:12 UTC

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