加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – Qt 5无法在SnowLeopard上部署

发布时间:2020-12-16 05:05:54 所属栏目:百科 来源:网络整理
导读:我有一个问题,我的应用程序不能在10.6 Snow Leopard上运行. 我用这些参数编译: qmake LSPRO.pro -r -spec macx-clang CONFIG+=release CONFIG+=x86_64 在我的Pro文件中,我有以下元素: TEMPLATE = appHEADERS = mainwindow.h app_mediamanager.h api.
我有一个问题,我的应用程序不能在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上未经测试但我认为这没问题.)

希望这有助于任何人.

解决方法

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读