Does Qt6 require CLANG to build? What if GCC ONLY?
-
- Does Qt6 require CLANG to build? What if GCC ONLY?
- I actually installed CLANG already.
➜ build clang --version clang version 16.0.0 (https://github.com/llvm/llvm-project.git 26fa17ed2914bd80c066d36b325fd3104e45554c) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/local/bin
So, what else did I miss to build Qt6 from source ???
[ 72%] Linking CXX executable ../../../../qtbase/bin/lupdate cd ....../qt-everywhere-src-6.4.1/build/qttools/src/linguist/lupdate && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/lupdate.dir/link.txt --verbose=1 /usr/bin/c++ -DNDEBUG -O2 -Wl,--enable-new-dtags CMakeFiles/lupdate.dir/lupdate_autogen/mocs_compilation.cpp.o CMakeFiles/lupdate.dir/__/shared/numerus.cpp.o CMakeFiles/lupdate.dir/__/shared/po.cpp.o CMakeFiles/lupdate.dir/__/shared/projectdescriptionreader.cpp.o CMakeFiles/lupdate.dir/__/shared/qm.cpp.o CMakeFiles/lupdate.dir/__/shared/qph.cpp.o CMakeFiles/lupdate.dir/__/shared/qrcreader.cpp.o CMakeFiles/lupdate.dir/__/shared/runqttool.cpp.o CMakeFiles/lupdate.dir/__/shared/simtexth.cpp.o CMakeFiles/lupdate.dir/__/shared/translator.cpp.o CMakeFiles/lupdate.dir/__/shared/translatormessage.cpp.o CMakeFiles/lupdate.dir/__/shared/ts.cpp.o CMakeFiles/lupdate.dir/__/shared/xliff.cpp.o CMakeFiles/lupdate.dir/__/shared/xmlparser.cpp.o CMakeFiles/lupdate.dir/cpp.cpp.o CMakeFiles/lupdate.dir/java.cpp.o CMakeFiles/lupdate.dir/python.cpp.o CMakeFiles/lupdate.dir/main.cpp.o CMakeFiles/lupdate.dir/merge.cpp.o CMakeFiles/lupdate.dir/ui.cpp.o CMakeFiles/lupdate.dir/qdeclarative.cpp.o CMakeFiles/lupdate.dir/clangtoolastreader.cpp.o CMakeFiles/lupdate.dir/cpp_clang.cpp.o CMakeFiles/lupdate.dir/filesignificancecheck.cpp.o CMakeFiles/lupdate.dir/lupdatepreprocessoraction.cpp.o -o ../../../../qtbase/bin/lupdate -Wl,-rpath,....../qt-everywhere-src-6.4.1/build/qtbase/lib:/usr/local/lib: ../../../../qtbase/lib/libQt6Qml.so.6.4.1 ../../../../qtbase/lib/libQt6Network.so.6.4.1 ../../../../qtbase/lib/libQt6Core.so.6.4.1 /usr/local/lib/libclang.so.16.0.0git /usr/local/lib/libclangHandleCXX.so.16git -Wl,-rpath-link,/usr/local/lib /usr/bin/ld: CMakeFiles/lupdate.dir/cpp_clang.cpp.o: in function `ClangCppParser::loadCPP(Translator&, QList<QString> const&, ConversionData&, bool*)::{lambda()#2}::operator()() const': cpp_clang.cpp:(.text+0x581): undefined reference to `llvm::vfs::getRealFileSystem()' /usr/bin/ld: cpp_clang.cpp:(.text+0x5b2): undefined reference to `clang::PCHContainerOperations::PCHContainerOperations()' /usr/bin/ld: cpp_clang.cpp:(.text+0x5ea): undefined reference to `clang::tooling::ClangTool::ClangTool(clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::shared_ptr<clang::PCHContainerOperations>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, llvm::IntrusiveRefCntPtr<clang::FileManager>)' /usr/bin/ld: cpp_clang.cpp:(.text+0x6a0): undefined reference to `clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > (std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, llvm::StringRef)>)' /usr/bin/ld: cpp_clang.cpp:(.text+0x6de): undefined reference to `clang::tooling::ClangTool::run(clang::tooling::ToolAction*)' /usr/bin/ld: cpp_clang.cpp:(.text+0x6e6): undefined reference to `clang::tooling::ClangTool::~ClangTool()' /usr/bin/ld: cpp_clang.cpp:(.text+0x72c): undefined reference to `clang::FileManager::~FileManager()' /usr/bin/ld: CMakeFiles/lupdate.dir/cpp_clang.cpp.o: in function `ClangCppParser::loadCPP(Translator&, QList<QString> const&, ConversionData&, bool*)::{lambda()#1}::operator()() const': cpp_clang.cpp:(.text+0x871): undefined reference to `llvm::vfs::getRealFileSystem()' /usr/bin/ld: cpp_clang.cpp:(.text+0x8a2): undefined reference to `clang::PCHContainerOperations::PCHContainerOperations()' /usr/bin/ld: cpp_clang.cpp:(.text+0x8da): undefined reference to `clang::tooling::ClangTool::ClangTool(clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::shared_ptr<clang::PCHContainerOperations>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, llvm::IntrusiveRefCntPtr<clang::FileManager>)' /usr/bin/ld: cpp_clang.cpp:(.text+0x990): undefined reference to `clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > (std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, llvm::StringRef)>)' /usr/bin/ld: cpp_clang.cpp:(.text+0x9ce): undefined reference to `clang::tooling::ClangTool::run(clang::tooling::ToolAction*)' /usr/bin/ld: cpp_clang.cpp:(.text+0x9d6): undefined reference to `clang::tooling::ClangTool::~ClangTool()' /usr/bin/ld: cpp_clang.cpp:(.text+0xa1c): undefined reference to `clang::FileManager::~FileManager()'
Thank you very much....
-
Hi,
- no it does not. Only some of the tools needs clang but these are optional.
- I currently don't know why but isn't clang's current stable release 15 ?
-
@SGaist said in Does Qt6 require CLANG to build? What if GCC ONLY?:
I currently don't know why but isn't clang's current stable release 15 ?
There is indeed no release available that could give the output the user pasted.
Conclusion, they are running a git or similarly unstable release of LLVM.
-
I ran into the same issue (and i have noticed many others have as well), and while i'm using the same version of clang, clang 16 is long since stable since clang is currently on 17 as of this post.
To be specific, the issue i ran into was trying to build qt using gcc, and i had the exact same linking issue on the exact same target, lupdate.
Also i feel its worth pointing that the version of clang the person posted here was irrelevant to the discussion since they stated they were trying to build with gcc.
I ultimately decided to build it with clang instead of gcc, and it built fine.
So for anyone who stumbles upon this page with the same issue, just use clang, i guess, because linking in gcc , at least on a system with clang 16, is somehow screwed up. -
@taekahn As for today, I'm trying to build Qt6-6.6.1 with CLANG-18.0.0git, however, I got the following error messages:
[ 34%] Built target HttpServer In file included from /opt/qt/qt-everywhere-src-6.6.1/qtgrpc/src/grpc/qgrpcchannel.cpp:17: /usr/include/grpcpp/impl/codegen/client_unary_call.h:56:15: error: use of undeclared identifier 'CallOpSendInitialMetadata' 56 | CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, | ^ /usr/include/grpcpp/impl/codegen/client_unary_call.h:57:74: error: expected unqualified-id 57 | CallOpRecvInitialMetadata, CallOpRecvMessage<OutputMessage>, | ^ /usr/include/grpcpp/impl/codegen/client_unary_call.h:60:15: error: use of undeclared identifier 'ops' 60 | status_ = ops.SendMessagePtr(&request); | ^ /usr/include/grpcpp/impl/codegen/client_unary_call.h:64:5: error: use of undeclared identifier 'ops' 64 | ops.SendInitialMetadata(&context->send_initial_metadata_, | ^ /usr/include/grpcpp/impl/codegen/client_unary_call.h:64:37: error: member access into incomplete type 'grpc_impl::ClientContext' 64 | ops.SendInitialMetadata(&context->send_initial_metadata_, | ^ /usr/include/grpcpp/impl/codegen/channel_interface.h:28:7: note: forward declaration of 'grpc_impl::ClientContext' 28 | class ClientContext; | ^ In file included from /opt/qt/qt-everywhere-src-6.6.1/qtgrpc/src/grpc/qgrpcchannel.cpp:17: /usr/include/grpcpp/impl/codegen/client_unary_call.h:65:36: error: member access into incomplete type 'grpc_impl::ClientContext' 65 | context->initial_metadata_flags()); | ^ /usr/include/grpcpp/impl/codegen/channel_interface.h:28:7: note: forward declaration of 'grpc_impl::ClientContext' 28 | class ClientContext; | ^ In file included from /opt/qt/qt-everywhere-src-6.6.1/qtgrpc/src/grpc/qgrpcchannel.cpp:17: /usr/include/grpcpp/impl/codegen/client_unary_call.h:66:5: error: use of undeclared identifier 'ops' 66 | ops.RecvInitialMetadata(context); | ^ /usr/include/grpcpp/impl/codegen/client_unary_call.h:67:5: error: use of undeclared identifier 'ops' 67 | ops.RecvMessage(result); | ^ /usr/include/grpcpp/impl/codegen/client_unary_call.h:68:5: error: use of undeclared identifier 'ops' 68 | ops.AllowNoMessage(); | ^ /usr/include/grpcpp/impl/codegen/client_unary_call.h:69:5: error: use of undeclared identifier 'ops' 69 | ops.ClientSendClose(); | ^ make[2]: Leaving directory '/opt/qt/qt-everywhere-src-6.6.1/build' /usr/include/grpcpp/impl/codegen/client_unary_call.h:70:5: error: use of undeclared identifier 'ops' 70 | ops.ClientRecvStatus(context, &status_); | ^ make -f qtopcua/src/opcua/CMakeFiles/OpcUa.dir/build.make qtopcua/src/opcua/CMakeFiles/OpcUa.dir/build /usr/include/grpcpp/impl/codegen/client_unary_call.h:71:22: error: use of undeclared identifier 'ops' 71 | call.PerformOps(&ops); | ^ /usr/include/grpcpp/impl/codegen/client_unary_call.h:72:15: error: use of undeclared identifier 'ops' 72 | cq.Pluck(&ops); | ^ /usr/include/grpcpp/impl/codegen/client_unary_call.h:80:10: error: use of undeclared identifier 'ops' 80 | if (!ops.got_message && status_.ok()) { | ^ make[2]: Entering directory '/opt/qt/qt-everywhere-src-6.6.1/build' make[2]: Nothing to be done for 'qtopcua/src/opcua/CMakeFiles/OpcUa.dir/build'. make[2]: Leaving directory '/opt/qt/qt-everywhere-src-6.6.1/build' [ 35%] Built target OpcUa
-
@jiapei1000 please set -no-feature-native_grpc or -DFEATURE_native_grpc=OFF when configuring Qt/QtGRPC. This will unblock your build.