compiled error in macos: Undefined symbols for architecture x86_64: "_CRYPTO_num_locks", referenced from: CInit::CInit() in libbitcoin_util.a(libbitcoin_util_a-util.o) "_RAND_cleanup", referenced from: CInit::~CInit() in libbitcoin_util.a(libbitcoin_util_a-util.o) "_CRYPTO_set_locking_callback", referenced from: CInit::CInit() in libbitcoin_util.a(libbitcoin_util_a-util.o) CInit::~CInit() in libbitcoin_util.a(libbitcoin_util_a-util.o) "_OPENSSL_no_config", referenced from: CInit::CInit() 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)
-
chinqi commented at 4:11 AM on June 28, 2017: none
- fanquake added the label MacOSX on Jun 28, 2017
- laanwj added the label Build system on Jun 28, 2017
-
laanwj commented at 6:58 AM on June 28, 2017: member
You need to be more specific as to which steps you've followed. You're using Homebrew as documented in build-osx.md? What MacOSX version?
-
chinqi commented at 7:35 AM on June 28, 2017: none
I installed library mention in build-osx.md, and all configure was passed. But there was error in link bitcoind excutable. I am using MacBook Air MacOS Sierra 10.12.4
-
jonasschnelli commented at 8:30 AM on June 28, 2017: contributor
Can you post your config.log somewhere? Can you also do a
make cleanand amake V=1and post the pastebin of that output? -
chinqi commented at 9:02 AM on June 28, 2017: none
Here is the output using option with V=1: /bin/sh ../libtool --tag=CXX --mode=link g++ -std=c++11 -Wstack-protector -fstack-protector-all -fPIE -g -O2 -Wall -Wextra -Wformat -Wvla -Wformat-security -Wno-unused-parameter -Wno-self-assign -Wno-unused-local-typedef -Wno-deprecated-register -Wno-implicit-fallthrough -Qunused-arguments -pthread -pie -L/usr/local/apr/lib/ -Wl,-headerpad_max_install_names -Wl,-dead_strip -o bitcoind bitcoind-bitcoind.o libbitcoin_server.a libbitcoin_common.a univalue/libunivalue.la libbitcoin_util.a libbitcoin_wallet.a libbitcoin_zmq.a libbitcoin_consensus.a crypto/libbitcoin_crypto.a leveldb/libleveldb.a leveldb/libleveldb_sse42.a leveldb/libmemenv.a secp256k1/libsecp256k1.la -L/usr/local/lib -lboost_system -lboost_filesystem -lboost_program_options -lboost_thread -lboost_chrono -ldb_cxx-4.8 -L/usr/local/Cellar/openssl/1.0.2l/lib -lssl -L/usr/local/Cellar/openssl/1.0.2l/lib -lcrypto -lminiupnpc -L/usr/local/Cellar/libevent/2.1.8/lib -levent_pthreads -levent -L/usr/local/Cellar/libevent/2.1.8/lib -levent -L/usr/local/lib -lzmq -L/opt/local/lib -L/usr/local/opt/berkeley-db@4/lib libtool: link: g++ -std=c++11 -Wstack-protector -fstack-protector-all -fPIE -g -O2 -Wall -Wextra -Wformat -Wvla -Wformat-security -Wno-unused-parameter -Wno-self-assign -Wno-unused-local-typedef -Wno-deprecated-register -Wno-implicit-fallthrough -Qunused-arguments -pthread -pie -Wl,-headerpad_max_install_names -Wl,-dead_strip -o bitcoind bitcoind-bitcoind.o -Wl,-bind_at_load -L/usr/local/apr/lib/ libbitcoin_server.a libbitcoin_common.a univalue/.libs/libunivalue.a libbitcoin_util.a libbitcoin_wallet.a libbitcoin_zmq.a libbitcoin_consensus.a crypto/libbitcoin_crypto.a leveldb/libleveldb.a leveldb/libleveldb_sse42.a leveldb/libmemenv.a secp256k1/.libs/libsecp256k1.a -L/usr/local/lib -lboost_system -lboost_filesystem -lboost_program_options -lboost_thread -lboost_chrono -ldb_cxx-4.8 -L/usr/local/Cellar/openssl/1.0.2l/lib -lssl -lcrypto -lminiupnpc -L/usr/local/Cellar/libevent/2.1.8/lib -levent_pthreads -levent /usr/local/lib/libzmq.dylib -lpthread -L/opt/local/lib -L/usr/local/opt/berkeley-db@4/lib -pthread Undefined symbols for architecture x86_64: "_CRYPTO_num_locks", referenced from: CInit::CInit() in libbitcoin_util.a(libbitcoin_util_a-util.o) "_RAND_cleanup", referenced from: CInit::~CInit() in libbitcoin_util.a(libbitcoin_util_a-util.o) "_CRYPTO_set_locking_callback", referenced from: CInit::CInit() in libbitcoin_util.a(libbitcoin_util_a-util.o) CInit::~CInit() in libbitcoin_util.a(libbitcoin_util_a-util.o) "_OPENSSL_no_config", referenced from: CInit::CInit() 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)
-
meshcollider commented at 11:36 AM on June 28, 2017: contributor
I believe this is fixable by giving the location of the boost library in the ./configure step using the
--with-boost-libdir=LIB_DIRparameter (just find the lib directory of boost on your machine), try that and let us know how it goes. If it works maybe we should add a note to the build instructions for others with this issue? -
chinqi commented at 2:18 AM on June 29, 2017: none
@MeshCollider Yes, I install two version of boost, but not that problem. The reason is that I installed openssl manual, there are two version of openssl, linker get the wrong dylib, maybe the library version has been changed.
- chinqi closed this on Jun 29, 2017
-
Yoge-Code commented at 10:08 AM on April 17, 2018: none
Hi @zhci! I'm suffering the same problem with you. After make V=1, it complains:
libtool: link: /usr/local/bin/ccache g++ -std=c++11 -Wstack-protector -fstack-protector-all -fPIE -g -O2 -Wall -Wextra -Wformat -Wvla -Wformat-security -Wthread-safety-analysis -Wno-unused-parameter -Wno-self-assign -Wno-unused-local-typedef -Wno-deprecated-register -Wno-implicit-fallthrough -Qunused-arguments -pthread -pie -Wl,-headerpad_max_install_names -Wl,-dead_strip -o bitcoind bitcoind-bitcoind.o -Wl,-bind_at_load libbitcoin_server.a libbitcoin_wallet.a libbitcoin_common.a univalue/.libs/libunivalue.a libbitcoin_util.a libbitcoin_consensus.a crypto/libbitcoin_crypto.a leveldb/libleveldb.a leveldb/libleveldb_sse42.a leveldb/libmemenv.a secp256k1/.libs/libsecp256k1.a -L/usr/local/lib -lboost_system -lboost_filesystem -lboost_program_options -lboost_thread -lboost_chrono -ldb_cxx-4.8 -L/usr/local/Cellar/openssl/1.0.2o_1/lib -lssl -lcrypto -L/usr/local/Cellar/libevent/2.0.22/lib -levent_pthreads -levent -levent -L/usr/local/opt/berkeley-db@4/lib -pthread Undefined symbols for architecture x86_64: "_CRYPTO_num_locks", referenced from: CInit::CInit() in libbitcoin_util.a(libbitcoin_util_a-util.o) "_RAND_cleanup", referenced from: CInit::~CInit() in libbitcoin_util.a(libbitcoin_util_a-util.o) "_CRYPTO_set_locking_callback", referenced from: CInit::CInit() in libbitcoin_util.a(libbitcoin_util_a-util.o) CInit::~CInit() in libbitcoin_util.a(libbitcoin_util_a-util.o) "_OPENSSL_no_config", referenced from: CInit::CInit() in libbitcoin_util.a(libbitcoin_util_a-util.o) ld: symbol(s) not found for architecture x86_64There are many versions of openssl(1.0.2f 1.0.2g 1.0.2j 1.0.2k 1.0.2l 1.0.2m 1.0.2n 1.0.2o_1) in the directory(
/usr/local/Cellar/openssl). I don't know why I have so many versions, maybe I install them to try to solve problems before. As the complain says, it links to1.0.2o_1, so I cd the path, and grep all of the undefined symbols one by one➜ 1.0.2o_1 grep _RAND_cleanup ./ -rn Binary file .//bin/openssl matches Binary file .//lib/libcrypto.1.0.0.dylib matches Binary file .//lib/libcrypto.a matches Binary file .//lib/libcrypto.dylib matchesIt seams that all the undefined symbols are exists. I have no idea now. Could you tell me how to solve this problem?
-
jonasschnelli commented at 11:30 AM on April 17, 2018: contributor
@YG-FLUSH: Looks like you have misconfigured openssl installation. Try to remove all existing openssl versions with Homebrew and other package managers like "MacPorts". Try to install the version(s) you want. Run ./configure again.
-
Yoge-Code commented at 3:25 PM on April 17, 2018: none
@jonasschnelli Thanks for your response. It doesn't work for me ! Here are the commands I tried:
brew uninstall openssl --ignore-dependencies brew uninstall --force openssl // delete all the versions, the whole openssl path were auto delete after executed this command. brew install openssl // openssl/1.0.2o_1 exists again, and now there is only this version.After openssl reinstalled , I have retried
make clean && ./autogen.sh && ./configure && make. But it complained the same error again. -
jonasschnelli commented at 4:28 PM on April 17, 2018: contributor
Can you pastbin your
config.log? Have you looked for other package managers like macports? -
Yoge-Code commented at 2:47 AM on April 18, 2018: none
@jonasschnelli It works!!!! I removed openssl and installed it using macports. Everything works well! Thank you very much!
-
Patrickxzm commented at 11:18 AM on June 4, 2018: none
Undefined symbols such as “_CRYPTO_num_locks” exist only in openssl1.0, not in openssl1.1. If a openssl1.1 was installed under /usr/local/lib and -L/usr/local/lib happens to stand before -L/usr/local/Cellar/openssl/1.0.2o/lib, then the linker will find and use the openssl1.1 following the search_libaray_paths. In openssl1.1, these symbols are undefined. Macports happens to overwrite the openssl1.1 library. @jonasschnelli @YG-FLUSH
- DrahtBot locked this on Sep 8, 2021