我有一个问题,我的应用程序不能在10.6 Snow Leopard上运行.
我用这些参数编译:
qmake LSPRO.pro -r -spec macx-clang CONFIG+=release CONFIG+=x86_64
在我的Pro文件中,我有以下元素:
TEMPLATE = app HEADERS = \ mainwindow.h \ app_mediamanager.h \ api.h \ tool_htmleditor.h \ tool_videoencoder.h \ tool_thumbnaileditor.h SOURCES = \ main.cpp \ mainwindow.cpp \ app_mediamanager.cpp \ api.cpp \ tool_htmleditor.cpp \ tool_videoencoder.cpp \ tool_thumbnaileditor.cpp QT += network webkitwidgets widgets concurrent sql QMAKE_CXXFLAGS_X86_64 += -mmacosx-version-min=10.6 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 ICON = icon.icns RESOURCES = lspro.qrc
但即使使用简单的Hello世界或示例文件,它也不起作用……
我用macdeployqt脚本添加库.
在10.6上运行时,我在报告中将其视为错误:
Dyld Error Message: Library not loaded: /usr/lib/libc++.1.dylib Referenced from: /Users/username/Desktop/LSPRO.app/Contents/MacOS/../Frameworks/QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets Reason: image not found
问题很简单:如何从10.8的干净Qt5中瞄准10.6?
更新1:
感谢评论,看起来10.6没有附带c 11支持,导致应用程序在查找时崩溃.我试过两个解决方案:
解决方案失败1:我使用noc 11标志重建Qt5,生成的应用程序在snowleopard上启动但是在Qwebkit中丢失了一些内部元素Videoplayer,无法调用外部二进制/执行命令(app崩溃与EXC_BAD_ACCESS)尽管二进制文件在调用时运行正常直接而且可能更未被发现.
解决方案2失败:我天真地尝试在snowleopard中包含丢失的dylib(libc .1.dylib和libc abi.dylib),但该应用程序仍然崩溃并显示以下消息:
Dyld Error Message: Symbol not found: _NSPreferredScrollerStyleDidChangeNotification Referenced from: /Volumes/SANS TITRE/tests/LSPRO1.app/Contents/MacOS/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets Expected in: /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
otool -L 5.1.0 rc1版本
@executable_path/../Frameworks/QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets (compatibility version 5.1.0,current version 5.1.0) @executable_path/../Frameworks/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.1.0,current version 5.1.0) @executable_path/../Frameworks/QtQml.framework/Versions/5/QtQml (compatibility version 5.1.0,current version 5.1.0) @executable_path/../Frameworks/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.1.0,current version 5.1.0) @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore (compatibility version 5.1.0,current version 5.1.0) @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui (compatibility version 5.1.0,current version 5.1.0) @executable_path/../Frameworks/QtOpenGL.framework/Versions/5/QtOpenGL (compatibility version 5.1.0,current version 5.1.0) @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.1.0,current version 5.1.0) @executable_path/../Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport (compatibility version 5.1.0,current version 5.1.0) /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0,current version 19.0.0) @executable_path/../Frameworks/QtWebKit.framework/Versions/5/QtWebKit (compatibility version 5.1.0,current version 5.1.0) @executable_path/../Frameworks/Qtsql.framework/Versions/5/Qtsql (compatibility version 5.1.0,current version 5.1.0) @executable_path/../Frameworks/QtSensors.framework/Versions/5/QtSensors (compatibility version 5.1.0,current version 5.1.0) @executable_path/../Frameworks/QtConcurrent.framework/Versions/5/QtConcurrent (compatibility version 5.1.0,current version 5.1.0) /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0,current version 1.0.0) /System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0,current version 1.0.0) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0,current version 56.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,current version 169.3.0)
解:
好吧终于搞定了.
在git的snowleopard上编译Qt5(5.1.2)(xcode 4.2和10.6 sdk)
在我的情况下,只需使用这些配置:
./configure -developer-build -opensource -nomake examples -nomake tests -qt-sql-MysqL
我不得不修复我的代码中的小元素,使应用程序无故失败(变量名称..)然后一切都很好.
只是不要忘记在10.6上使用mac deploy工具,应用程序在10.8上运行正常(在10.7上未经测试但我认为这没问题.)
希望这有助于任何人.