Fsu0413 / QtCompile

Personal build of Qt5 onwards, with SSL builtin. Multiple configuration available.
https://build-qt.fsu0413.me/
100 stars 12 forks source link

macos qt6依赖库的路径不对 #29

Open ZeppLu opened 2 months ago

ZeppLu commented 2 months ago

macos环境不在身边贴不了截图,凭记忆写一下:

下载的macos qt6.7中,如果用otool -L lib/QtNetwork.framework/QtNetwork去查看qtnetwork的依赖,会发现其中有一项/Users/xxx/xxx/Qt_build_xxx/libssl.3.dylib(可能还有libcrypto.3.dylib)。这种依赖会导致换机器后运行crash,一般来说,是需要使用install_name_tool将这项改成@rpath/libssl.3.dylib或者@executable_path/../Frameworks/libssl.3.dylib之类的。

macos qt6.5中也有这种情况,不过发生在QtCore还是QtGui中,记不太清了

Fsu0413 commented 2 months ago

是有这个问题,而且我觉得可能是OpenSSL link时期的问题。 如果可以的话应该是用install_name_tool改一下OpenSSL里的内容,但是现在我还没拿出时间来测这个

OpenSSL的依赖在Qt 6.5应该也是在QtCore里,Qt 6.2应该是在tls plugin里,Qt 5.15及以前应该是在QtNetwork里

edit:Qt 5系列的macOS版用的是SecureTransport,当时是configure参数确定使用什么tls backend而不是现在的插件,所以Qt 5系列应该没有OpenSSL的问题 Qt 4.8用的是OpenSSL,依赖在QtNetwork里

ZeppLu commented 2 months ago

补充一下otool输出

MacBook-Pro ~ % otool -L Downloads/Qt6.5.3-macOS-Universal-AppleClang15.0.0/lib/QtCore.framework/QtCore
Downloads/Qt6.5.3-macOS-Universal-AppleClang15.0.0/lib/QtCore.framework/QtCore (architecture x86_64):
    @rpath/QtCore.framework/Versions/A/QtCore (compatibility version 6.0.0, current version 6.5.3)
    /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 2503.1.0)
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 2503.1.0)
    /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 2487.60.105)
    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 64.0.0)
    /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1226.0.0)
    /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 61123.121.1)
    /Users/fs/JenkinsMacOS/workspace/OpenSSL/o3_0mx6/buildDir/OpenSSL3.0.14-macOS-x86_64-AppleClang15.0.0/lib/libssl.3.dylib (compatibility version 3.0.0, current version 3.0.0)
    /Users/fs/JenkinsMacOS/workspace/OpenSSL/o3_0mx6/buildDir/OpenSSL3.0.14-macOS-x86_64-AppleClang15.0.0/lib/libcrypto.3.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1700.255.5)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1345.120.2)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
Downloads/Qt6.5.3-macOS-Universal-AppleClang15.0.0/lib/QtCore.framework/QtCore (architecture arm64):
    @rpath/QtCore.framework/Versions/A/QtCore (compatibility version 6.0.0, current version 6.5.3)
    /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 2503.1.0)
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 2503.1.0)
    /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 2487.60.105)
    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 64.0.0)
    /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1226.0.0)
    /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 61123.121.1)
    /Users/fs/JenkinsMacOS/workspace/OpenSSL/o3_0ma6/buildDir/OpenSSL3.0.14-macOS-arm64_v8a-AppleClang15.0.0/lib/libssl.3.dylib (compatibility version 3.0.0, current version 3.0.0)
    /Users/fs/JenkinsMacOS/workspace/OpenSSL/o3_0ma6/buildDir/OpenSSL3.0.14-macOS-arm64_v8a-AppleClang15.0.0/lib/libcrypto.3.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1700.255.5)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1345.120.2)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
MacBook-Pro ~ % otool -L Downloads/Qt6.7.2-macOS-Universal-AppleClang15.0.0/lib/QtNetwork.framework/QtNetwork
Downloads/Qt6.7.2-macOS-Universal-AppleClang15.0.0/lib/QtNetwork.framework/QtNetwork (architecture x86_64):
    @rpath/QtNetwork.framework/Versions/A/QtNetwork (compatibility version 6.0.0, current version 6.7.2)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 2503.1.0)
    /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 61123.121.1)
    @rpath/QtCore.framework/Versions/A/QtCore (compatibility version 6.0.0, current version 6.7.2)
    /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1226.0.0)
    /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration (compatibility version 1.0.0, current version 1300.120.2)
    /System/Library/Frameworks/CFNetwork.framework/Versions/A/CFNetwork (compatibility version 1.0.0, current version 1496.0.7)
    /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
    /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/GSS.framework/Versions/A/GSS (compatibility version 1.0.0, current version 1.0.0)
    /Users/fs/JenkinsMacOS/workspace/OpenSSL/o3_0mx6/buildDir/OpenSSL3.0.14-macOS-x86_64-AppleClang15.0.0/lib/libssl.3.dylib (compatibility version 3.0.0, current version 3.0.0)
    /Users/fs/JenkinsMacOS/workspace/OpenSSL/o3_0mx6/buildDir/OpenSSL3.0.14-macOS-x86_64-AppleClang15.0.0/lib/libcrypto.3.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1700.255.5)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1345.120.2)
Downloads/Qt6.7.2-macOS-Universal-AppleClang15.0.0/lib/QtNetwork.framework/QtNetwork (architecture arm64):
    @rpath/QtNetwork.framework/Versions/A/QtNetwork (compatibility version 6.0.0, current version 6.7.2)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 2503.1.0)
    /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 61123.121.1)
    @rpath/QtCore.framework/Versions/A/QtCore (compatibility version 6.0.0, current version 6.7.2)
    /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1226.0.0)
    /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration (compatibility version 1.0.0, current version 1300.120.2)
    /System/Library/Frameworks/CFNetwork.framework/Versions/A/CFNetwork (compatibility version 1.0.0, current version 1496.0.7)
    /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
    /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/GSS.framework/Versions/A/GSS (compatibility version 1.0.0, current version 1.0.0)
    /Users/fs/JenkinsMacOS/workspace/OpenSSL/o3_0ma6/buildDir/OpenSSL3.0.14-macOS-arm64_v8a-AppleClang15.0.0/lib/libssl.3.dylib (compatibility version 3.0.0, current version 3.0.0)
    /Users/fs/JenkinsMacOS/workspace/OpenSSL/o3_0ma6/buildDir/OpenSSL3.0.14-macOS-arm64_v8a-AppleClang15.0.0/lib/libcrypto.3.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1700.255.5)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1345.120.2)
Fsu0413 commented 2 months ago

(Step 1) https://github.com/Fsu0413/Fs-scripts/commit/5bffb285ebb603b11c18e449bcdbe819fef36003