Uploaded image for project: 'Qbs ("Cubes")'
  1. Qbs ("Cubes")
  2. QBS-1765

Qbs Resolve ignores arguments on second run

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 2.2.0
    • 2.1.2
    • General
    • None
    • cb0e12ac3 (2.2)

    Description

      When I run

      qbs resolve \
         --build-directory ./tmp \
         --file Project.qbs \
         --force-probe-execution \
         modules.cpp.cxxStandardLibrary:libc++ \
         modules.cpp.staticLibraries:c++,c++abi \
         modules.cpp.linkerVariant:lld \
         modules.cpp.compilerWrapper:/usr/bin/ccache \
         config:debug \
         config:release 

      The build graph is generated as expected and compilation works.

      But when I run the `qbs resolve` for a second time with the same arguments, the build will be totally different and fail.

      • All properties set on command line seem to be ignored.
      • Clang specific arguments like the target triple are no longer generated.

      The only workaround I found is to remove the build graph for each run, to force a full regeneration of them.

      Is this behaviour intended?

       

      For easy reproduction do the following:

      1. Create a minimal `main.cpp`
      #include <memory>
      #include <string>
      #include <iostream>
      int main() {
        [[maybe_unused]] auto p = nullptr_t{};
        auto text = std::string{"Hello"};
        std::cout << text << '\n';
      }
      1. Create a minimal qbs project `Demo.qbs`
      Project {
        CppApplication {
          name: "demo"
          Depends { name: "cpp" }
          cpp.cxxLanguageVersion: "c++20"
          files: [
            "main.cpp"
          ]
        }
      }
      1. Start a Docker Image with Qbs
      docker run -it --mount src="$(pwd)",target=/project,type=bind -w /project \
         --entrypoint /bin/bash ghcr.io/arbmind/qbs-clang:2.1.2-17
      1. Install Gcc with `build-essential`
      apt install -y build-essential
      1. Run `qbs resolve` twice.
      qbs resolve --build-directory ./build --file Demo.qbs --force-probe-execution    \
         modules.cpp.cxxStandardLibrary:libc++ modules.cpp.staticLibraries:c++,c++abi  \
         modules.cpp.linkerVariant:lld config:debug config:release
      
      qbs resolve --build-directory ./build --file Demo.qbs --force-probe-execution    \
         modules.cpp.cxxStandardLibrary:libc++ modules.cpp.staticLibraries:c++,c++abi  \
         modules.cpp.linkerVariant:lld config:debug config:release
      1. Try to build with Qbs
      qbs build --build-directory ./build --file Demo.qbs \
         modules.cpp.cxxStandardLibrary:libc++ modules.cpp.staticLibraries:c++,c++abi  \
         modules.cpp.linkerVariant:lld config:debug

      You will see following error on linker:

       

      linking demo [demo]
      ERROR: /usr/bin/g++ -Wl,-m,elf_x86_64 -m64 -o /project/build/debug/demo.89e495e7/demo /project/build/debug/demo.89e495e7/3a52ce780950d4d9/main.cpp.o -lc++ -lc++abi -fuse-ld=lld 

      So it's not using the lld linker variant.

      If you run qbs resolve only once. Everything compiles fine.

       

       

      Attachments

        1. clang_setup.zip
          1 kB
          Andreas Reischuck
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kandeler Christian Kandeler
            arbmind Andreas Reischuck
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes