linux源码编译qt6.5问题解决
创始人
2024-11-11 06:10:57
0

Qt编译版本问题

在编译一个项目时,发现ubuntu22 apt方式安装的默认时qt6.2。但是项目要求6.4,为了安装简单,升级ubuntu到了24,直接一键安装qt6.4.2。
开始编译了,一切正常进行中,突然报错,

#include  

找不到QtLogging头文件,一番查阅发现ubuntu 发布的qt6.4.2小版本不包括这个,小版本等级太低。
所以,只能通过源码编译了。

Qt源码编译

configure配置llvm问题解决

参考官方教程:
https://doc.qt.io/qt-6/linux-building.html,直接下个qt6.5试试。

mkdir -p ~/dev/qt-build cd ~/dev/qt-build /tmp/qt-everywhere-src-6.7.2/configure 

这里遇到一个问题,报错libclangBasic.a找不到,网上说安装libclang-dev就可以了。

sudo apt install libclang-dev 

然后发现还是找不到,怎么办…
我直接在/usr/lib/下找到了三个目录,llvm-14、llvm-15、llvm-18,搜索发现只有18目录下面有这个.a文件,所以设置下面的环境变量:

export LLVM_INSTALL_DIR=/usr/lib/llvm-18/ 

configure一键打通,完成。

build过程依赖缺失解决

现在开始build,又报错了…

cmake --build . --parallel cmake --install . 
/usr/bin/ld: qtbase/src/corelib/CMakeFiles/Core.dir/text/qstringconverter.cpp.o: in function `QStringConverterBase::State::reset()': qstringconverter.cpp:(.text+0x3567): undefined reference to `ucnv_reset_73' /usr/bin/ld: qtbase/src/corelib/CMakeFiles/Core.dir/text/qstringconverter.cpp.o: in function `QStringConverter::QStringConverter(char const*, QFlags)': qstringconverter.cpp:(.text+0x37d8): undefined reference to `ucnv_open_73' /usr/bin/ld: qstringconverter.cpp:(.text+0x381d): undefined reference to `ucnv_setToUCallBack_73' /usr/bin/ld: qstringconverter.cpp:(.text+0x3837): undefined reference to `ucnv_setFromUCallBack_73' /usr/bin/ld: qstringconverter.cpp:(.text+0x3850): undefined reference to `ucnv_getName_73' /usr/bin/ld: qstringconverter.cpp:(.text+0x3867): undefined reference to `ucnv_getStandardName_73' /usr/bin/ld: qstringconverter.cpp:(.text+0x3890): undefined reference to `ucnv_getMaxCharSize_73' /usr/bin/ld: qstringconverter.cpp:(.text+0x38eb): undefined reference to `ucnv_setToUCallBack_73' /usr/bin/ld: qstringconverter.cpp:(.text+0x3905): undefined reference to `ucnv_setFromUCallBack_73' /usr/bin/ld: qstringconverter.cpp:(.text+0x3928): undefined reference to `ucnv_getStandardName_73' /usr/bin/ld: qstringconverter.cpp:(.text+0x393c): undefined reference to `ucnv_close_73' 

网上说是anaconda环境base和本机冲突了,我直接deactiva anaconda base环境。发现没有解决。

which conda mv /home/xxx/miniconda3 /home/xxx/miniconda3_back 

然后编译,这个报错就解决了。

遇到下一个报错:

 error: ‘XKB_KEY_dead_lowline’ was not declared in this scope; did you mean ‘XKB_KEY_dead_belowring’? 

这是qt的一个bug,https://bugreports.qt.io/browse/QTBUG-117950
安装网址上,我下载的6.5.0没有修复,我直接下载6.6.3吧。

Fix Version/s: 5.15.16, 6.2.11, 6.5.4, 6.6.1, 6.7.0 FF 

我们configure的时候skip一些内容快一些:

sudo apt install gperf bison flex libvulkan-dev configure -prefix /usr/local -opensource -release -sysconfdir /etc/xdg -openssl -no-eglfs  -make libs -skip qtandroidextras -skip qtmacextras -skip qtwinextras -skip qtcanvas3d -skip qt3d -skip qtgraphicaleffects -skip qtpurchasing -confirm-license  

就可以成功编译安装了。

Qtwayland

我的项目需要QtWayland,https://stackoverflow.com/questions/42352743/how-to-build-qtwayland。

configure -feature-wayland-server 

QtWebEngine

QtWebEngine won't be built. Build requires nss >= 3.26. 
sudo apt-get install --reinstall libnss3-dev libnss3 libdrm-dev libcpuset-dev 

Qtpdf模块编译会报错,如果不需要这个模块,不编译QtWebEngine。
https://bugreports.qt.io/browse/QTBUG-113642

sudo apt install libcups2-dev 

然后会编译chromium,太慢了。直接在下面的链接找deb下载安装吧。
https://rsync.truman.edu/debian/pool/main/q/qt6-webengine/

相关内容

热门资讯

4分钟辅助!天天手游辅助工具,... 4分钟辅助!天天手游辅助工具,好像存在有辅助脚本(有挂秘诀)1、起透看视 天天手游辅助工具辅助软件价...
7分钟辅助!微乐小程序自建房辅... 7分钟辅助!微乐小程序自建房辅助,都是有辅助方法(有人有挂)1、玩家可以在微乐小程序自建房辅助线上大...
2分钟辅助!约局吧辅助器,本来... 2分钟辅助!约局吧辅助器,本来真的有辅助插件(的确有挂)1、约局吧辅助器破解器简单,约局吧辅助器机器...
三分钟辅助!微乐自建房辅助工具... 三分钟辅助!微乐自建房辅助工具,确实有辅助挂(存在有挂)1、很好的工具软件,可以解锁游戏的微乐自建房...
8分钟辅助!巴郎新疆开挂,一直... 8分钟辅助!巴郎新疆开挂,一直有辅助工具(有挂详情)1、巴郎新疆开挂透视辅助软件激活码多个强度级别选...
五分钟辅助!温州茶苑手机辅助器... 五分钟辅助!温州茶苑手机辅助器,好像真的有辅助软件(有挂技巧)1、每一步都需要思考,不同水平的挑战温...
两分钟辅助!白金岛手游的作弊码... 两分钟辅助!白金岛手游的作弊码,其实真的是有辅助挂(有挂细节)1、白金岛手游的作弊码免费辅助多个强度...
八分钟辅助!极速暗宝辅助,一贯... 八分钟辅助!极速暗宝辅助,一贯真的有辅助技巧(有挂神器)1、许多玩家不知道极速暗宝辅助辅助怎么退出观...
一分钟辅助!创乐源辅助软件,果... 一分钟辅助!创乐源辅助软件,果然有辅助工具(有挂讲解)1、一分钟辅助!创乐源辅助软件,果然有辅助工具...
8分钟辅助!微乐自建房辅助多少... 8分钟辅助!微乐自建房辅助多少钱一个月,真是真的是有辅助工具(有挂讲解)小薇(辅助器软件下载)致您一...