h2o/picotls

undefined symbol _EVP_PKEY_get1_tls_encodedpoint

huitema opened this issue · 4 comments

On a compile test on MacOS, the version of openSSL installed is 1.1.1l, and on linking the aplication I get the following messages:

Undefined symbols for architecture x86_64:
  "_EVP_PKEY_get1_tls_encodedpoint", referenced from:
      _ptls_openssl_create_key_exchange in libpicotls-openssl.a(openssl.c.o)
      _evp_keyex_create in libpicotls-openssl.a(openssl.c.o)
  "_EVP_PKEY_id", referenced from:
      _ptls_openssl_create_key_exchange in libpicotls-openssl.a(openssl.c.o)
      _ptls_openssl_init_sign_certificate in libpicotls-openssl.a(openssl.c.o)
      _sign_certificate in libpicotls-openssl.a(openssl.c.o)
      _verify_sign in libpicotls-openssl.a(openssl.c.o)
  "_EVP_PKEY_set1_tls_encodedpoint", referenced from:
      _evp_keyex_on_exchange in libpicotls-openssl.a(openssl.c.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Documentation on Debian says: "The macro EVP_PKEY_get1_tls_encodedpoint() is deprecated and simply calls EVP_PKEY_get1_encoded_public_key() with all the same arguments. New applications should use EVP_PKEY_get1_encoded_public_key() instead."

The CMakeList has commands:

message(STATUS "root: ${OPENSSL_ROOT_DIR}")
message(STATUS "OpenSSL_VERSION: ${OPENSSL_VERSION}")
message(STATUS "OpenSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}")
message(STATUS "OpenSSL_LIBRARIES: ${OPENSSL_LIBRARIES}")

And output:

-- Found OpenSSL: /usr/local/Cellar/openssl@3/3.0.0_1/lib/libcrypto.dylib (found version "3.0.0")  
-- root: 
-- OpenSSL_VERSION: 3.0.0
-- OpenSSL_INCLUDE_DIR: /usr/local/Cellar/openssl@3/3.0.0_1/include
-- OpenSSL_LIBRARIES: /usr/local/Cellar/openssl@3/3.0.0_1/lib/libssl.dylib;/usr/local/Cellar/openssl@3/3.0.0_1/lib/libcrypto.dylib
-- Configuring done

Investigating some more. The log for building picotls says:

-- OpenSSL_VERSION: 1.1.1l

But the openSSL version found by the application is:

-- OpenSSL_VERSION: 3.0.0

Fixed. The application build script has a line:

export PKG_CONFIG_PATH="/usr/local/opt/openssl@3/lib/pkgconfig

Replaced it by

export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig

Which loaded the right libraries for compatibility with picotls. We might need to work on compatibility with Openssl3.0 later, but that's not necessary now.