bazelembedded / bazel-embedded

Tools for embedded/bare-metal development using bazel
https://www.nb.rough.run/tags/bazel/
MIT License
103 stars 31 forks source link

Executable not found while using toolchain with `foreign_rules_cc` #76

Open todd-enf opened 5 months ago

todd-enf commented 5 months ago

While working to integrate a cross-compilation toolchain supported by bazel_embedded, I encountered issues where executing any of the compilation tools (gcc, ar, strip, etc.) would fail with "File or directory not found", when the wrapper script attempts to invoke the actual executable.

Digging into the issue a little more, I found that the wrapper scripts rely on a path relative to the "root" of the sandbox to call the executable themselves. The foreign_rules_cc (in particular the make rule), however changes it's execution directory to better support the make, etc. invocations, which then make the relative path included in the wrapper scripts invalid. This results in the given targets failing to compile.

Reproduction Steps:

Use a bazel_embedded toolchain against a make rule from the foreign_rules_cc toolchain.

Are there any known workarounds/solutions for such an issue?