Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linker error while building on macOS #279

Closed
skhaz opened this issue Nov 11, 2019 · 1 comment
Closed

Linker error while building on macOS #279

skhaz opened this issue Nov 11, 2019 · 1 comment

Comments

@skhaz
Copy link

skhaz commented Nov 11, 2019

ld: cannot link directly with dylib/framework, your binary is not an allowed client of /usr/lib/libcrypto.dylib for architecture x86_64
@syohex
Copy link
Contributor

syohex commented May 11, 2020

I'm not sure this is CMake issue or macOS issue or homebrew issue. CMake sets OPENSSL_LIBRARIES is "/usr/lib/libssl.dylib /usr/lib/libcrypto.dylib" even if OPENSSL_ROOT_DIR is set. (While OPENSSL_INCLUDE_DIR is set ${OPENSSL_ROOT_DIR}/include as expected)

I fixed this issue on my macOS catalina machine(Xcode11.4, cmake 3.17.2) with below patch.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3c25dba..6efca4a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -95,6 +95,11 @@ SET(TEST_EXES test-minicrypto.t)
 
 FIND_PACKAGE(OpenSSL)
 IF (OPENSSL_FOUND AND NOT (OPENSSL_VERSION VERSION_LESS "1.0.1"))
+    IF (APPLE)
+      IF (DEFINED ${OPENSSL_ROOT_DIR})
+        LINK_DIRECTORIES(${OPENSSL_ROOT_DIR}/lib)
+      ENDIF()
+    ENDIF()
     MESSAGE(STATUS "  Enabling OpenSSL support")
     INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
     ADD_LIBRARY(picotls-openssl lib/openssl.c)

@skhaz skhaz closed this as completed Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants