Skip to content

Build failure with Qt 6.12.0 #2515

Closed

Description

@apteryks

The last release, 0.30.12, fails to build with Qt 6.12.0 like:

g++ -Wl,-O1 -Wl,-rpath,/gnu/store/cg90hqvs0aq1hba1wcs7xp7fbj5qvjcs-qtbase-6.12.0/lib -Wl,-rpath-link,/gnu/store/cg90hqvs0aq1hba1wcs7xp7fbj5qvjcs-qtbase-6.12.0/lib -shared -Wl,-soname,libklayout_lvs.so.0 -o libklayout_lvs.so.0.30.12 lvsForceLink.o qrc_lvsResources.o  -lgit2 -lz -L/tmp/guix-build-klayout-0.30.12.drv-0/source/build-release/lvs/lvs/../.. -lklayout_tl -lklayout_db -lklayout_gsi -lklayout_lym -lklayout_rdb -lklayout_drc /gnu/store/cg90hqvs0aq1hba1wcs7xp7fbj5qvjcs-qtbase-6.12.0/lib/libQt6PrintSupport.so /gnu/store/242x5wvmwkr84p09h6lbfj0dhwvpc4pr-qttools-6.12.0/lib/libQt6Designer.so -lQt6Xml /gnu/store/242x5wvmwkr84p09h6lbfj0dhwvpc4pr-qttools-6.12.0/lib/libQt6UiTools.so -lQt6OpenGLWidgets /gnu/store/cg90hqvs0aq1hba1wcs7xp7fbj5qvjcs-qtbase-6.12.0/lib/libQt6OpenGLWidgets.so -lQt6OpenGL /gnu/store/v1yg8ak2c31vz1r3vxz05bbl85z2hgx1-qtmultimedia-6.12.0/lib/libQt6MultimediaWidgets.so -lQt6Multimedia -lQt6Widgets /gnu/store/cg90hqvs0aq1hba1wcs7xp7fbj5qvjcs-qtbase-6.12.0/lib/libQt6Widgets.so /gnu/store/cg90hqvs0aq1hba1wcs7xp7fbj5qvjcs-qtbase-6.12.0/lib/libQt6OpenGL.so /gnu/store/v1yg8ak2c31vz1r3vxz05bbl85z2hgx1-qtmultimedia-6.12.0/lib/libQt6Multimedia.so -lQt6Network /gnu/store/7vc4lrc1dylymhxglrs1hxslcj73yrp4-qtsvg-6.12.0/lib/libQt6Svg.so -lQt6Gui /gnu/store/cg90hqvs0aq1hba1wcs7xp7fbj5qvjcs-qtbase-6.12.0/lib/libQt6Gui.so /gnu/store/cg90hqvs0aq1hba1wcs7xp7fbj5qvjcs-qtbase-6.12.0/lib/libQt6Xml.so /gnu/store/cg90hqvs0aq1hba1wcs7xp7fbj5qvjcs-qtbase-6.12.0/lib/libQt6Network.so /gnu/store/am7hz5wgb2rbbipymxpwjavqvx4k0csk-qt5compat-6.12.0/lib/libQt6Core5Compat.so /gnu/store/cg90hqvs0aq1hba1wcs7xp7fbj5qvjcs-qtbase-6.12.0/lib/libQt6Sql.so -lQt6Core /gnu/store/cg90hqvs0aq1hba1wcs7xp7fbj5qvjcs-qtbase-6.12.0/lib/libQt6Core.so -lpthread -lGL    
ln -s libklayout_lvs.so.0.30.12 libklayout_lvs.so
ln -s libklayout_lvs.so.0.30.12 libklayout_lvs.so.0
ln -s libklayout_lvs.so.0.30.12 libklayout_lvs.so.0.30
rm -f ../../../build-release/libklayout_lvs.so.0.30.12
mv -f libklayout_lvs.so.0.30.12 ../../../build-release/libklayout_lvs.so.0.30.12
rm -f ../../../build-release/libklayout_lvs.so
../../../../src/gsiqt/qt6/QtCore/gsiDeclQXmlStreamEntityResolver.cc:116:19: error: virtual function ‘virtual QString QXmlStreamEntityResolver_Adaptor::resolveEntity(const QString&, const QString&)’ overriding final function
  116 |   virtual QString resolveEntity(const QString &publicId, const QString &systemId)
      |                   ^~~~~~~~~~~~~
