Qt 5不能部署在SnowLeopard上 [英] Qt 5 cannot deploy on SnowLeopard

查看:157
本文介绍了Qt 5不能部署在SnowLeopard上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,我的应用程序不运行10.6雪豹。



我使用这些参数编译:

  qmake LSPRO.pro -r -spec macx-clang CONFIG + = release CONFIG + = x86_64 

我有这些元素:

  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错误消息:
库未加载:/usr/lib/libc++.1.dylib
引用自:/Users/username/Desktop/LSPRO.app/Contents/MacOS/../Frameworks/QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets
原因:找不到图片

问题很简单: Qt5 in 10.8?






更新1:



评论,它看起来像10.6没有与c + + 11支持,导致应用程序崩溃时查找它。我尝试了2个解决方案:



Failed solution1 :我用noc ++ 11标志重建Qt5,结果应用程序开始在snowleopard,内部元素在Qwebkit缺少视频播放器,无法调用外部二进制/执行命令(应用程序崩溃与EXC_BAD_ACCESS)虽然二进制只是运行良好时直接调用,可能更多未发现。



失败的解决方案2 :我试着天真地在snowleopard中包含缺少的dylibs(libc ++。1.dylib和libc ++ abi.dylib),但应用程序仍然崩溃的消息:



Dyld错误消息:
未找到符号:_NSPreferredScrollerStyleDidChangeNotification
引用自:/ Volumes / SANS TITRE / tests / LSPRO1.app / Contents / MacOS /../ Frameworks / QtWidgets.framework / Versions / 5 / QtWidgets
预期在:/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit






otool -L 5.1.0 rc1版本


$ $ b

  @executable_path /../ Frameworks / QtWebKitWidgets.framework / Versions / 5 / QtWebKitWidgets(兼容性版本5.1.0,当前版本5.1.0)
@ executable_path /../ Frameworks / QtQuick.framework / Versions / 5 / QtQuick(兼容性版本5.1.0,当前版本5.1.0)
@executable_path /../ Frameworks / QtQml.framework / Versions / 5 / QtQml (兼容性版本5.1.0,当前版本5.1.0)
@executable_path /../ Frameworks / QtNetwork.framework / Versions / 5 / QtNetwork(兼容性版本5.1.0,当前版本5.1.0)
@executable_path /../ Frameworks / QtCore.framework / Versions / 5 / QtCore(兼容性版本5.1.0,当前版本5.1.0)
@executable_path /../ Frameworks / QtGui.framework /版本/ 5 / QtGui(兼容性版本5.1.0,当前版本5.1.0)
@executable_path /../ Frameworks / QtOpenGL.framework / Versions / 5 / QtOpenGL(兼容性版本5.1.0,当前版本5.1.0)
@executable_path /../ Frameworks / QtWidgets.framework / Versions / 5 / QtWidgets(兼容性版本5.1.0,当前版本5.1.0)
@executable_path /../ Frameworks / QtPrintSupport.framework /版本/ 5 / QtPrintSupport(兼容性版本5.1.0,当前版本5.1.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa(兼容性版本1.0.0,当前版本19.0.0)
@executable_path /../ Frameworks / QtWebKit.framework / Versions / 5 / QtWebKit(兼容版本5.1.0,当前版本5.1.0)
@executable_path /../ Frameworks / QtSql.framework /版本/ 5 / QtSql(兼容性版本5.1.0,当前版本5.1.0)
@executable_path /../ Frameworks / QtSensors.framework / Versions / 5 / QtSensors(兼容性版本5.1.0, 0)
@executable_path /../ Frameworks / QtConcurrent.framework / Versions / 5 / QtConcurrent(兼容性版本5.1.0,当前版本5.1.0)
/System/Library/Frameworks/OpenGL.framework / Versions / A / OpenGL(兼容性版本1.0.0,当前版本1.0.0)
/System/Library/Frameworks/AGL.framework/Versions/A/AGL(兼容性版本1.0.0,当前版本1.0。 0)
/usr/lib/libstdc++.6.dylib(兼容性版本7.0.0,当前版本56.0.0)
/usr/lib/libSystem.B.dylib(兼容性版本1.0.0,当前版本169.3.0)






解决方案:



ok终于得到它的工作。
编译Qt5(5.1.2)在snowleopard从git(有xcode 4.2与10.6 sdk)
在我的情况下只需使用这些配置:

  ./ configure -developer-build -opensource -nomake examples -nomake tests -qt-sql-mysql 

我必须修复我的代码中的小元素,使应用程序崩溃没有理由(变量名称..),然后一切都确定。



只要不要忘记在10.6上使用mac部署工具,应用程序在10.8上运行ok(未测试在10.7,但我认为这是确定的。)



希望这个

解决方案

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

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


I have an issue where my app doesn't run on 10.6 Snow Leopard.

I compile with these parameters:

qmake LSPRO.pro -r -spec macx-clang CONFIG+=release CONFIG+=x86_64

in my Pro file, I have these elements:

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

But even with a simple Hello world or the example files, it doesn't work...

I add the libraries with macdeployqt script. When running on 10.6 I get this as error in the report:

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

The question is simple: How can I target 10.6 from a clean Qt5 in 10.8?


Update 1:

Thanks to the comments, it looks like 10.6 didn't shipped with c++11 support yet, causing the app to crash when looking for it. I tried 2 solutions:

Failed solution1 : I rebuild Qt5 with the noc++11 flag, the resulting app starts on snowleopard but fails some inner elements Videoplayer missing in Qwebkit, unable to call external binary /execute command (app crashes with EXC_BAD_ACCESS) although the binary just runs fine when called directly and probably more undiscovered.

Failed solution2 : I tried naively to include the missing dylibs (libc++.1.dylib and libc++abi.dylib) in snowleopard, but the app still crashes with the message :

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 of a 5.1.0 rc1 build

@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)


SOLUTION:

ok finally got it to work. Compiled Qt5 (5.1.2) on snowleopard from git (have xcode 4.2 with 10.6 sdk) in my case simply with these config:

./configure -developer-build -opensource -nomake examples -nomake tests -qt-sql-mysql

I had to fix small elements in my code making the app crash without reason (variable names..) and then everything was ok.

Just don't forget to use the mac deploy tool on 10.6 and the app runs ok on 10.8 (untested on 10.7 but I assume this is ok.)

Hope this helps anyone.

解决方案

The NSPreferredScrollerStyleDidChangeNotification notification is only available in OSX 10.7 and later, as noted at the bottom of this page:

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

Qt will conditionally compile OS X 10.7 APIs if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7. See e.g.:

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

Possibly the version of Qt you are using was not compiled with the 10.6 SDK.

There is a known issue: "To use Qt on or for 10.6, you need to build Qt yourself on a 10.6 machine":

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

这篇关于Qt 5不能部署在SnowLeopard上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