How to publish programs in Qt under Linux

1. Compile for release first

2. Enter the release directory in the qt directory, find the compiled executable program, and copy it to another empty folder

3. Create a .sh file in the folder with any name and write it in it

#!/bin/sh  
  
exe="Reader" #Published program name  
des="/home/yy/Desktop/readerc" #Your path  
  
deplist=$(ldd $exe | awk  '{if (match($3,"/")){ printf("%s "),$3 } }')  
cp $deplist $des

This is a script that automatically copies the dependent library files to this folder

4. Create a .sh file with the same name as the executable program and write

#!/bin/sh  
appname=`basename $0 | sed s,\.sh$,,`  
  
dirname=`dirname $0`  
tmp="${dirname#?}"  
  
if [ "${dirname%$tmp}" != "/" ]; then  
dirname=$PWD/$dirname  
be  
LD_LIBRARY_PATH=$dirname  
export LD_LIBRARY_PATH  
$dirname/$appname "$@"
5. Execute this sh script to run the program

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324480271&siteId=291194637