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

Qt Creator overrides PATH from invoking command prompt

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • Qt Creator 12.0.0
    • All Other Issues
    • None
    • Qt 6.5.2 (but any recent of Qt6 should do the trick)
      Visual Studio 2022 up to date (17.8 here)
      CMake 3.27.7 (on the command line)
      Qt Creator 12.0.0
    • Windows

    Description

      I have created a test project to show the problem, available here:

      https://github.com/narnaud/qtc-cmake-error

      Make sure to initialize the submodules:

      git clone git@github.com:narnaud/qtc-cmake-error.git
      cd qtc-cmake-error
      git submodule update --init --recursive

      This project is doing 3 things: building KSyntaxHighlighting, building a small project and running it at the end.

      This project build fine on the console, or with VS Code or Visual Studio. When using Qt Creator, I have 2 main errors. Here is the log visible after 2-3 build, to remove everything that works:

      15:21:44: Running steps for project qtc-cmake-error...
      15:21:44: Starting: "C:\Qt\Tools\CMake_64\bin\cmake.exe" --build C:/dev/examples/build-qtc-cmake-error-Desktop_Qt_6_5_2_MSVC2019_64bit-Debug --target all
      [1/44 27.8/sec] Generating index.katesyntax
      FAILED: 3rdparty/ksyntaxhighlighting/data/index.katesyntax C:/dev/examples/build-qtc-cmake-error-Desktop_Qt_6_5_2_MSVC2019_64bit-Debug/3rdparty/ksyntaxhighlighting/data/index.katesyntax 
      cmd.exe /C "cd /D C:\dev\examples\build-qtc-cmake-error-Desktop_Qt_6_5_2_MSVC2019_64bit-Debug\3rdparty\ksyntaxhighlighting\data && C:\dev\examples\build-qtc-cmake-error-Desktop_Qt_6_5_2_MSVC2019_64bit-Debug\bin\katehighlightingindexer.exe C:/dev/examples/build-qtc-cmake-error-Desktop_Qt_6_5_2_MSVC2019_64bit-Debug/3rdparty/ksyntaxhighlighting/data/index.katesyntax C:/dev/examples/qtc-cmake-error/3rdparty/ksyntaxhighlighting/data/schema/language.xsd C:/dev/examples/build-qtc-cmake-error-Desktop_Qt_6_5_2_MSVC2019_64bit-Debug/3rdparty/ksyntaxhighlighting/data/syntax-data.qrc"
      [2/44 55.6/sec] Test run of test_app
      FAILED: CMakeFiles/test_app_run C:/dev/examples/build-qtc-cmake-error-Desktop_Qt_6_5_2_MSVC2019_64bit-Debug/CMakeFiles/test_app_run 
      cmd.exe /C "cd /D C:\dev\examples\build-qtc-cmake-error-Desktop_Qt_6_5_2_MSVC2019_64bit-Debug && C:\dev\examples\build-qtc-cmake-error-Desktop_Qt_6_5_2_MSVC2019_64bit-Debug\test_app.exe"
      ninja: build stopped: subcommand failed.
      15:21:44: The process "C:\Qt\Tools\CMake_64\bin\cmake.exe" exited with code 1.
      Error while building/deploying project qtc-cmake-error (kit: Desktop Qt 6.5.2 MSVC2019 64bit)
      When executing step "Build"
      15:21:44: Elapsed time: 00:00.
      

      2 errors:

      • it can't create the qrc file for KSyntaxHighlighting
      • it can't run the test_app

      Most likely the same problem, as they both require to run a target that was compiled before.


      It fails to run the test application during the build, because Qt Creator doesn't add the path to the Qt libraries to the Path in the build configuration (which is acceptable, QTCREATORBUG-19357).

      But it also doesn't work when setting the Path correctly in the command prompt and starting Qt Creator from there. The PATH is overridden, though other environment variables from the command prompt do show up correctly in Qt Creator.

      Attachments

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

        Activity

          People

            davschul David Schulz
            narnaud Nicolas Arnaud-Cormos
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes