Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-29184

Build: Wrong "Clang build mode mismatch" with prebuilt binaries

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Not Evaluated
    • Qt Creator 11.0.0
    • Qt Creator 11.0.0-beta1
    • Building Qt Creator
    • None
    • Windows, MSVC2022
    • 09c9daf0c (master)

    Description

      When building Qt Creator with the prebuilt libclang binaries, CMake shows the following warning, and disables Clang tooling (or at least ClangFormat):

      Clang build mode mismatch (debug vs release): limiting clangTooling

      Checking CMakeError.log, it looks like the error is caused by bad library inclusion:

      Performing C++ SOURCE FILE Test QTC_CLANG_BUILDMODE_MATCH failed with the following output:
      Change Dir: F:/Projects/qt-creator/build-qtc/CMakeFiles/CMakeTmp
      
      Run Build Command(s):D:/Utils/ninja.exe cmTC_fb07a && ninja: error: 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/DIA SDK/lib/amd64/diaguids.lib', needed by 'cmTC_fb07a.exe', missing and no known rule to make it
      
      
      Source file was:
          #include <clang/Tooling/CommonOptionsParser.h>
          #include <clang/Tooling/Tooling.h>
          using namespace clang;
          using namespace clang::tooling;
          llvm::cl::OptionCategory CheckToolCategory("check tool options");
          int main(int argc, const char **argv)
          {
              class Parser : public CommonOptionsParser {
              public:
                Parser(int &argc, const char **argv, llvm::cl::OptionCategory &Category) :
                  CommonOptionsParser(argc, argv, Category) {}
              };
      
              Parser OptionsParser(argc, argv, CheckToolCategory);
              ClangTool Tool(OptionsParser.getCompilations(),
                             OptionsParser.getSourcePathList());
              return 0;
          }

      And indeed, C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/DIA SDK/lib/amd64/diaguids.lib appears in lib/cmake/llvm/LLVMExports.cmake:

      Unable to find source-code formatter for language: cmake. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      # Create imported target LLVMDebugInfoPDB
      add_library(LLVMDebugInfoPDB STATIC IMPORTED)
      
      set_target_properties(LLVMDebugInfoPDB PROPERTIES
        INTERFACE_LINK_LIBRARIES "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/DIA SDK/lib/amd64/diaguids.lib;LLVMBinaryFormat;LLVMObject;LLVMSupport;LLVMDebugInfoCodeView;LLVMDebugInfoMSF"
      )

      Removing it seems to solve the issue, and ClangFormat builds successfully.

      This check was added in https://codereview.qt-project.org/c/qt-creator/qt-creator/+/325756

      CC con

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              cadam Cristian Adam
              orgads Orgad Shaneh
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes