Linker Error on OSX #12535

issue kenneth opened this issue on February 26, 2018
  1. kenneth commented at 4:34 AM on February 26, 2018: none

    ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

    ➜  bitcoin git:(master) make
    Making all in src
    make[1]: Entering directory '/Users/Documents/bitcoin/bitcoin/src'
    make[2]: Entering directory '/Users/Documents/bitcoin/bitcoin/src'
    make[3]: Entering directory '/Users/Documents/bitcoin/bitcoin'
    make[3]: Leaving directory '/Users/Documents/bitcoin/bitcoin'
    make[3]: Entering directory '/Users/Documents/bitcoin/bitcoin/src/secp256k1'
    make[3]: Leaving directory '/Users/Documents/bitcoin/bitcoin/src/secp256k1'
      AR       libbitcoin_wallet.a
      AR       libbitcoin_common.a
      AR       libbitcoin_util.a
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libbitcoin_util.a(libbitcoin_util_a-strnlen.o) has no symbols
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libbitcoin_util.a(libbitcoin_util_a-strnlen.o) has no symbols
      AR       libbitcoin_consensus.a
      AR       crypto/libbitcoin_crypto.a
      AR       leveldb/libleveldb_sse42.a
      AR       leveldb/libmemenv.a
      CXXLD    bitcoind
    Undefined symbols for architecture x86_64:
      "boost::thread::start_thread_noexcept()", referenced from:
          boost::thread::start_thread() in libbitcoin_server.a(libbitcoin_server_a-init.o)
      "boost::thread::join_noexcept()", referenced from:
          boost::thread::join() in libbitcoin_server.a(libbitcoin_server_a-init.o)
      "boost::thread_detail::enter_once_region(boost::once_flag&)", referenced from:
          OpenDebugLog() in libbitcoin_util.a(libbitcoin_util_a-util.o)
          LogPrintStr(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libbitcoin_util.a(libbitcoin_util_a-util.o)
      "boost::this_thread::hidden::sleep_for(timespec const&)", referenced from:
          MilliSleep(long long) in libbitcoin_util.a(libbitcoin_util_a-utiltime.o)
      "boost::thread::physical_concurrency()", referenced from:
          GetNumCores() in libbitcoin_util.a(libbitcoin_util_a-util.o)
      "boost::thread_detail::commit_once_region(boost::once_flag&)", referenced from:
          OpenDebugLog() in libbitcoin_util.a(libbitcoin_util_a-util.o)
          LogPrintStr(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libbitcoin_util.a(libbitcoin_util_a-util.o)
      "boost::thread_detail::rollback_once_region(boost::once_flag&)", referenced from:
          OpenDebugLog() in libbitcoin_util.a(libbitcoin_util_a-util.o)
          LogPrintStr(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libbitcoin_util.a(libbitcoin_util_a-util.o)
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[2]: *** [Makefile:3647: bitcoind] Error 1
    make[2]: Leaving directory '/Users/Documents/bitcoin/bitcoin/src'
    make[1]: *** [Makefile:9419: all-recursive] Error 1
    make[1]: Leaving directory '/Users/Documents/bitcoin/bitcoin/src'
    make: *** [Makefile:747: all-recursive] Error 1
    

    How to change this linker?

    checking whether the gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
    
    ➜  bitcoin git:(master) make -v
    GNU Make 4.2.1
    Built for x86_64-apple-darwin17.0.0
    Copyright (C) 1988-2016 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    
  2. kenneth renamed this:
    Build Error on OSX
    Linker Error on OSX
    on Feb 26, 2018
  3. jonasschnelli commented at 1:19 PM on February 26, 2018: contributor

    It seems that you have mismatch in boost somewhere. How did you install the dependencies? With Homebrew? Maybe check if MacPort or another package manager is installed and make sure, you remove all versions of boost and then reinstall it with Homebrew (check the build-osx doc).

  4. jonasschnelli added the label MacOSX on Feb 26, 2018
  5. kenneth commented at 7:54 AM on February 27, 2018: none

    @jonasschnelli
    brew install boost the version is 1.66 and i have compile from source 1.60

    ./b2 install 
    

    but now i don't know how to fix the dependencies

    Making all in src
      CXXLD    bitcoind
    Undefined symbols for architecture x86_64:
      "boost::this_thread::hidden::sleep_for(timespec const&)", referenced from:
          MilliSleep(long long) in libbitcoin_util.a(libbitcoin_util_a-utiltime.o)
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[2]: *** [bitcoind] Error 1
    make[1]: *** [all-recursive] Error 1
    make: *** [all-recursive] Error 1
    
    ➜  bitcoin git:(master) make
    Making all in src
      CXX      libbitcoin_server_a-init.o
      AR       libbitcoin_server.a
      CXX      libbitcoin_util_a-random.o
      CXX      libbitcoin_util_a-util.o
      AR       libbitcoin_util.a
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libbitcoin_util.a(libbitcoin_util_a-strnlen.o) has no symbols
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libbitcoin_util.a(libbitcoin_util_a-strnlen.o) has no symbols
      CXXLD    bitcoind
    Undefined symbols for architecture x86_64:
      "boost::this_thread::hidden::sleep_for(timespec const&)", referenced from:
          MilliSleep(long long) in libbitcoin_util.a(libbitcoin_util_a-utiltime.o)
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[2]: *** [bitcoind] Error 1
    make[1]: *** [all-recursive] Error 1
    make: *** [all-recursive] Error 1
    
  6. AlvaroLuken commented at 11:13 PM on February 28, 2018: none

    Hi, guys :D, I am a beginner in open source! How can I contribute to Bitcoin?

  7. Miskerest commented at 9:33 PM on March 1, 2018: none

    I've just tried compiling this on my x86_64 OSX machine with no issues. I have the same version of boost. You did use brew to install boost? I assume you followed the instructions ./doc/build-osx.mc. Also, what version of OSX are you running?

  8. kenneth commented at 12:04 PM on March 3, 2018: none

    @Miskerest I have compiled it successfully, but now I can't locate the mistake。

    Undefined symbols for architecture x86_64:
    

    What is the cause of this problem?Destruction of my compile environment

  9. jnewbery commented at 8:57 PM on April 3, 2018: member

    @kenneth - since your issue is now resolved, I'm going to close this issue. Feel free to re-open if you think this is still a problem.

  10. jnewbery closed this on Apr 3, 2018

  11. ghost commented at 12:55 PM on May 6, 2018: none

    I got the same issue with a port+brew double install of boost. I removed the port (1.55.0_0, 1.55.0_2 and 1.66.0_2) versions and the issue was removed as well:

    sudo port uninstall boost  # all versions
    
  12. MarcoFalke locked this on Sep 8, 2021

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:15 UTC

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