X11/Linux下发布Qt程序(Deploying …
2014-04-24 14:09
387 查看
轉載請註明本文轉自 http://blog.sina.com.cn/s/blog_7a9ade2c0100vcfh.html
在X11平臺下發佈qt程序,首先準備好程序中需要使用的資源,庫和插件。。。
比如你的可運行程序取名叫作panel,那把你的panel,那些libQt*.so.4和libQt*.so.4.6.0(链接和共享库都要)放在同一目錄下(也可以不同,只要小小修改下shell文件).plugins就不多說了。
在程序的同目錄下,新建一個空文檔,取名panel.sh (文件名與程序名同名,擴展名為sh,shell文件).
在panel.sh中原封不動的寫入以下語句:
#!/bin/sh
appname=`basename $0 | sed s,\.sh$,,`
dirname=`dirname $0`
tmp="${dirname#?}"
if [ "${dirname%$tmp}" != "/" ]; then
dirname=$PWD/$dirname
fi
LD_LIBRARY_PATH=$dirname
export LD_LIBRARY_PATH
$dirname/$appname $*
保存文件,退出.在終端給文件+x屬性:
切換到程序的目錄,輸入
chmod +x panel.sh
然後運行shell文件就行了(确保panel程序具备X属性),它會自動更改環境變量,運行程序.
如果要調試shell文件,只需要在終端輸入:
sh -x panel.sh
這樣就ok了.
關於plugins,有以下3种處理方法:
# Using qt.conf. This is the recommended approach since it provides
the most flexibility.
# Using QApplication::addLibraryPath() or
QApplication::setLibraryPaths().
# Using a third party installation utility or the target system's
package manager to change the hard-coded paths in theQtCore
library.
第二种方法很簡單。qt.conf的方法也不錯.看看這個:
最簡單的qt.conf文件這樣寫就好了:(插件在當前文件夾下的plugins文件夾裏)
[Paths]
Prefix = .
Plugins = plugins
好了.大功告成!
在X11平臺下發佈qt程序,首先準備好程序中需要使用的資源,庫和插件。。。
比如你的可運行程序取名叫作panel,那把你的panel,那些libQt*.so.4和libQt*.so.4.6.0(链接和共享库都要)放在同一目錄下(也可以不同,只要小小修改下shell文件).plugins就不多說了。
在程序的同目錄下,新建一個空文檔,取名panel.sh (文件名與程序名同名,擴展名為sh,shell文件).
在panel.sh中原封不動的寫入以下語句:
#!/bin/sh
appname=`basename $0 | sed s,\.sh$,,`
dirname=`dirname $0`
tmp="${dirname#?}"
if [ "${dirname%$tmp}" != "/" ]; then
dirname=$PWD/$dirname
fi
LD_LIBRARY_PATH=$dirname
export LD_LIBRARY_PATH
$dirname/$appname $*
保存文件,退出.在終端給文件+x屬性:
切換到程序的目錄,輸入
chmod +x panel.sh
然後運行shell文件就行了(确保panel程序具备X属性),它會自動更改環境變量,運行程序.
如果要調試shell文件,只需要在終端輸入:
sh -x panel.sh
這樣就ok了.
關於plugins,有以下3种處理方法:
# Using qt.conf. This is the recommended approach since it provides
the most flexibility.
# Using QApplication::addLibraryPath() or
QApplication::setLibraryPaths().
# Using a third party installation utility or the target system's
package manager to change the hard-coded paths in theQtCore
library.
第二种方法很簡單。qt.conf的方法也不錯.看看這個:
Entry | Default Value |
---|---|
Prefix | QCoreApplication::applicationDirPath() |
Documentation | doc |
Headers | include |
Libraries | lib |
Binaries | bin |
Plugins | plugins |
Data | . |
Translations | translations |
Settings | . |
Examples | . |
Demos | . |
[Paths]
Prefix = .
Plugins = plugins
好了.大功告成!
相关文章推荐
- X11/Linux下发布Qt程序(Deploying …
- X11/Linux下发布Qt程序(Deploying Qt Applications for X11/Linux)
- X11/Linux下发布Qt程序(Deploying Qt Applications for X11/Linux)
- X11/Linux下发布Qt程序(Deploying Qt Applications for X11/Linux)
- X11/Linux下发布Qt程序(Deploying Qt Applications for X11/Linux)
- 修改qt程序的图标(for windows)
- QT5.4 计算器程序 打包&发布,解决dll的最新解决方案
- 如何将IOS App程序发布到苹果…
- Qt creator 添加C++源码程序报错
- QT程序移植 触摸屏和鼠标的支持
- QT5.4 计算器程序 打包&发布,解决dll的最新解决方案(图文并茂,很清楚)
- Qt5.5.1&VS2012程序发布-MSVCP110.dll, MSVCR110.dll
- 如何将IOS App程序发布到苹果… 分类: Android开发 2014-05-30 10:56 76人阅读 评论(0) 收藏
- Qt5.5.1&VS2012程序发布-不是有效的win32程序
- Qt5 中发布程序遇到could not find or load the Qt platform plugin "windows"
- iOS程序发布测试3-生成ad ho…
- 解析 Qt 程序在Windows 下发布
- Tribon Vitesse程序路径查找顺序
- Qt程序打包发布方法(使用官方提供的windeployqt工具)
- 在Mac系统下发布Qt程序详细教程