Ubuntu16.04  QT打包

Ubuntu16.04  QT打包

1.获取 app动态库  使用脚本

#!/bin/bash

LibDir=$PWD"/lib"
Target=$1

lib_array=($(ldd $Target | grep -o "/.*" | grep -o "/.*/[^[:space:]]*"))

$(mkdir $LibDir)

for Variable in ${lib_array[@]}
do
    cp "$Variable" $LibDir
done

Ubuntu 16.04.5和16.04.6库不一样

 #!/bin/bash  
appname=`basename $0 | sed s,\.sh$,,` 

dirname=`dirname $0` 
tmp="${dirname#?}" 

if [ "${dirname%$tmp}" != "/" ]; then 
	dirname=$PWD/$dirname 
fi 
OS_VER=$( cat /etc/issue )
OS_VERNUMB=${OS_VER:7:7}
if [ $OS_VERNUMB \> "16.04.5" ]; then 
	echo "ubuntu 16.04.6"
	export LD_LIBRARY_PATH=$dirname/lib6:$LD_LIBRARY_PATH
else
	echo "ubuntu 16.04.5"
	export LD_LIBRARY_PATH=$dirname/lib5:$LD_LIBRARY_PATH
fi 

#export LD_LIBRARY_PATH 
$dirname/$appname -qws "$@" 

2.app发布目录 拷贝qt  /Qt5.10.0/Tools/QtCreator/lib/Qt/plugins/platforms  /Qt5.10.0/Tools/QtCreator/lib/Qt/plugins/imageformats 插件库

3.发布目录打包 app.tar.gz 创建 run.sh

#!/bin/bash  
lines=6
tail -n +$lines $0 >/tmp/RosStudio.tar.gz
tar zxvf /tmp/RosStudio.tar.gz
exit 0

4.生成.run包   cat run.sh app.tar.gz > app.run

你可能感兴趣的:(QT)