Opened 2 years ago

Closed 2 years ago

#20435 closed defect (worksforme)

qt-6 FTBFS with clang-19 installed

Reported by: Joe Locash Owned by: blfs-book
Priority: normal Milestone: 12.3
Component: BOOK Version: git
Severity: medium Keywords:
Cc:

Description

Getting the following error in the qttools submodule:

/tmp/build/qt-everywhere-src-6.7.2/qttools/src/linguist/lupdate/clangtoolastreader.cpp: In member function ‘bool LupdateVisitor::VisitNamedDecl(clang::NamedDecl*)’:
/tmp/build/qt-everywhere-src-6.7.2/qttools/src/linguist/lupdate/clangtoolastreader.cpp:785:73: error: ‘const class clang::FileEntry’ has no member named ‘getName’
  785 |     if (!LupdatePrivate::isFileSignificant(fullLocation.getFileEntry()->getName().str()))
      |                                                                         ^~~~~~~

Attachments (1)

qttools-6.7.2-clang-19.patch​ (4.7 KB ) - added by Joe Locash 2 years ago.

Download all attachments as: .zip

Change History (20)

comment:1 by Xi Ruoyao, 2 years ago

Hmm, qt6 does not even list LLVM as a dependency.

comment:2 by martyj19, 2 years ago

The qttools submodule will use LLVM for "Clang-based lupdate parser" and for QDoc if it is present.

Last edited 2 years ago by martyj19 (previous) (diff)

comment:3 by Xi Ruoyao, 2 years ago

Maybe

sed 's/getFileEntry/&Ref/' -i qttools/src/linguist/lupdate/clangtoolastreader.cpp

(untested)

in reply to:  3 comment:4 by Joe Locash, 2 years ago

Replying to Xi Ruoyao:

Maybe

sed 's/getFileEntry/&Ref/' -i qttools/src/linguist/lupdate/clangtoolastreader.cpp

(untested)

Doesn't work:

/tmp/build/qttools-everywhere-src-6.7.2/src/qdoc/qdoc/src/qdoc/clangcodeparser.cpp: In function ‘std::string get_default_value_initializer_as_string(const clang::TemplateTypeParmDecl*)’:
/tmp/build/qttools-everywhere-src-6.7.2/src/qdoc/qdoc/src/qdoc/clangcodeparser.cpp:171:76: error: could not convert ‘parameter->clang::TemplateTypeParmDecl::getDefaultArgument()’ from ‘const clang::TemplateArgumentLoc’ to ‘clang::QualType’
  171 |                 get_fully_qualified_type_name(parameter->getDefaultArgument(), parameter->getASTContext()) :
      |                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
      |                                                                            |
      |                                                                            const clang::TemplateArgumentLoc
/tmp/build/qttools-everywhere-src-6.7.2/src/qdoc/qdoc/src/qdoc/clangcodeparser.cpp: In function ‘std::string get_default_value_initializer_as_string(const clang::NonTypeTemplateParmDecl*)’:
/tmp/build/qttools-everywhere-src-6.7.2/src/qdoc/qdoc/src/qdoc/clangcodeparser.cpp:187:63: error: cannot convert ‘const clang::TemplateArgumentLoc’ to ‘const clang::Expr*’
  187 |         get_expression_as_string(parameter->getDefaultArgument(), parameter->getASTContext()) : "";
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
      |                                                               |
      |                                                               const clang::TemplateArgumentLoc
