MacOS下 QT 构建Release版本,把xxxx.app文件拷贝到别人电脑运行报错:
Application Specific Information: dyld: launch, loading dependent libraries Dyld Error Message: Library not loaded: @rpath/QtWidgets.framework/Versions/5/QtWidgets Referenced from: /private/var/folders/*/xxxxxxx.app/Contents/MacOS/xxxxxxx Reason: image not found Binary Images: 0x103ccf000 - 0x103cdaff3 +com.yourcompany.xxxxxxx (0) <6C4DEA60-88CE-37B6-940B-C793896F8E87> /var/folders/*/xxxxxxx.app/Contents/MacOS/xxxxxxx 0x113414000 - 0x11347e70f dyld (655.1.1) <DFC3C4AF-6F97-3B34-B18D-7DCB23F2A83A> /usr/lib/dyld Model: MacBookPro11,4, BootROM 194.0.0.0.0, 4 processors, Intel Core i7, 2.2 GHz, 16 GB, SMC 2.29f24 Graphics: kHW_IntelIrisProItem, Intel Iris Pro, spdisplays_builtin Memory Module: BANK 0/DIMM0, 8 GB, DDR3, 1600 MHz, 0x80AD, 0x484D54343147533642465238412D50422020 Memory Module: BANK 1/DIMM0, 8 GB, DDR3, 1600 MHz, 0x80AD, 0x484D54343147533642465238412D50422020 AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x152), Broadcom BCM43xx 1.0 (7.77.61.2 AirPortDriverBrcmNIC-1305.8) Bluetooth: Version 6.0.14d3, 3 services, 27 devices, 1 incoming serial ports Network Service: Wi-Fi, AirPort, en0 Serial ATA Device: APPLE SSD SM0256G, 251 GB USB Device: USB 3.0 Bus USB Device: 4-Port USB 3.0 Hub USB Device: USB 10/100/1000 LAN USB Device: Apple Internal Keyboard / Trackpad USB Device: Bluetooth USB Host Controller USB Device: 4-Port USB 2.0 Hub Thunderbolt Bus: MacBook Pro, Apple Inc., 27.1
搜索好久找到大把类似问题却无实用解决方法,最终想到去搜了下Mac软件发布过程,秒解!!
解决方法:
在QT安装目录下找到macdeployqt 文件,我的目录为/Users/bloguan/Qt5.13.0/5.13.0/clang_64/bin/macdeployqt 此文件为打包程序,命令为
macdeployqt xxx.app -dmg
注意macdeployqt 和 xxx.app 路径问题
执行结束后会在 xxx.app同级目录生成 dmg文件,这就是我们熟悉的MacOS软件的安装包,可以直接发布了
发表评论