Unable to build with llvm 11.1 on macOS Big Sur #21396

issue Sjors opened this issue on March 9, 2021
  1. Sjors commented at 10:39 AM on March 9, 2021: member

    Another macOS build problem, shocking right?

    Update 1: I was on the v0.21 branch, will retry on master and maybe open a new issue. Update 2: it also happens on master, reinstalling llvm improved things, but see below

    I can build fine with the built in compiler, but I'm trying to build with llvm from homebrew in order to get fuzzing to work.

    macOS 11.2.1 Big Sur llvm: stable 11.1.0 (via Homebrew) clang(++) version 11.0.0 Processor type: x86_64h (Intel x86-64h Haswell)

    ./autogen.sh
    ./configure CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++
    ...
    configure: error: C++ compiler cannot create executables
    

    The CC and CXX commands exist.

    Full log: https://gist.github.com/Sjors/dd7920d3f242a5ae75a3fb8232f33987

    Potentially relevant log fragment:

    configure:4204: /usr/local/opt/llvm/bin/clang++ -qversion >&5
    clang-11: error: unknown argument '-qversion'; did you mean '--version'?
    clang-11: error: no input files
    configure:4215: $? = 1
    configure:4235: checking whether the C++ compiler works
    configure:4257: /usr/local/opt/llvm/bin/clang++  -I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include  -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/bzip2/lib conftest.cpp  >&5
    ld: warning: directory not found for option '-L/usr/local/opt/bzip2/lib'
    ld: library not found for -lc++
    clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
    configure:4261: $? = 1
    configure:4299: result: no
    configure: failed program was:
    | /* confdefs.h */
    | #define PACKAGE_NAME "Bitcoin Core"
    | #define PACKAGE_TARNAME "bitcoin"
    | #define PACKAGE_VERSION "21.99.0"
    | #define PACKAGE_STRING "Bitcoin Core 21.99.0"
    | #define PACKAGE_BUGREPORT "https://github.com/bitcoin/bitcoin/issues"
    | #define PACKAGE_URL "https://bitcoincore.org/"
    | /* end confdefs.h.  */
    | 
    | int
    | main ()
    | {
    | 
    |   ;
    |   return 0;
    | }
    
  2. Sjors added the label Bug on Mar 9, 2021
  3. jarolrod commented at 6:51 PM on March 9, 2021: member

    Can replicate on a 2020 Macbook Pro macOS 11.2.2 with a fresh install of LLVM off of brew. Ran through your steps and was able to configure and build without errors.

    I do get a couple million of the following warning: clang-11: warning: argument unused during compilation: '-fstack-clash-protection' [-Wunused-command-line-argument]

    But, the built bitcoind and bitcoin-qt binaries are unusable. They do not work. But I never ran into a fatal error that prevented me from configuring or building.

    I see a similar report in my log:

    
    clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
    configure:25433: $? = 1
    configure: failed program was:
    | /* confdefs.h */
    | #define PACKAGE_NAME "Bitcoin Core"
    | #define PACKAGE_TARNAME "bitcoin"
    | #define PACKAGE_VERSION "21.99.0"
    | #define PACKAGE_STRING "Bitcoin Core 21.99.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_PRIO_INHERIT 1
    | #define HAVE_PTHREAD 1
    | #define HAVE_DECL_STRERROR_R 1
    | #define HAVE_STRERROR_R 1
    | /* end confdefs.h.  */
    | 
    | int
    | main ()
    | {
    | 
    |   ;
    |   return 0;
    | }
    
    
  4. jarolrod commented at 7:06 PM on March 9, 2021: member

    Where your configure fails, mine succeeds:

    configure:4204: /usr/local/opt/llvm/bin/clang++ -qversion >&5
    clang-11: error: unknown argument '-qversion'; did you mean '--version'?
    clang-11: error: no input files
    configure:4215: $? = 1
    configure:4235: checking whether the C++ compiler works
    configure:4257: /usr/local/opt/llvm/bin/clang++    conftest.cpp  >&5
    configure:4261: $? = 0
    configure:4309: result: yes
    

    full log: https://gist.github.com/jarolrod/93b8bee8e6ee75417188f95bcc4da2b0

  5. Sjors commented at 7:52 PM on March 9, 2021: member

    Can replicate on a 2020 Macbook Pro macOS 11.2.2 with a fresh install of LLVM off of brew. Ran through your steps and was able to configure and build without errors.

    So you mean you can't replicate my error? :-)

    I'll go and update macOS to 11.2.3 just in case. It's very strange we don't get the same error, but there might just be a bunch of junk on my system from previous experiments. Come to think of it, I might have been on the v0.21 branch. So I'll retry on the latest master and note the commit...

  6. jarolrod commented at 8:02 PM on March 9, 2021: member

    So you mean you can't replicate my error? :-)

    I can configure and build (with 100+ warnings generated) but the binaries don't actually work.

  7. fanquake commented at 12:35 AM on March 10, 2021: member

    This isn't a Bitcoin Core issue. Your compiler is broken. Does just compiling a program with /usr/local/opt/llvm/bin/clang++ work?

  8. Sjors commented at 8:11 AM on March 10, 2021: member

    I got the same error on master @ eea6196c3d8056e51e1780a44ac7f599331247e5 on macOS 11.2.2

    I reinstalled llvm (which I hadn't done after upgrading to Big Sur). I'm able to compile and run a hello world c++ program with it.

    This time I got a bit further, but configuring univalue fails:

    ./configure CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++ --without-gui --disable-zmq --without-miniupnpc --without-natpmp --without-bdb --disable-bench
    ...
    checking for gcc... /usr/local/opt/llvm/bin/clang
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables... 
    checking whether we are cross compiling... configure: error: in `/Users/sjors/dev/bitcoin-fuzz/src/univalue':
    configure: error: cannot run C compiled programs.
    If you meant to cross compile, use `--host'.
    

    Full log.

    It seems to think I'm trying to cross compile. If I install Univalue on my system and use --with-system-univalue then the error just repeats for secp256k1.

  9. real-or-random commented at 5:44 PM on April 6, 2021: member

    I got the same error on master @ [eea6196](https://github.com/bitcoin/bitcoin/commit

    ./configure CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++ --without-gui --disable-zmq --without-miniupnpc --without-natpmp --without-bdb --disable-bench
    ...
    checking for gcc... /usr/local/opt/llvm/bin/clang
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables... 
    checking whether we are cross compiling... configure: error: in `/Users/sjors/dev/bitcoin-fuzz/src/univalue':
    configure: error: cannot run C compiled programs.
    If you meant to cross compile, use `--host'.
    

    Full log.

    Is this the right log? It doesn't contain the string "cannot run C compiled programs".

  10. fanquake commented at 2:23 AM on January 21, 2022: member

    Going to close this. I can't recreate the problem, and I'm still convinced this is/was an issue with your system.

  11. fanquake closed this on Jan 21, 2022

  12. Sjors commented at 2:08 PM on January 21, 2022: member

    Sounds good. I also don't have a Big Sur system anymore.

  13. DrahtBot locked this on Jan 21, 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-14 09:14 UTC

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