Ubuntu 编译 linuxdeployqt
博客 https://www.cnblogs.com/linuxAndMcu/p/11016322.html
安装依赖
sudo apt-get install git g++ libgl1-mesa-dev
配置Qt环境变量
没有安装vim 执行 sudo apt install vim 安装
vim ~/.bashrc中加入:
export PATH=/opt/Qt5.9.0/5.9/gcc_64/bin:$PATH
export LD_LIBRARY_PATH=/opt/Qt5.9.0/5.9/gcc_64/lib:$LD_LIBRARY_PATH
export QT_PLUGIN_PATH=/opt/Qt5.9.0/5.9/gcc_64/plugins:$QT_PLUGIN_PATH
export QML2_IMPORT_PATH=/opt/Qt5.9.0/5.9/gcc_64/qml:$QML2_IMPORT_PATH
source ~/.bashrc 立即执行
编译
git clone https://github.com/probonopd/linuxdeployqt.git
cd linuxdeployqt
vim tools/linuxdeployqt/main.cpp
修改main.cpp代码 大概在200行的位置
// openSUSE Leap 15.0 uses glibc 2.26 and is used on OBS
/if (strverscmp (glcv, “2.27”) >= 0) { //注释版本检查
qInfo() << “ERROR: The host system is too new.”;
qInfo() << “Please run on a system with a glibc version no newer than what comes with the oldest”;
qInfo() << “currently still-supported mainstream distribution (xenial), which is glibc 2.23.”;
qInfo() << “This is so that the resulting bundle will work on most still-supported Linux distributions.”;
qInfo() << “For more information, please see”;
qInfo() << “https://github.com/probonopd/linuxdeployqt/issues/340”;
return 1;
}/
执行
qmake
make -j
sudo make install
cd bin
sudo chmod a+x linuxdeployqt
sudo cp linuxdeployqt /usr/local/bin
编译 patchelf
git clone https://github.com/NixOS/patchelf.git
cd patchelf
./bootstrap.sh
./configure
make -j
make check
sudo make install
如果出现
autoreconf: not found
安装
sudo apt-get install autoconf automake libtool
sudo apt-get install libffi-dev
下载 AppImageKit
访问 https://github.com/AppImage/AppImageKit/releases
并下载,然后运行
cp appimagetool
sudo chmod a+x appimagetool
sudo mv appimagetool /usr/local/bin
打包应用程序
linuxdeployqt -appimage