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

issue rebroad opened 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:

      CXXLD    test/fuzz/fuzz
    /usr/bin/ld: test/fuzz/fuzz-multiplication_overflow.o: in function `void (anonymous namespace)::TestMultiplicationOverflow<long long>(FuzzedDataProvider&)':
    ./test/fuzz/multiplication_overflow.cpp:30: undefined reference to `__mulodi4'
    clang: 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. hebasto cross-referenced this on May 7, 2021 from issue build: Fix undefined reference to __mulodi4 by hebasto
  12. fanquake closed this on Jul 29, 2021

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

    This is still an issue:-

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

    @rebroad

    This is still an issue:-

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

    Because #21882 has not been backported to 0.21.

  16. MarcoFalke commented at 4:48 PM on December 20, 2021: member

    Maybe this is a compiler bug?

    I can reproduce with:

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

    It works fine with clang-8, however.

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

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

  17. MarcoFalke added the label Upstream on Dec 20, 2021
  18. bitcoin deleted a comment on Dec 21, 2021
  19. 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:

  20. 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

    $ clang-7 --version
    clang version 7.0.1-12 (tags/RELEASE_701/final)
    Target: armv7l-unknown-linux-gnueabihf
    Thread model: posix
    InstalledDir: /usr/bin
    $ make
    ...
      CXXLD    bitcoind
    /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)':
    /usr/bin/../lib/gcc/arm-linux-gnueabihf/10/../../../../include/c++/10/charconv:405: undefined reference to `__muloti4'
    /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':
    /usr/bin/../lib/gcc/arm-linux-gnueabihf/10/../../../../include/c++/10/charconv:634: undefined reference to `__muloti4'
    /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)':
    /usr/bin/../lib/gcc/arm-linux-gnueabihf/10/../../../../include/c++/10/charconv:405: undefined reference to `__muloti4'
    /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':
    /usr/bin/../lib/gcc/arm-linux-gnueabihf/10/../../../../include/c++/10/charconv:634: undefined reference to `__muloti4'
    /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)':
    /usr/bin/../lib/gcc/arm-linux-gnueabihf/10/../../../../include/c++/10/charconv:405: undefined reference to `__muloti4'
    /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
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[2]: *** [Makefile:6409: bitcoind] Error 1
    ...
    

    No errors with clang-8+.

  21. MarcoFalke cross-referenced this on Jan 26, 2022 from issue build: Bump minimum required clang/libc++ to 8.0 by MarcoFalke
  22. MarcoFalke referenced this in commit e7db4e245a on Mar 12, 2022
  23. bitcoin 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: 2026-05-20 06:54 UTC