Skip to content

Commit e4e70e7

Browse files
committed
Resolve OpenSSL symlinks for install_name_tool -change
1 parent 19e65d9 commit e4e70e7

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
@@ -123,6 +123,13 @@ if(OPENSSL_ROOT STREQUAL "" AND DEFINED ENV{OPENSSL_ROOT})
123123
set(OPENSSL_ROOT "$ENV{OPENSSL_ROOT}" CACHE PATH "OpenSSL prefix" FORCE)
124124
endif()
125125

126+
# Resolve symlinks so install_name_tool -change matches the actual embedded paths
127+
if(OPENSSL_ROOT AND APPLE)
128+
file(REAL_PATH "${OPENSSL_ROOT}" OPENSSL_ROOT_REAL)
129+
else()
130+
set(OPENSSL_ROOT_REAL "${OPENSSL_ROOT}")
131+
endif()
132+
126133
# Deploy Qt -------------------------------------------------------------------
127134

128135
get_target_property(_qmake_executable Qt6::qmake IMPORTED_LOCATION)
@@ -220,11 +227,11 @@ elseif(APPLE)
220227
# Fix dylib identities
221228
COMMAND install_name_tool -id @rpath/libcrypto.3.dylib ${APP_DIR_NEW}/Contents/Frameworks/libcrypto.3.dylib
222229
COMMAND install_name_tool -id @rpath/libssl.3.dylib ${APP_DIR_NEW}/Contents/Frameworks/libssl.3.dylib
223-
# Fix libssl -> libcrypto reference
224-
COMMAND install_name_tool -change ${OPENSSL_ROOT}/lib/libcrypto.3.dylib @rpath/libcrypto.3.dylib ${APP_DIR_NEW}/Contents/Frameworks/libssl.3.dylib
230+
# Fix libssl -> libcrypto reference (use REAL path to match what's embedded in the binary)
231+
COMMAND install_name_tool -change ${OPENSSL_ROOT_REAL}/lib/libcrypto.3.dylib @rpath/libcrypto.3.dylib ${APP_DIR_NEW}/Contents/Frameworks/libssl.3.dylib
225232
# Fix openssl binary references and add rpath
226-
COMMAND install_name_tool -change ${OPENSSL_ROOT}/lib/libssl.3.dylib @rpath/libssl.3.dylib ${APP_DIR_NEW}/Contents/MacOS/openssl
227-
COMMAND install_name_tool -change ${OPENSSL_ROOT}/lib/libcrypto.3.dylib @rpath/libcrypto.3.dylib ${APP_DIR_NEW}/Contents/MacOS/openssl
233+
COMMAND install_name_tool -change ${OPENSSL_ROOT_REAL}/lib/libssl.3.dylib @rpath/libssl.3.dylib ${APP_DIR_NEW}/Contents/MacOS/openssl
234+
COMMAND install_name_tool -change ${OPENSSL_ROOT_REAL}/lib/libcrypto.3.dylib @rpath/libcrypto.3.dylib ${APP_DIR_NEW}/Contents/MacOS/openssl
228235
COMMAND install_name_tool -add_rpath @executable_path/../Frameworks ${APP_DIR_NEW}/Contents/MacOS/openssl
229236
DEPENDS deploy-qt
230237
COMMENT "Embedding openssl-tool"

0 commit comments

Comments
 (0)