build failure on M1 (arm64): error: unknown target CPU 'armv8-a+crc+crypto' #25556

issue pinheadmz opened this issue on July 6, 2022
  1. pinheadmz commented at 4:20 PM on July 6, 2022: member

    System:

    --> uname -a
    Darwin   21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:47:26 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T8101 arm64
    
    --> gcc -v
    Apple clang version 13.1.6 (clang-1316.0.21.2.5)
    Target: arm64-apple-darwin21.4.0
    Thread model: posix
    InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    

    Bitcoin: (master branch)

    --> git rev-parse HEAD
    aeab1b42e67cc8146bfc7d127d15633bd652fe60
    

    Build command:

    ./autogen.sh
    ./configure --without-gui --with-incompatible-bdb
    make -j 4
    

    Error output:

    ...
    30 warnings generated.
      CXX      zmq/libbitcoin_zmq_a-zmqutil.o
      CXX      primitives/libbitcoin_consensus_a-block.o
      CXX      primitives/libbitcoin_consensus_a-transaction.o
      CXX      crypto/libbitcoin_crypto_base_la-aes.lo
      CXX      crypto/libbitcoin_crypto_base_la-chacha_poly_aead.lo
      CXX      crypto/libbitcoin_crypto_base_la-chacha20.lo
      CXX      crypto/libbitcoin_crypto_base_la-hkdf_sha256_32.lo
      CXX      crypto/libbitcoin_crypto_base_la-hmac_sha256.lo
      CXX      crypto/libbitcoin_crypto_base_la-hmac_sha512.lo
      CXX      crypto/libbitcoin_crypto_base_la-poly1305.lo
      CXX      crypto/libbitcoin_crypto_base_la-muhash.lo
      CXX      crypto/libbitcoin_crypto_base_la-ripemd160.lo
      CXX      crypto/libbitcoin_crypto_base_la-sha1.lo
      CXX      crypto/libbitcoin_crypto_base_la-sha256.lo
      CXX      crypto/libbitcoin_crypto_base_la-sha3.lo
      CXX      crypto/libbitcoin_crypto_base_la-sha512.lo
      CXX      crypto/libbitcoin_crypto_base_la-siphash.lo
      CXX      crypto/libbitcoin_crypto_base_la-sha256_sse4.lo
      CXX      crypto/libbitcoin_crypto_arm_shani_la-sha256_arm_shani.lo
      CXX      leveldb/db/libleveldb_la-builder.lo
    error: unknown target CPU 'armv8-a+crc+crypto'
    note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, x86-64, x86-64-v2, x86-64-v3, x86-64-v4
    make[2]: *** [crypto/libbitcoin_crypto_arm_shani_la-sha256_arm_shani.lo] Error 1
    make[2]: *** Waiting for unfinished jobs....
    make[1]: *** [all-recursive] Error 1
    make: *** [all-recursive] Error 1
    
  2. pinheadmz added the label Bug on Jul 6, 2022
  3. sipa commented at 4:22 PM on July 6, 2022: member

    Bizarre, it looks like your compiler is targetting x86_64, not arm64.

  4. pinheadmz commented at 4:26 PM on July 6, 2022: member

    indeed, the M1 mac has been quite skitzophrenic when it comes to architecture and compiling native code, but I have had success with other projects. I just found something that might be part of the issue:

    --> make -v
    GNU Make 3.81
    Copyright (C) 2006  Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.
    There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
    PARTICULAR PURPOSE.
    
    This program built for i386-apple-darwin11.3.0
    
  5. fanquake added the label macOS on Jul 6, 2022
  6. pinheadmz commented at 5:07 PM on July 6, 2022: member

    output of ./configure includes:

    
    checking build system type... aarch64-apple-darwin21.4.0
    checking host system type... aarch64-apple-darwin21.4.0
    
  7. fanquake commented at 5:26 PM on July 6, 2022: member

    This will almost certainly be something like rosseta inferering where it shouldn't be, and confusing autotools / the compiler etc.

  8. pinheadmz commented at 5:31 PM on July 6, 2022: member

    libtool is dual arch:

    --> file `which libtool`
    /usr/bin/libtool: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64
    - Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e
    - Mach-O 64-bit executable arm64e]
    /usr/bin/libtool (for architecture x86_64):	Mach-O 64-bit executable x86_64
    /usr/bin/libtool (for architecture arm64e):	Mach-O 64-bit executable arm64e
    

    but for some reason keeps generating glibtoolize with the wrong arch:

    
    When reporting a bug, please describe a test case to reproduce it and
    include the following information:
    
           host-triplet:   aarch64-apple-darwin21.3.0
           version:        $progname (GNU libtool) 2.4.7
           automake:       `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
           autoconf:       `($AUTOCONF --version) 2>/dev/null |$SED 1q`
    
  9. dongcarl commented at 7:28 PM on July 6, 2022: member

    Hmmm interesting... Could you do a make V=1 so we can see the CXX line?

  10. pinheadmz commented at 7:30 PM on July 6, 2022: member

    Thanks Carl,

    /usr/local/bin/ccache g++ -std=c++17 -DHAVE_CONFIG_H -I. -I../src/config  -fmacro-prefix-map=/Users/matthewzipkin/Desktop/work/bitcoin=. -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -DHAVE_BUILD_INFO -DMAC_OSX -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -DPROVIDE_FUZZ_MAIN_FUNCTION -I. -I./minisketch/include -I./secp256k1/include -I./univalue/include -I/usr/local/include -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_NO_CXX98_FUNCTION_BASE -I./leveldb/include  -fdebug-prefix-map=/Users/matthewzipkin/Desktop/work/bitcoin=. -Wstack-protector -fstack-protector-all -Wall -Wextra -Wgnu -Wformat -Wformat-security -Wvla -Wshadow-field -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunused-member-function -Wdate-time -Wconditional-uninitialized -Woverloaded-virtual -Wsuggest-override -Wunreachable-code-loop-increment -Wimplicit-fallthrough -Wno-unused-parameter -Wno-self-assign -Wno-deprecated-copy       -g -O2 -MT bitcoind-bitcoind.o -MD -MP -MF .deps/bitcoind-bitcoind.Tpo -c -o bitcoind-bitcoind.o `test -f 'bitcoind.cpp' || echo './'`bitcoind.cpp
    
    

    wrapped:

    /usr/local/bin/ccache g++ -std=c++17 -DHAVE_CONFIG_H -I. -I../src/config -fmacro-prefix-map=/Users/matthewzipkin/Desktop/work/bitcoin=. -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -DHAVE_BUILD_INFO -DMAC_OSX -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -DPROVIDE_FUZZ_MAIN_FUNCTION -I. -I./minisketch/include -I./secp256k1/include -I./univalue/include -I/usr/local/include -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_NO_CXX98_FUNCTION_BASE -I./leveldb/include -fdebug-prefix-map=/Users/matthewzipkin/Desktop/work/bitcoin=. -Wstack-protector -fstack-protector-all -Wall -Wextra -Wgnu -Wformat -Wformat-security -Wvla -Wshadow-field -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunused-member-function -Wdate-time -Wconditional-uninitialized -Woverloaded-virtual -Wsuggest-override -Wunreachable-code-loop-increment -Wimplicit-fallthrough -Wno-unused-parameter -Wno-self-assign -Wno-deprecated-copy -g -O2 -MT bitcoind-bitcoind.o -MD -MP -MF .deps/bitcoind-bitcoind.Tpo -c -o bitcoind-bitcoind.o test -f 'bitcoind.cpp' || echo './'bitcoind.cpp

  11. pinheadmz commented at 7:31 PM on July 6, 2022: member

    oh heres right before the error:

    /bin/sh ../libtool  --tag=CXX --preserve-dup-deps  --mode=compile /usr/local/bin/ccache g++ -std=c++17 -DHAVE_CONFIG_H -I. -I../src/config  -fmacro-prefix-map=/Users/matthewzipkin/Desktop/work/bitcoin=. -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -DHAVE_BUILD_INFO -DMAC_OSX -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -DPROVIDE_FUZZ_MAIN_FUNCTION -DENABLE_ARM_SHANI  -fdebug-prefix-map=/Users/matthewzipkin/Desktop/work/bitcoin=. -Wstack-protector -fstack-protector-all -Wall -Wextra -Wgnu -Wformat -Wformat-security -Wvla -Wshadow-field -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunused-member-function -Wdate-time -Wconditional-uninitialized -Woverloaded-virtual -Wsuggest-override -Wunreachable-code-loop-increment -Wimplicit-fallthrough -Wno-unused-parameter -Wno-self-assign -Wno-deprecated-copy       -static -march=armv8-a+crc+crypto -g -O2 -MT crypto/libbitcoin_crypto_arm_shani_la-sha256_arm_shani.lo -MD -MP -MF crypto/.deps/libbitcoin_crypto_arm_shani_la-sha256_arm_shani.Tpo -c -o crypto/libbitcoin_crypto_arm_shani_la-sha256_arm_shani.lo `test -f 'crypto/sha256_arm_shani.cpp' || echo './'`crypto/sha256_arm_shani.cpp
    libtool: compile:  /usr/local/bin/ccache g++ -std=c++17 -DHAVE_CONFIG_H -I. -I../src/config -fmacro-prefix-map=/Users/matthewzipkin/Desktop/work/bitcoin=. -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -DHAVE_BUILD_INFO -DMAC_OSX -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -DPROVIDE_FUZZ_MAIN_FUNCTION -DENABLE_ARM_SHANI -fdebug-prefix-map=/Users/matthewzipkin/Desktop/work/bitcoin=. -Wstack-protector -fstack-protector-all -Wall -Wextra -Wgnu -Wformat -Wformat-security -Wvla -Wshadow-field -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunused-member-function -Wdate-time -Wconditional-uninitialized -Woverloaded-virtual -Wsuggest-override -Wunreachable-code-loop-increment -Wimplicit-fallthrough -Wno-unused-parameter -Wno-self-assign -Wno-deprecated-copy -march=armv8-a+crc+crypto -g -O2 -MT crypto/libbitcoin_crypto_arm_shani_la-sha256_arm_shani.lo -MD -MP -MF crypto/.deps/libbitcoin_crypto_arm_shani_la-sha256_arm_shani.Tpo -c crypto/sha256_arm_shani.cpp  -fno-common -DPIC -o crypto/libbitcoin_crypto_arm_shani_la-sha256_arm_shani.o
    
    

    /bin/sh ../libtool --tag=CXX --preserve-dup-deps --mode=compile /usr/local/bin/ccache g++ -std=c++17 -DHAVE_CONFIG_H -I. -I../src/config -fmacro-prefix-map=/Users/matthewzipkin/Desktop/work/bitcoin=. -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -DHAVE_BUILD_INFO -DMAC_OSX -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -DPROVIDE_FUZZ_MAIN_FUNCTION -DENABLE_ARM_SHANI -fdebug-prefix-map=/Users/matthewzipkin/Desktop/work/bitcoin=. -Wstack-protector -fstack-protector-all -Wall -Wextra -Wgnu -Wformat -Wformat-security -Wvla -Wshadow-field -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunused-member-function -Wdate-time -Wconditional-uninitialized -Woverloaded-virtual -Wsuggest-override -Wunreachable-code-loop-increment -Wimplicit-fallthrough -Wno-unused-parameter -Wno-self-assign -Wno-deprecated-copy -static -march=armv8-a+crc+crypto -g -O2 -MT crypto/libbitcoin_crypto_arm_shani_la-sha256_arm_shani.lo -MD -MP -MF crypto/.deps/libbitcoin_crypto_arm_shani_la-sha256_arm_shani.Tpo -c -o crypto/libbitcoin_crypto_arm_shani_la-sha256_arm_shani.lo test -f 'crypto/sha256_arm_shani.cpp' || echo './'crypto/sha256_arm_shani.cpp libtool: compile: /usr/local/bin/ccache g++ -std=c++17 -DHAVE_CONFIG_H -I. -I../src/config -fmacro-prefix-map=/Users/matthewzipkin/Desktop/work/bitcoin=. -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -DHAVE_BUILD_INFO -DMAC_OSX -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -DPROVIDE_FUZZ_MAIN_FUNCTION -DENABLE_ARM_SHANI -fdebug-prefix-map=/Users/matthewzipkin/Desktop/work/bitcoin=. -Wstack-protector -fstack-protector-all -Wall -Wextra -Wgnu -Wformat -Wformat-security -Wvla -Wshadow-field -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunused-member-function -Wdate-time -Wconditional-uninitialized -Woverloaded-virtual -Wsuggest-override -Wunreachable-code-loop-increment -Wimplicit-fallthrough -Wno-unused-parameter -Wno-self-assign -Wno-deprecated-copy -march=armv8-a+crc+crypto -g -O2 -MT crypto/libbitcoin_crypto_arm_shani_la-sha256_arm_shani.lo -MD -MP -MF crypto/.deps/libbitcoin_crypto_arm_shani_la-sha256_arm_shani.Tpo -c crypto/sha256_arm_shani.cpp -fno-common -DPIC -o crypto/libbitcoin_crypto_arm_shani_la-sha256_arm_shani.o

  12. pinheadmz commented at 7:42 PM on July 6, 2022: member

    okay seeing the full gcc line gave me a clue and I upgraded ccache which was migrated from my old intel based mac. After updating ccache build still failed but it got a lot farther:

      CXXLD    univalue/test/object
      CXXLD    univalue/test/unitester
      CXXLD    univalue/test/no_nul
      CXXLD    bitcoind
    ld: warning: ignoring file /usr/local/Cellar/zeromq/4.3.4/lib/libzmq.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
      CXXLD    bitcoin-cli
      CXXLD    test/test_bitcoin
    ld: warning: ignoring file /usr/local/Cellar/zeromq/4.3.4/lib/libzmq.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
      CXXLD    test/fuzz/fuzz
    Undefined symbols for architecture arm64:
      "_zmq_msg_data", referenced from:
          zmq_send_multipart(void*, void const*, unsigned long, ...) in libbitcoin_zmq.a(libbitcoin_zmq_a-zmqpublishnotifier.o)
      "_zmq_msg_init_size", referenced from:
          zmq_send_multipart(void*, void const*, unsigned long, ...) in libbitcoin_zmq.a(libbitcoin_zmq_a-zmqpublishnotifier.o)
      "_zmq_socket", referenced from:
          CZMQAbstractPublishNotifier::Initialize(void*) in libbitcoin_zmq.a(libbitcoin_zmq_a-zmqpublishnotifier.o)
      "_zmq_ctx_term", referenced from:
          CZMQNotificationInterface::Shutdown() in libbitcoin_zmq.a(libbitcoin_zmq_a-zmqnotificationinterface.o)
      "_zmq_bind", referenced from:
          CZMQAbstractPublishNotifier::Initialize(void*) in libbitcoin_zmq.a(libbitcoin_zmq_a-zmqpublishnotifier.o)
      "_zmq_setsockopt", referenced from:
          CZMQAbstractPublishNotifier::Initialize(void*) in libbitcoin_zmq.a(libbitcoin_zmq_a-zmqpublishnotifier.o)
          CZMQAbstractPublishNotifier::Shutdown() in libbitcoin_zmq.a(libbitcoin_zmq_a-zmqpublishnotifier.o)
      "_zmq_msg_send", referenced from:
          zmq_send_multipart(void*, void const*, unsigned long, ...) in libbitcoin_zmq.a(libbitcoin_zmq_a-zmqpublishnotifier.o)
      "_zmq_msg_close", referenced from:
          zmq_send_multipart(void*, void const*, unsigned long, ...) in libbitcoin_zmq.a(libbitcoin_zmq_a-zmqpublishnotifier.o)
      "_zmq_close", referenced from:
          CZMQAbstractPublishNotifier::Initialize(void*) in libbitcoin_zmq.a(libbitcoin_zmq_a-zmqpublishnotifier.o)
          CZMQAbstractPublishNotifier::Shutdown() in libbitcoin_zmq.a(libbitcoin_zmq_a-zmqpublishnotifier.o)
      "_zmq_ctx_new", referenced from:
          CZMQNotificationInterface::Initialize() in libbitcoin_zmq.a(libbitcoin_zmq_a-zmqnotificationinterface.o)
      "_zmq_version", referenced from:
          CZMQNotificationInterface::Initialize() in libbitcoin_zmq.a(libbitcoin_zmq_a-zmqnotificationinterface.o)
      "_zmq_strerror", referenced from:
          zmqError(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libbitcoin_zmq.a(libbitcoin_zmq_a-zmqutil.o)
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[2]: *** [bitcoind] Error 1
    make[2]: *** Waiting for unfinished jobs....
    ld: warning: ignoring file /usr/local/Cellar/zeromq/4.3.4/lib/libzmq.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
    ld: warning: ignoring file /usr/local/Cellar/zeromq/4.3.4/lib/libzmq.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
    make[1]: *** [all-recursive] Error 1
    make: *** [all-recursive] Error 1
    

    Looks like ZMQ just needs an upgrade from intel->arm next...

  13. pinheadmz commented at 7:48 PM on July 6, 2022: member

    SUCCESS!!

    Sheesh.

    For future frustrated nerds: ccache may need to be wiped out / upgraded, and old intel-homebrew packages in /usr/local/Cellar may need to be wiped out too (like ZMQ). Let arm-brew install new packages in /opt/homebrew

  14. pinheadmz closed this on Jul 6, 2022

  15. DrahtBot locked this on Jul 6, 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-04-21 18:13 UTC

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