[Interest] Clang build for QT 6.2.3

BeneschTech LLC chris at beneschtech.com
Fri Feb 11 05:34:45 CET 2022

Hi guys (and gals)

As promised, here is the findings from setting up a QT dev environment
using the latest LLVM suite (from git) and latest QT from source.

As our software product grows, we use a suite of the latest and greatest
for each major release and might upgrade some tools along the way with
minor releases, for example in version 7 we went from 5.7 at the outset
when it first came out to now 5.12, but have stopped there due to some
reworking needed to maintain code cleanliness (QString::split for instance
still builds in 5.15 but spews tons of warnings which reduces our quality
metric).  So as we gear up for version 8, we wanted to do llvm with polly
since it is math intensive and also utilize openmp which llvm can do
automatically with polly.  We will be using a custom mkspec to accomplish
this. Anyway, enough giving away the farm.

1 . For clang builds, ensure clang is built with RTTI - Failure in linguist
-DLLVM_ENABLE_RTTI=ON -DLLVM_ENABLE_EH=ON . Not sure where in the version
history this broke, but this fixed it since there was a ton of linker
errors related to typeinfo for clang specific classes.  I'm not versed well
enough on cmake to offer a solution to make sure this is the case during
configuration, sorry.

2 .
Line 408  add (void)supp_size; - -Werror failure with clang 15
It's a set but not used warning, and the (void) trick is an easy warning
silencer.  I'm sure there is a better solution, but this has no operational

3 .
line 123 add the structure name to the definition

error: anonymous non-C-compatible type given name for linkage purposes by
typedef declaration after its linkage was computed; add a tag name here to
establish linkage prior to definition
typedef struct {
Clang literally tells you how to fix it.  I didn't know whether to wrap it
in an extern "C" or not, so I chose the obvious solution.

I was able to successfully build my test program using widgets and a
mandelbrot set and it performed fantastically.  Just make sure if you are
upgrading the build system to remove any leftover remnants from Qt5 builds.

This was tested on both Ubuntu 20.04 and AlmaLinux 8.5, so I'm pretty sure
it's not a OS dependent issue.  Anyway, hope this helps someone.  Off to
set up git repositories and get to work on it.
Chris Benesch
BeneschTech, LLC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20220210/0fe8848c/attachment.htm>

More information about the Interest mailing list