解决linuxdeployqt报错——系统版本过新的问题

参考文章:https://icode.best/i/45016240865860
目前测试有效

大概你会跳转到这个议题
issues#340

显示这样类似的报错

linuxdeployqt 5 (commit fc64c50), build 609 built on 2019-01-06 03:55:18 UTC
Please run on a system no newer than the oldest still-supported Ubuntu LTS release.
This is so that the resulting bundle can run on all still-supported releases of Ubuntu.

嘛,就是嫌弃你系统新,没事,这有个好办法。

解决办法

暴力改源代码,来,跟着我学着做。

git clone https://github.com/probonopd/linuxdeployqt.git
cd ./linuxdeployqt/tools/linuxdeployqt
vim main.cpp      # 这里可以选你自己喜欢的编辑器

然后大约在203行,找到

        // openSUSE Leap 15.0 uses glibc 2.26 and is used on OBS
        // Ubuntu Xenial (16.04) uses glibc 2.23
        // Ubuntu Bionic (18.04) uses glibc 2.27
        if (strverscmp (glcv, "2.28") >= 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 (Ubuntu Bionic), which is glibc 2.27.";
            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;
        }

这个就是罪魁祸首,你可以注释掉它,删了也行,随便你。
这里用的是改数字的方式,把2.28改成10。(我自己当时是直接删了)

然后就在这个目录执行

cd ./../../        #跳转到项目根目录
cmake .
cmake --build .
cd ./tool/linuxdeployqt
./linuxdeployqt -v

当然,你可以这样安装。
在linuxdeployqt所在的目录,执行

cp ./linuxdeployqt /usr/local/bin/linuxdeployqt

这样就大功告成了

posted @ 2022-07-03 18:34  Leeds_Garden  阅读(1424)  评论(0编辑  收藏  举报