/tmp/build/qttools-everywhere-src-6.7.2/src/qdoc/qdoc/src/qdoc/clangcodeparser.cpp:145:64: note:   initializing argument 1 of ‘std::string get_expression_as_string(const clang::Expr*, const clang::ASTContext&)’
  145 | static std::string get_expression_as_string(const clang::Expr* expression, const clang::ASTContext& declaration_context) {
      |                                             ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
/tmp/build/qttools-everywhere-src-6.7.2/src/qdoc/qdoc/src/qdoc/clangcodeparser.cpp: In function ‘std::string get_default_value_initializer_as_string(const clang::TemplateTemplateParmDecl*)’:
/tmp/build/qttools-everywhere-src-6.7.2/src/qdoc/qdoc/src/qdoc/clangcodeparser.cpp:207:113: error: ‘Fully’ is not a member of ‘clang::TemplateName::Qualified’
  207 |         template_name.print(ss, parameter->getASTContext().getPrintingPolicy(), clang::TemplateName::Qualified::Fully);
      |                                                                                                                 ^~~~~

Upstream ticket is: ​https://bugreports.qt.io/browse/QTBUG-129146

comment:5 by Joe Locash, 2 years ago

I was wrong. It does fix linguist. Now qdoc is bombing.

comment:6 by Bruce Dubbs, 2 years ago

Is there a way to force gcc? I looked for a couple of minutes and didn't see any. We don't mention llvm explicitly in the dependencies, but it is recommended for mesa which is recommended for qt6.

comment:7 by Douglas R. Reno, 2 years ago

I haven't really looked yet, but I don't think there is a way to force GCC for this part

LLVM provides a lot of other utilities other than just a compiler, it also includes documentation and code linking utilities and functions (which is what I think this is using)

comment:8 by Xi Ruoyao, 2 years ago

Or can we just disable this feature and make it as if LLVM isn't installed?

comment:9 by Xi Ruoyao, 2 years ago

Try adding -no-feature-clang to configure?

in reply to:  7 comment:10 by Joe Locash, 2 years ago

Replying to Douglas R. Reno:

I haven't really looked yet, but I don't think there is a way to force GCC for this part

LLVM provides a lot of other utilities other than just a compiler, it also includes documentation and code linking utilities and functions (which is what I think this is using)

My build is using gcc. qttools looks for libclang and if found will build against that.

in reply to:  9 ; comment:11 by Joe Locash, 2 years ago

Replying to Xi Ruoyao:

Try adding -no-feature-clang to configure?

Doesn't work.

in reply to:  8 comment:12 by Joe Locash, 2 years ago

Replying to Xi Ruoyao:

Or can we just disable this feature and make it as if LLVM isn't installed?

This is fugly but should work for both types of builds:

mv /usr/lib/cmake/clang /usr/lib/_cmake_clang

run configure or cmake depending on how you build (submodules use cmake)

mv /usr/lib/_cmake_clang /usr/lib/cmake/clang

Then build as usual.

in reply to:  11 ; comment:13 by Xi Ruoyao, 2 years ago

Replying to Joe Locash:

Replying to Xi Ruoyao:

Try adding -no-feature-clang to configure?

Doesn't work.

But it should work, with it:

Qt Tools:
  Qt Assistant ........................... yes
  libclang found ......................... no
  Clang-based lupdate parser ............. no
  Qt Designer ............................ yes
  Qt Distance Field Generator ............ yes
  Qt Linguist ............................ yes

I'm running ninja now.

in reply to:  13 comment:14 by Xi Ruoyao, 2 years ago

Replying to Xi Ruoyao:

Replying to Joe Locash:

Replying to Xi Ruoyao:

Try adding -no-feature-clang to configure?

Doesn't work.

But it should work, with it:

Qt Tools:
  Qt Assistant ........................... yes
  libclang found ......................... no
  Clang-based lupdate parser ............. no
  Qt Designer ............................ yes
  Qt Distance Field Generator ............ yes
  Qt Linguist ............................ yes

I'm running ninja now.

It works for me. I'll add it into the book.

comment:15 by Xi Ruoyao, 2 years ago

-no-feature-clang is now in the book and I'll close this as fixed if no objection in a few days.

comment:16 by Douglas R. Reno, 2 years ago

What do you guys think about trying ​https://code.qt.io/cgit/qt/qttools.git/commit/?id=a2f478b20f369132de1e67b30716d5f070d7bf80 and ​https://code.qt.io/cgit/qt/qttools.git/commit/?id=4a368a06afa5929d8674d2e94c2d7cbd6ad85d4e instead? Untested at the moment, but this is designed to adapt QtDoc to the changes in LLVM 19.

in reply to:  16 comment:17 by Joe Locash, 2 years ago

Replying to Douglas R. Reno:

What do you guys think about trying ​https://code.qt.io/cgit/qt/qttools.git/commit/?id=a2f478b20f369132de1e67b30716d5f070d7bf80 and ​https://code.qt.io/cgit/qt/qttools.git/commit/?id=4a368a06afa5929d8674d2e94c2d7cbd6ad85d4e instead? Untested at the moment, but this is designed to adapt QtDoc to the changes in LLVM 19.

With these 2 commits and Xi's sed, qttools builds fine here.

by Joe Locash, 2 years ago

comment:18 by Joe Locash, 2 years ago

Attached is a patch incorporating the commits and the sed. If building using the monolithic tarball pass -d qttools to the patch command.

comment:19 by Bruce Dubbs, 2 years ago

Resolution: → worksforme
Status: new → closed

I just updated qt6 to version 6.7.3 with the current qt6 instructions and ckang-19.1.0.

Works for me.

Note: See TracTickets for help on using tickets.