facebookincubator/velox

Undefined symbols for architecture x86_64: _EVP_MD_get_size

Closed this issue · 6 comments

Problem description

On a freshly cloned Velox repo, running make gives the error

[ 60%] Linking CXX executable velox_memory_test
ld: warning: directory not found for option '-L/usr/local/opt/protobuf@21/lib:-L/usr/local/opt/qt@5/lib:-L/usr/local/opt/bison/lib'
Undefined symbols for architecture x86_64:
  "_EVP_MD_get_size", referenced from:
      folly::ssl::OpenSSLHash::Digest::hash_final(folly::Range<unsigned char*>) in libvelox_functions_prestosql.a(BinaryFunctionsRegistration.cpp.o)
      folly::ssl::OpenSSLHash::Hmac::hash_final(folly::Range<unsigned char*>) in libvelox_functions_prestosql.a(BinaryFunctionsRegistration.cpp.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]: *** [velox/common/memory/tests/velox_memory_test] Error 1
make[1]: *** [velox/common/memory/tests/CMakeFiles/velox_memory_test.dir/all] Error 2
make: *** [all] Error 2

The problem was that the setup scripts installed OpenSSL@3 as a dependency of Python, which defines _EVP_MD_size. But Velox uses OpenSSL@1.1, in which it uses _EVP_MD_get_size not _EVP_MD_size. I.E. The program included OpenSSL header in OpenSSL@1, but was linked against OpenSSL@3.

This happens on my Intel MacOS with MacOSxSDK13.1.

Workaround

brew unlink openssl

But I wonder if there should be a proper fix for this? For example, shall we call brew unlink after brew installing the designated version in install_build_prerequisites() in setup-macos.sh?

cc @kgpai @Yuhta

System information

This is on MacOSxSDK13.1, this is because I met a bunch of more issues on MacOSxSDK13.3 when building Velox on Intel MacOS and therefore the revert.

Velox System Info v0.0.2
Commit: 14e0589
CMake Version: 3.26.4
System: Darwin-22.5.0
Arch: x86_64
C++ Compiler: /Library/Developer/CommandLineTools/usr/bin/c++
C++ Compiler Version: 14.0.0.14000029
C Compiler: /Library/Developer/CommandLineTools/usr/bin/cc
C Compiler Version: 14.0.0.14000029
CMake Prefix Path: /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr;/usr/local;/usr;/;/usr/local/Cellar/cmake/3.26.4;/usr/local;/usr/X11R6;/usr/pkg;/opt;/sw;/opt/local

CMake log

No response

kgpai commented

Can you paste the fully cmake logs to see if you are using bundled folly or system folly ?
Typically you can set OPENSSL_ROOT_DIR=/.../ without having to unlink from brew.
The ideal solution is to have folly use openssl@3 .

@kgpai does folly build with openssl@3 ? I thought we require openssl@1.1?

kgpai commented

@majetideepak No it doesnt ; Thus would be ideal if folly moved on from openssl 1.1 which was originally released roughly 8 years ago.

Surprisingly folly did build with OpenSSL 3.1.1 30 May 2023 on my Mac. There could be an issue with OpenSSL versions in between.

@kgpai I'm sorry I lost the full CMake log. This is not reproducible now after I unlink OpenSSL.

This is fixed now.