Qt5-base 5.15 build fails with llvm+clang
-
I'm attempting to build qt5-base on a Linux machine. I previously could build successfully using GCC 10. I recently switched the whole system to LLVM (clang, lld, etc.) and am hitting a build error I'm not sure how to tackle.
Below is the build log.
http://ix.io/2oUDThe specific error occurs in QtNetwork:
src/network/socket/qnet_unix_p.h:120:29: error: cannot initialize a parameter of type 'socklen_t *' (aka 'unsigned int *') with an rvalue of type 'int *'
Unfortunately I don't know C(PP), do I can't particularly parse this.
I'm using llvm 10. To avoid other errors I found I had to manually specify the platform as linux-clang-libc++.
-
Hi and welcome to devnet,
Can you give more information about your Linux setup ?
What distribution ?
What package did you install ?
What configure options did you use exactly ? -
Hi and welcome to devnet,
Can you give more information about your Linux setup ?
What distribution ?
What package did you install ?
What configure options did you use exactly ?I'm using KISS linux, just a simple musl-based, source distro.
I'm building qt5 from source (qt5-base-everywhere-src-5.15.0.tar.xz); this is exactly what I'm doing to build it:# Don't link against execinfo.h. sed -i 's/define QLOG/define N/g' \ ./src/corelib/global/qlogging.cpp ./configure \ -confirm-license \ -opensource \ -prefix /usr \ -docdir /usr/share/doc/qt \ -headerdir /usr/include/qt \ -archdatadir /usr/lib/qt \ -datadir /usr/share/qt \ -sysconfdir /etc/xdg \ -examplesdir /usr/share/doc/qt/examples \ -nomake examples \ -nomake tests \ -platform linux-clang-libc++ \ -optimized-qmake \ -no-libudev \ -no-separate-debug-info \ -no-pch \ -no-dbus \ -no-accessibility \ -no-gtk \ -no-glib \ -system-libjpeg \ -system-libpng \ -system-sqlite \ -system-zlib \ -system-freetype \ -system-harfbuzz \ -silent make make INSTALL_ROOT="$1" install
These are the dependencies we have listed for qt5-base (although from testing it seems ICU is also required; but that eror message occurs in Widgets)
bison make flex make freetype-harfbuzz gperf make libICE libSM libX11 libXext libXi libXrandr libXrender libXslt libinput libjpeg-turbo libpng libxkbcommon linux-headers make mesa mtdev perl make sqlite xcb-util xcb-util-image xcb-util-keysyms xcb-util-wm xcb-util-renderutil zlib
The only real thing that has changed on my system since the last time I built qt5 is dropping gcc for llvm (clang, libc++, compiler-rt, lld, etc). I've rebuilt basically the entire system after this with only a few hiccups.
I've tried choosing different platforms as well. linux-clang results in an identical error message. Interestingly, autodetection acts as if I'm using gcc still. Which may be a clue?
We DO use libressl instead of openssl (and indeed we apply patches to qt5 to enable ssl support), but considering I've built 5.15 previously with gcc that doesn't appear to be the issue.
-
I would check the bug report system. They might have not used LLVM 10.
Did you check with LLVM 9 ?
-
I would check the bug report system. They might have not used LLVM 10.
Did you check with LLVM 9 ?
-
Thanks for the link; I have posted a bug report.
I have not tested with llvm 9; I will try it out, it'll take a while to see though. I'll report back when it's done.
-
I have just experienced what looks like the exact same error. Even the same line number. Clang++-19, Qt5-base 5.15.17, Linux Alpine 3.22
../../include/QtNetwork/5.15.17/QtNetwork/private/../../../../../../src/network/socket/qnet_unix_p.h:120:29: error: cannot initialize a parameter of type 'socklen_t *' (aka 'unsigned int *') with an rvalue of type 'int *' 120 | fd = ::accept4(s, addr, static_cast<QT_SOCKLEN_T *>(addrlen), sockflags); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I believe it is a result of the defines in qtplatformdefs.h, where linux clang & linux llvm are implemented with opposite logic to linux g++? (Alpine will be the default #else in both cases, because it is MUSL, not GLIBC. One will be socklen_t and the other will be the offending int. Swapping the logic to match g++ is probably a hack, but it then compiles ok on Alpine.)