<div dir="ltr">Hi all, trust all is well!<div><br></div><div>I'm trying to build C++ modules using CLang and Bazel. I've created a special rule to compile modules, and inside the rule I've created two actions for the seperate steps of compiling the module to a precompiled file, and the second action builds the LLVM bitcode from the pre-compiled file.</div><div><br></div><div>This is where I'm having trouble. The precompiled file builds correctly, but the second step, building the bitcode from the precompiled header fails with the following error:</div><div><br></div><div>fatal error: malformed or corrupted AST file: 'could not find file '/home/wpieterse/.cache/bazel/_bazel_wpieterse/097a98d4b8ea7d3c9ae2315ed87ce0f0/sandbox/linux-sandbox/1/execroot/bazel_llvm<br>_stuff/cpp/add.cppm' referenced by AST file 'bazel-out/k8-fastbuild/bin/cpp/add.pcm''<br></div><div><br></div><div>I presume this has something to do with Bazel creating a sandbox for each action. This is why the file cannot be found.</div><div><br></div><div>Also, these are the parameters sent to CLang 9.0 when compiling:</div><div><br></div><div><b>Compiling the precompiled header:</b></div><div>./clang -std=c++2a -fmodules-ts --precompile -o add.pcm add.cppm</div><div><br></div><div><b>Compiling the bitcode:</b></div><div>./clang -std=c++2a -fmodules-ts -S -emit-llvm -c add.pcm -o add.bc</div><div><br></div><div>I've tried searching for a way to use relative paths, but to no avail. The file is there, inside the Bazel execution root, but not in the sandbox.</div><div><br></div><div>Is there a switch on CLang that can be used to use relative paths? Am I using the correct command line switches.</div></div>