This is a minimal repro case to demonstrate that toolchains_llvm_bootstrapped fails to run CppCompile actions when path mapping --experimental_output_paths=strip is enabled and the other path mapping issue has been mitigated.
The State of Path Mapping discussion claims that path mapping works with CppCompile, CppModuleMap, and CppArchive. However, the CppCompile action + the toolchains_llvm_bootstrapped run into a problem. We haven't encountered this issue with other Bazel cc toolchains.
- Build the following target:
bazel build //hello- An error like the following will occur:
ERROR: /home/redacted/toolchains_llvm_bootstrapped_path_mapping_cppcompile_repro/hello/BUILD.bazel:3:10: Compiling hello/main.cc failed: (Exit 1): clang++ failed: error executing CppCompile command (from cc_binary rule target //hello:hello) external/llvm++http_archive+llvm-toolchain-minimal-21.1.8-linux-amd64/bin/clang++ -target x86_64-linux-gnu -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' ... (remaining 48 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
hello/main.cc:1:10: fatal error: 'iostream' file not found
1 | #include <iostream>
| ^~~~~~~~~~
1 error generated.
- Comment out this line in .bazelrc
common --modify_execution_info=CppCompile=+supports-path-mapping
Then build //hello again.
This time the build passes.