Skip to content

Troubleshooting known build issues

Yiqun (Ethan) Zhang edited this page Oct 31, 2023 · 2 revisions

[Native] MacOS Openssl _EVP_PKEY_get_bits undefined symbol

Observed issue

[80/85] Linking CXX executable bin/fizz-bogoshim
FAILED: bin/fizz-bogoshim
: && /Library/Developer/CommandLineTools/usr/bin/c++ -mcpu=apple-m1+crc -std=c++17 -fvisibility=hidden -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.0.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/BogoShim.dir/test/BogoShim.cpp.o -o bin/fizz-bogoshim  -Wl,-rpath,/opt/homebrew/lib  lib/libfizz.a  /opt/homebrew/Cellar/libsodium/1.0.18_1/lib/libsodium.dylib  /usr/local/lib/libfolly.a  /usr/local/lib/libfmt.a  /opt/homebrew/lib/libboost_context-mt.dylib  /opt/homebrew/lib/libboost_filesystem-mt.dylib  /opt/homebrew/lib/libboost_atomic-mt.dylib  /opt/homebrew/lib/libboost_program_options-mt.dylib  /opt/homebrew/lib/libboost_regex-mt.dylib  /opt/homebrew/lib/libboost_system-mt.dylib  /opt/homebrew/lib/libboost_thread-mt.dylib  /opt/homebrew/lib/libevent.dylib  /Library/Developer/CommandLineTools/SDKs/MacOSX13.0.sdk/usr/lib/libz.tbd  /Library/Developer/CommandLineTools/SDKs/MacOSX13.0.sdk/usr/lib/libbz2.tbd  /opt/homebrew/lib/liblz4.dylib  /opt/homebrew/lib/libsnappy.dylib  /opt/homebrew/lib/libsodium.dylib  -lc++abi  /opt/homebrew/opt/[email protected]/lib/libssl.dylib  /opt/homebrew/opt/[email protected]/lib/libcrypto.dylib  /Library/Developer/CommandLineTools/SDKs/MacOSX13.0.sdk/usr/lib/libz.tbd  /opt/homebrew/lib/libzstd.dylib  /opt/homebrew/lib/libglog.dylib  /opt/homebrew/lib/libgflags.2.2.2.dylib  /usr/local/lib/libdouble-conversion.a && :
Undefined symbols for architecture arm64:
  "_EVP_PKEY_get_bits", referenced from:
      folly::AsyncSSLSocket::getSSLCertSize() const in libfolly.a(AsyncSSLSocket.cpp.o)
  "_SSL_get1_peer_certificate", referenced from:
      folly::AsyncSSLSocket::getPeerCertificate() const in libfolly.a(AsyncSSLSocket.cpp.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Explanation

Homebrew has installed two versions of Openssl, version 1.1 and 3 (or later) due to package dependencies. Version 1.1 is required to be used for Prestissimo. Version 3 is now found in the system path. While the build script will link the library from version 1.1 it includes the headers from version 3 which changes the symbols that need to be provided by the library. Effectively, the issue is caused by a version mismatch of the header and library.

Check the installation by looking at what is installed using

% brew list | grep openssl
[email protected]
openssl@3

Workaround

Until the problem has been addressed in the CMake make files the following options exist:

  1. Uninstall openssl@3. This might cause issues with other programs installed that depend on this version.
  2. Prior to building Prestissimo unlink version 3 and link version 1.1. Then build, and once complete or version 3 is needed for other activities to be in the system path again, unlink version 1.1 and link version 3 again. This can be accomplished by the following commands:
brew unlink openssl@3
brew link [email protected]

and if needed

brew unlink [email protected]
brew link openssl@3

No apt package "ccache", but there is a snap with that nameTry "snap install ccache"

Make sure you have the following line in your /etc/apt/sources.list:

deb http:https://archive.ubuntu.com/ubuntu/ jammy universe
Clone this wiki locally