一、环境
硬件平台:英伟达Xavier
系统版本:Ubuntu 18.04.3 LTS
Qt版本:Qt5.9.5
二、步骤
1、下载linuxdeployqt源码:
2、解压linuxdeployqt.zip:
unzip linuxdeployqt.zip
3、安装cmake与patchelf
sudo apt-get install cmake
sudo apt-get install patchelf
4、进入linuxdeployqt-master目录执行:
cmake CMakeList.txt
出现如下错误:
nvidia@tegra-ubuntu:~/linuxdeployqt-master$ cmake CMakeLists.txt fatal: not a git repository (or any of the parent directories): .git CMake Error at CMakeLists.txt:35 (message): Failed to determine git commit ID -- Configuring incomplete, errors occurred! See also "/home/nvidia/linuxdeployqt-master/CMakeFiles/CMakeOutput.log".
原因:不要在linuxdeployqt-master目录下执行cmake CMakeLists.txt ,而是进入linuxdeployqt-master/tools/linuxdeployqt/目录下执行cmake CMakeLists.txt。
5、进入 linuxdeployqt-master/tools/linuxdeployqt/目录执行:
cmake CMakeList.txt
6、在 linuxdeployqt-master/tools/linuxdeployqt/目录执行:
make
报错如下:
根据报错,打开main.cpp屏蔽52-53行代码。
再次编译。,提示生成linuxdeployqt。
7、修改权限
chmod 777 linuxdeployqt
8、将可执行文件放入 /usr/local/bin目录下
mv linuxdeployqt /usr/local/bin
9、测试是否安装成功
linuxdeployqt --version
输出如下信息 ,表示安装成功。
10、在 Qt的Release目录下使用linuxdeployqt复制依赖。
linuxdeployqt XXX -appimage
“XXX”是Qt的Release目录下的可执行文件名。