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:
- 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'; }
- Create a minimal qbs project `Demo.qbs`
Project { CppApplication { name: "demo" Depends { name: "cpp" } cpp.cxxLanguageVersion: "c++20" files: [ "main.cpp" ] } }
- 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
- Install Gcc with `build-essential`
apt install -y build-essential
- 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
- 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.