In file included from /gnu/store/cg90hqvs0aq1hba1wcs7xp7fbj5qvjcs-qtbase-6.12.0/include/qt6/QtCore/QXmlStreamEntityResolver:1,
                 from ../../../../src/gsiqt/qt6/QtCore/gsiDeclQXmlStreamEntityResolver.cc:30:
/gnu/store/cg90hqvs0aq1hba1wcs7xp7fbj5qvjcs-qtbase-6.12.0/include/qt6/QtCore/qxmlstream.h:236:21: note: overridden function is ‘virtual QString QXmlStreamEntityResolver::resolveEntity(const QString&, const QString&)’
  236 |     virtual QString resolveEntity(const QString& publicId, const QString& systemId) final;
      |                     ^~~~~~~~~~~~~
rm -f ../../../build-release/libklayout_lvs.so.0
rm -f ../../../build-release/libklayout_lvs.so.0.30
mv -f libklayout_lvs.so ../../../build-release/libklayout_lvs.so
mv -f libklayout_lvs.so.0 ../../../build-release/libklayout_lvs.so.0
mv -f libklayout_lvs.so.0.30 ../../../build-release/libklayout_lvs.so.0.30

Activity

  1. klayoutmatthias commented on Oct 17, 2026

    @klayoutmatthias
    Collaborator

    You need to build with "--without-qt-binding". Qt bindings are only available on certain Qt versions. I don't spend the effort following up on all Qt changes.

  2. apteryks commented on Oct 18, 2026

    @apteryks
    Author

    OK, thank you. For the record, 6.12 is an LTS supported until 2028 IIRC; it may be worth supporting it in klayout, or alternatively not building the Qt bindings by default otherwise.

  3. gonsolo commented on Oct 26, 2026

    @gonsolo

    I put together a fix for this: https://github.com/gonsolo/klayout/tree/qt6.12-resolveentity-fix
    The following is what my little robot Claude has to say about this, I like the clang-based approach where a real C++ compiler is used for parsing.
    Let me know what you think.

    (Repo collaborator restrictions mean I can't open a PR directly - happy to if given access, or to answer questions here in the meantime.)

    The fix (commits 1-3, 5 on that branch):

    • allofqt.cpp: a few per-class forwarding headers in the QtCore manifest no longer exist in Qt 6.12 (dropped, renamed, or Android-only); fixed so the manifest preprocesses cleanly again.
    • cpp_classes.rb/produce.rb: CPPFunc gets an optional final flag, and produce.rb skips generating the override/callback machinery for a method with that flag set - it stays an ordinary callable method, just not overridable.
    • produce.rb: a defensive cycle guard in resolve_typedefs (found while testing the prototype below - a legitimate hardening on its own, the loop had no termination guard against a self-referential typedef).
    • gsiDeclQXmlStreamEntityResolver.cc regenerated with the fix applied. Verified with a full from-scratch build.sh build and a live Ruby check:
      RBA::QXmlStreamEntityResolver.new.resolveEntity("pub", "sys")  # => ""
      matching Qt's documented default for this reserved slot. The sibling resolveUndeclaredEntity() (not final) keeps its full override/callback machinery, unchanged.

    This intentionally does not touch c++.treetop or cpp_parser_classes.rb.

    An experiment (commits 4, 6) - a libclang-based parser prototype (clang_parse.py) plus a one-command driver (mkqtdecl_clang.sh), as an alternative to patching the hand-written Treetop grammar every time it meets a C++ construct it wasn't taught (this time final; previously things like __signed__/__int128). Validated for QtCore specifically (byte-identical generated output to the Treetop pipeline, same build-and-runtime verification as above, driven from real Qt 6.12 headers via clang). Scoped deliberately: Qt6 only, only QtCore validated end to end. This part is a discussion starter, not a request to adopt a new parser architecture - happy to drop it if you'd rather just take the minimal fix.

  4. klayoutmatthias commented on Oct 26, 2026

    @klayoutmatthias
    Collaborator
  5. gonsolo commented on Oct 26, 2026

    @gonsolo

    I will not look into AI-generated patches.

    If you have 30 seconds to read this comment maybe I can convince you to reconsider:

    1. I could have vibe-coded a patch in a minute, my PR took me nearly a day to get it right.
    2. I would call it AI-assisted, not AI-generated.
    3. It fixes a real problem: the Treetop grammar doesn't recognize the C++11 final specifier, so it kept generating an override for a method Qt 6.12 made illegal to override.
    4. I made an effort to fix it properly by using a real C++ compiler to parse Qt headers instead.
    5. That should also make this class of breakage less likely the next time C++ or Qt headers change.
  6. klayoutmatthias commented on Oct 26, 2026

    @klayoutmatthias
    Collaborator

    Yes, I have 30 seconds, but that won't be enough to explain my decision.

    Let me give you 30 minutes:

    I am not against AI, but I want to use it with my prompting, not everybody to throw PRs against me recently. Maybe it took you a day to set up the patch (which is appreciated), but I will be the one to maintain your solution forever. I will be the one doing deployment and that includes super-old installations, some even with Qt4 BTW. In total, that will be much more effort than your single day. KLayout is a hobby project - the time I spend on it are my nights and weekends and often enough my sleep time. So I think I am in a position to raise some concerns on the effort side.

    And please watch the language. Since AI entered the scene, statements became snobbish and preachy. "I made an effort to fix it properly .." implies that it's not done properly now. It is, but there is a reason. The way I am using the script is single-time use and that is why the code sits hidden in "scripts". A new Qt version means I am patching the script until it works with that version, and then I commit the generated headers. That's all. So "properly done" is not my main objective. The generated code is supposed to be portable across different Qt versions - currently 6.5 upwards, which means efforts have to be made to achieve this compatibility. There is more than just parsing the C++ code - there are also many decisions to drop functions not available on older Qt versions or to disable overloads that cause trouble with the interface. There is some level of ownership management built into the API through add-on declarations. All of that is not done "properly" if you like, or "good enough" as I would call it. Doing it "properly" eventually means replicating the efforts of PyQt for example, and that is not my goal. So while you dig deeper you will discover all of that.

    This is not the path I like you or anyone else to follow. And I don't like AI to make that path easy for everyone else, but a nightmare for me.

    That's basically why I am not looking at AI-supported patches anymore and it does not apply to this problem only.

    Matthias

  7. gonsolo commented on Oct 26, 2026

    @gonsolo

    I see.

    In case you change your mind, I have a minimal 20-lines patch to fix klayout for Qt 6.12:
    https://github.com/gonsolo/klayout/tree/qt6.12-minimal-fix

  8. added a commit that references this issue on Oct 26, 2026
  9. added this to the 0.30.13 milestone on Nov 1, 2026
  10. linked a pull request that will close this issueFeature/issue 2515 2383 #2531on Nov 1, 2026
  11. klayoutmatthias commented on Nov 5, 2026

    @klayoutmatthias
    Collaborator

    I enabled Qt 6.12, but the patch is much bigger than just fixing the "final" keyword. Goal was to provide a common code base for 6.6.1 and Qt versions upwards (tested with 6.6.1 and 6.12.0).

  12. gonsolo commented on Nov 5, 2026

    @gonsolo

    I enabled Qt 6.12, but the patch is much bigger than just fixing the "final" keyword. Goal was to provide a common code base for 6.6.1 and Qt versions upwards (tested with 6.6.1 and 6.12.0).

    Thanks Matthias! 🎉 I'll update the Nix package as soon as possible!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions