• 13333阅读
  • 20回复

mac qt程序如何发布? [复制链接]

上一主题 下一主题
离线aiolia0122
 

只看楼主 倒序阅读 楼主  发表于: 2012-03-20
关键词: mac发布
本机安装了qt creator编译生成release版本的exe在本机可以运行,在别的mac上(没有安装qt creator)运行不了,加载QtCore失败,请问我要怎么能使程序运行起来呢?
离线淳于半邪

只看该作者 1楼 发表于: 2012-03-20
少了库文件Qt4Core.dll吧,拷过去就行了;还有个Qt4Gui.dll
离线aiolia0122

只看该作者 2楼 发表于: 2012-03-20
在mac 系统好像没有Qt4Core.dll
离线uidab

只看该作者 3楼 发表于: 2012-03-20
在MacOS的终端下输入  macdeployqt    your.app   然后得到的app包就包括所有你需要的库。当然也可以用其他工具加入你想加入的库。
有时候为了工作直接获得答案,而我却失去了思考的乐趣!


飘啊飘,何时能安居!
离线aiolia0122

只看该作者 4楼 发表于: 2012-03-21
回 3楼(uidab) 的帖子
我是在10.7上开发,按照你说的在终端输入macdeployqt    DashBoard.app, 出现如下错误:
ERROR: "install_name_tool: object: /Applications/DashBoard.app/Contents/MacOS/DashBoard malformed object (unknown load command 8)
"
ERROR: ""
ERROR: could not create destination directory "/Applications/DashBoard.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui"
ERROR: "install_name_tool: object: /Applications/DashBoard.app/Contents/MacOS/DashBoard malformed object (unknown load command 8)
"
ERROR: ""
ERROR: could not create destination directory "/Applications/DashBoard.app/Contents/Frameworks/QtNetwork.framework/Versions/4/QtNetwork"
ERROR: "install_name_tool: object: /Applications/DashBoard.app/Contents/MacOS/DashBoard malformed object (unknown load command 8)
"
ERROR: ""
ERROR: could not create destination directory "/Applications/DashBoard.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore"
ERROR: file copy failed from "/Users/sunhunter/QtSDK/Desktop/Qt/474/gcc/plugins/accessible/libqtaccessiblewidgets.dylib"
ERROR:  to "/Applications/DashBoard.app/Contents/PlugIns/accessible/libqtaccessiblewidgets.dylib"
ERROR: file copy failed from "/Users/sunhunter/QtSDK/Desktop/Qt/474/gcc/plugins/bearer/libqgenericbearer.dylib"
ERROR:  to "/Applications/DashBoard.app/Contents/PlugIns/bearer/libqgenericbearer.dylib"
ERROR: file copy failed from "/Users/sunhunter/QtSDK/Desktop/Qt/474/gcc/plugins/codecs/libqcncodecs.dylib"
ERROR:  to "/Applications/DashBoard.app/Contents/PlugIns/codecs/libqcncodecs.dylib"
ERROR: file copy failed from "/Users/sunhunter/QtSDK/Desktop/Qt/474/gcc/plugins/codecs/libqjpcodecs.dylib"
ERROR:  to "/Applications/DashBoard.app/Contents/PlugIns/codecs/libqjpcodecs.dylib"
ERROR: file copy failed from "/Users/sunhunter/QtSDK/Desktop/Qt/474/gcc/plugins/codecs/libqkrcodecs.dylib"
ERROR:  to "/Applications/DashBoard.app/Contents/PlugIns/codecs/libqkrcodecs.dylib"
ERROR: file copy failed from "/Users/sunhunter/QtSDK/Desktop/Qt/474/gcc/plugins/codecs/libqtwcodecs.dylib"
ERROR:  to "/Applications/DashBoard.app/Contents/PlugIns/codecs/libqtwcodecs.dylib"
ERROR: file copy failed from "/Users/sunhunter/QtSDK/Desktop/Qt/474/gcc/plugins/graphicssystems/libqtracegraphicssystem.dylib"
ERROR:  to "/Applications/DashBoard.app/Contents/PlugIns/graphicssystems/libqtracegraphicssystem.dylib"
ERROR: file copy failed from "/Users/sunhunter/QtSDK/Desktop/Qt/474/gcc/plugins/imageformats/libqgif.dylib"
ERROR:  to "/Applications/DashBoard.app/Contents/PlugIns/imageformats/libqgif.dylib"
ERROR: file copy failed from "/Users/sunhunter/QtSDK/Desktop/Qt/474/gcc/plugins/imageformats/libqico.dylib"
ERROR:  to "/Applications/DashBoard.app/Contents/PlugIns/imageformats/libqico.dylib"
ERROR: file copy failed from "/Users/sunhunter/QtSDK/Desktop/Qt/474/gcc/plugins/imageformats/libqjpeg.dylib"
ERROR:  to "/Applications/DashBoard.app/Contents/PlugIns/imageformats/libqjpeg.dylib"
ERROR: file copy failed from "/Users/sunhunter/QtSDK/Desktop/Qt/474/gcc/plugins/imageformats/libqmng.dylib"
ERROR:  to "/Applications/DashBoard.app/Contents/PlugIns/imageformats/libqmng.dylib"
ERROR: file copy failed from "/Users/sunhunter/QtSDK/Desktop/Qt/474/gcc/plugins/imageformats/libqtiff.dylib"
ERROR:  to "/Applications/DashBoard.app/Contents/PlugIns/imageformats/libqtiff.dylib"
ERROR: file copy failed from "/Users/sunhunter/QtSDK/Desktop/Qt/474/gcc/plugins/qmltooling/libqmldbg_tcp.dylib"
ERROR:  to "/Applications/DashBoard.app/Contents/PlugIns/qmltooling/libqmldbg_tcp.dylib"
离线aiolia0122

只看该作者 5楼 发表于: 2012-03-21
回 4楼(aiolia0122) 的帖子
这错误是什么原因呢?
离线uidab

只看该作者 6楼 发表于: 2012-03-21
回 4楼(aiolia0122) 的帖子
我也在10.7上开发的,没遇见过这个错误。

不过看样子你已经打过包。你可以删除原来的app然后用qt重新编译后,在终端下再试试!
有时候为了工作直接获得答案,而我却失去了思考的乐趣!


飘啊飘,何时能安居!
离线aiolia0122

只看该作者 7楼 发表于: 2012-03-21
回 6楼(uidab) 的帖子
我重新编译了,终端命令如下,还是有错误
sunhunters-MacBook-Pro:GUILayer sunhunter$ /Users/sunhunter/QtSDK/Desktop/Qt/474/gcc/bin/macdeployqt DashBoard.app
ERROR: "install_name_tool: object: DashBoard.app/Contents/MacOS/DashBoard malformed object (unknown load command 8)
"
ERROR: ""
ERROR: "install_name_tool: object: DashBoard.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui malformed object (unknown load command 5)
"
ERROR: ""
ERROR: "install_name_tool: object: DashBoard.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui malformed object (unknown load command 5)
"
ERROR: ""
ERROR: "install_name_tool: object: DashBoard.app/Contents/MacOS/DashBoard malformed object (unknown load command 8)
"
ERROR: ""
ERROR: "install_name_tool: object: DashBoard.app/Contents/Frameworks/QtNetwork.framework/Versions/4/QtNetwork malformed object (unknown load command 5)
"
ERROR: ""
ERROR: "install_name_tool: object: DashBoard.app/Contents/Frameworks/QtNetwork.framework/Versions/4/QtNetwork malformed object (unknown load command 5)
"
ERROR: ""
ERROR: "install_name_tool: object: DashBoard.app/Contents/MacOS/DashBoard malformed object (unknown load command 8)
"
ERROR: ""
ERROR: "install_name_tool: object: DashBoard.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore malformed object (unknown load command 5)
"
ERROR: ""
ERROR: "install_name_tool: object: DashBoard.app/Contents/PlugIns/accessible/libqtaccessiblewidgets.dylib malformed object (unknown load command 5)
"
ERROR: ""
ERROR: "install_name_tool: object: DashBoard.app/Contents/PlugIns/accessible/libqtaccessiblewidgets.dylib malformed object (unknown load command 5)
"
ERROR: ""



(unknown load command 8)
  和(unknown load command 5)
是什么错误
离线uidab

只看该作者 8楼 发表于: 2012-03-21
回 7楼(aiolia0122) 的帖子
你的Xcode和qt都安装好了??
你在终端里面输入 man install_name_tool, 看看有这个命令吗?
有时候为了工作直接获得答案,而我却失去了思考的乐趣!


飘啊飘,何时能安居!
离线aiolia0122

只看该作者 9楼 发表于: 2012-03-21
回 8楼(uidab) 的帖子
xcode安装的4.1版本,安装的qt creator 2.3.0,  基于Qt 4.7.4(64 bit), 在终端man install_name_tool,
sunhunters-MacBook-Pro:GUILayer sunhunter$ man install_name_tool

INSTALL_NAME_TOOL(1)                                                                                 INSTALL_NAME_TOOL(1)

NAME
       install_name_tool - change dynamic shared library install names

SYNOPSIS
       install_name_tool [-change old new ] ... [-rpath old new ] ... [-add_rpath new ] ... [-delete_rpath new ] ... [-id
       name] file

DESCRIPTION
       Install_name_tool changes the dynamic shared library install names and or adds,  changes  or  deletes  the  rpaths
       recorded  in a Mach-O binary.  For this tool to work when the install names or rpaths are larger the binary should
       be built with the ld(1) -headerpad_max_install_names option.

       -change old new
              Changes the dependent shared library install name old to new in the specified Mach-O binary.  More than one
              of  these options can be specified.  If the Mach-O binary does not contain the old install name in a speci-
              fied -change option the option is ignored.

       -id name
              Changes the shared library identification name of a dynamic shared library to name.  If the  Mach-O  binary
              is not a dynamic shared library and the -id option is specified it is ignored.

       -rpath old new
              Changes  the rpath path name old to new in the specified Mach-O binary.  More than one of these options can
              be specified.  If the Mach-O binary does not contain the old rpath path name in a specified -rpath it is an
              error.

       -add_rpath new
              Adds  the rpath path name new in the specified Mach-O binary.  More than one of these options can be speci-
              fied.  If the Mach-O binary already contains the new rpath path name  specified  in  -add_rpath  it  is  an
              error.

       -delete_rpath old
              deletes  the  rpath  path  name  old in the specified Mach-O binary.  More than one of these options can be
              specified.  If the Mach-O binary does not contains the old rpath path name specified in -delete_rpath it is
              an error.
离线uidab

只看该作者 10楼 发表于: 2012-03-21
回 9楼(aiolia0122) 的帖子
你试个简单点的Qt GUI程序 (比如就一个界面),打包时我没遇到过任何问题。只有在加自己的dylib时用到install_name_tool(似乎还有别的方法)!
有时候为了工作直接获得答案,而我却失去了思考的乐趣!


飘啊飘,何时能安居!
离线bayerfly

只看该作者 11楼 发表于: 2012-04-05
QT的帮助里有一篇关于mac发布的,搜索deploy
离线shiziyang

只看该作者 12楼 发表于: 2012-04-10
跑那个终端命令时有cd到程序那个目录下吗?或者程序名最好写全路径
离线uidab

只看该作者 13楼 发表于: 2012-05-05
Re:回 4楼(aiolia0122) 的帖子
引用第5楼aiolia0122于2012-03-21 14:28发表的 回 4楼(aiolia0122) 的帖子 :
这错误是什么原因呢?


想起你这个错误了,很可能是上次已经把需要的库打包了,所以这次就是fail
有时候为了工作直接获得答案,而我却失去了思考的乐趣!


飘啊飘,何时能安居!
离线aiolia0122

只看该作者 14楼 发表于: 2012-05-07
我创建了一个最简单的GUI程序,编译完成生成appname.app,在终端输入 macdeployqt appname.app/ -verbose=1 -dmg, 还是出现那些错误,应该不是上次已经把需要的库打包了,所以这次就是fail
离线uidab

只看该作者 15楼 发表于: 2012-05-07
引用第14楼aiolia0122于2012-05-07 13:40发表的  :
我创建了一个最简单的GUI程序,编译完成生成appname.app,在终端输入 macdeployqt appname.app/ -verbose=1 -dmg, 还是出现那些错误,应该不是上次已经把需要的库打包了,所以这次就是fail  


先不加 -dmg
有时候为了工作直接获得答案,而我却失去了思考的乐趣!


飘啊飘,何时能安居!
离线aiolia0122

只看该作者 16楼 发表于: 2012-05-11
uidab,请看这个网址:http://www.qtcentre.org/archive/index.php/t-45663.html?s=f54d78740b32b51c19ebd38c565caf3d,你说你的10.7用macdeployqt 没有问题,请问你的mac os系统,安装的qt,还有xcode具体分别是什么版本
离线uidab

只看该作者 17楼 发表于: 2012-05-14
回 16楼(aiolia0122) 的帖子
Mac10.6.8 和10.7.2都试过!
10.6.8上的XCode是3.2.5 , Qt 是4.7.0
10.7.2上的XCode是4,具体版本晚上给你查查吧, Qt是一样的。
你给我的那个链接已经说了解决方法

Problem solved for anyone else who might encounter this error:

Upgraded to OS 10.6.8
Upgraded to Qt 4.7.4
Upgraded to Xcode 3.2
有时候为了工作直接获得答案,而我却失去了思考的乐趣!


飘啊飘,何时能安居!
离线aiolia0122

只看该作者 18楼 发表于: 2012-05-14
回 17楼(uidab) 的帖子
我下载了Qt_SDK_Mac64_offline_v1_1_3_en.dmg,这个是针对64位系统的,我换了台mac,是32位的,要怎么样才能安装到32位系统上?
离线uidab

只看该作者 19楼 发表于: 2012-05-14
回 18楼(aiolia0122) 的帖子
这个不清楚, 要知道以前MacOS都不支持Inter的CPU,32位的苹果太老了!!
有时候为了工作直接获得答案,而我却失去了思考的乐趣!


飘啊飘,何时能安居!
离线iptton

只看该作者 20楼 发表于: 2012-05-24
引用第14楼aiolia0122于2012-05-07 13:40发表的  :
我创建了一个最简单的GUI程序,编译完成生成appname.app,在终端输入 macdeployqt appname.app/ -verbose=1 -dmg, 还是出现那些错误,应该不是上次已经把需要的库打包了,所以这次就是fail  

应该是这原因,我的解决方法是:把appname.app这个目录删除掉,再重新build过,然后再执行打包命令
[url] http://www.alloyteam.com/2012/05/web-front-end-tool-rythem-1/ [url]
快速回复
限100 字节
 
上一个 下一个