Qt 5无法在SnowLeopard上部署

Vin*_*rez 5 c++ qt osx-snow-leopard osx-mountain-lion qt5

我有一个问题,我的应用程序不能在10.6 Snow Leopard上运行.

我用这些参数编译:

qmake LSPRO.pro -r -spec macx-clang CONFIG+=release CONFIG+=x86_64
Run Code Online (Sandbox Code Playgroud)

在我的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
Run Code Online (Sandbox Code Playgroud)

但即使使用简单的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
Run Code Online (Sandbox Code Playgroud)

问题很简单:如何从10.8的干净Qt5中瞄准10.6?


更新1:

感谢评论,看起来10.6没有附带c ++ 11支持,导致应用程序在查找时崩溃.我试过两个解决方案:

解决方案失败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
Run Code Online (Sandbox Code Playgroud)

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)
Run Code Online (Sandbox Code Playgroud)

解:

好吧终于搞定了.在我的案例中使用这些配置编译来自git的snowleopard上的Qt5(5.1.2)(xcode 4.2和10.6 sdk):

./configure -developer-build -opensource -nomake examples -nomake tests -qt-sql-mysql
Run Code Online (Sandbox Code Playgroud)

我不得不修复我的代码中的小元素,使应用程序无故失败(变量名称..)然后一切都很好.

只是不要忘记在10.6上使用mac deploy工具,应用程序在10.8上运行正常(在10.7上未经测试但我认为这没问题.)

希望这有助于任何人.

Ros*_*ina 2

NSPreferredScrollerStyleDidChangeNotification 通知仅在 OSX 10.7 及更高版本中可用,如本页底部所述:

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSScroller_Class/Reference/Reference.html

如果 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7,Qt 将有条件地编译 OS X 10.7 API。参见例如:

http://qt.gitorious.org/qt/qtbase/blobs/b9826799405293ee5969015eed37957daad198ee/src/widgets/styles/qmacstyle_mac.mm

您使用的 Qt 版本可能不是使用 10.6 SDK 编译的。

有一个已知问题:“要在 10.6 上使用 Qt,您需要在 10.6 机器上自行构建 Qt”:

http://qt-project.org/wiki/Qt500KnownIssues