我遇到的问题是我的应用程序无法在 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 world 或示例文件,它也不起作用......
我使用 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 支持,导致应用程序在查找时崩溃。我尝试了2种解决方案:
失败解决方案1:我使用 noc++11 标志重建 Qt5,生成的应用程序在 Snowleopard 上启动,但失败了 Qwebkit 中缺少的一些内部元素 Videoplayer,无法调用外部二进制/执行命令(应用程序因 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
5.1.0 rc1 版本的 otool -L
@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 部署工具,并且该应用程序在 10.8 上运行正常(在 10.7 上未经测试,但我认为这是可以的。)
希望这对任何人都有帮助。