Skip to content

Commit 69a445b

Browse files
committed
Resolve OpenSSL symlinks for install_name_tool -change
1 parent b783956 commit 69a445b

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

src/CMakeLists.txt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ if(OPENSSL_ROOT STREQUAL "" AND DEFINED ENV{OPENSSL_ROOT})
7070
set(OPENSSL_ROOT "$ENV{OPENSSL_ROOT}" CACHE PATH "OpenSSL prefix" FORCE)
7171
endif()
7272

73+
# Resolve symlinks so install_name_tool -change matches the actual embedded paths
74+
if(OPENSSL_ROOT AND APPLE)
75+
file(REAL_PATH "${OPENSSL_ROOT}" OPENSSL_ROOT_REAL)
76+
else()
77+
set(OPENSSL_ROOT_REAL "${OPENSSL_ROOT}")
78+
endif()
79+
7380
# Deploy Qt -------------------------------------------------------------------
7481

7582
get_target_property(_qmake_executable Qt6::qmake IMPORTED_LOCATION)
@@ -153,11 +160,11 @@ elseif(APPLE)
153160
# Fix dylib identities
154161
COMMAND install_name_tool -id @rpath/libcrypto.3.dylib ${APP_DIR_NEW}/Contents/Frameworks/libcrypto.3.dylib
155162
COMMAND install_name_tool -id @rpath/libssl.3.dylib ${APP_DIR_NEW}/Contents/Frameworks/libssl.3.dylib
156-
# Fix libssl -> libcrypto reference
157-
COMMAND install_name_tool -change ${OPENSSL_ROOT}/lib/libcrypto.3.dylib @rpath/libcrypto.3.dylib ${APP_DIR_NEW}/Contents/Frameworks/libssl.3.dylib
163+
# Fix libssl -> libcrypto reference (use REAL path to match what's embedded in the binary)
164+
COMMAND install_name_tool -change ${OPENSSL_ROOT_REAL}/lib/libcrypto.3.dylib @rpath/libcrypto.3.dylib ${APP_DIR_NEW}/Contents/Frameworks/libssl.3.dylib
158165
# Fix openssl binary references and add rpath
159-
COMMAND install_name_tool -change ${OPENSSL_ROOT}/lib/libssl.3.dylib @rpath/libssl.3.dylib ${APP_DIR_NEW}/Contents/MacOS/openssl
160-
COMMAND install_name_tool -change ${OPENSSL_ROOT}/lib/libcrypto.3.dylib @rpath/libcrypto.3.dylib ${APP_DIR_NEW}/Contents/MacOS/openssl
166+
COMMAND install_name_tool -change ${OPENSSL_ROOT_REAL}/lib/libssl.3.dylib @rpath/libssl.3.dylib ${APP_DIR_NEW}/Contents/MacOS/openssl
167+
COMMAND install_name_tool -change ${OPENSSL_ROOT_REAL}/lib/libcrypto.3.dylib @rpath/libcrypto.3.dylib ${APP_DIR_NEW}/Contents/MacOS/openssl
161168
COMMAND install_name_tool -add_rpath @executable_path/../Frameworks ${APP_DIR_NEW}/Contents/MacOS/openssl
162169
DEPENDS deploy-qt
163170
COMMENT "Embedding openssl-tool"

0 commit comments

Comments
 (0)