bazelbuild / rules_foreign_cc

Build rules for interfacing with "foreign" (non-Bazel) build systems (CMake, configure-make, GNU Make, boost, ninja, Meson)
https://bazelbuild.github.io/rules_foreign_cc
Apache License 2.0
650 stars 232 forks source link

Absolute paths in native_tool_toolchain result in "Can not copy" error #1218

Closed kmARC closed 2 weeks ago

kmARC commented 2 weeks ago

After commit bac2c19d2352eb4e984a09c113703cc4840c5bbd, when a system tool is registered as a native_tool_toolchain (like /usr/bin/make) then rules_foreign_cc tries to append the absolute path at the end of $EXT_BUILD_ROOT failing with the following error message.

Can not copy /.../execroot/...//usr/bin/make

Workaround: git revert bac2c19d (on top of current main as well as 0.10.0) resolves the issue.

An example BUILD file:

rules_foreign_cc_dependencies(
    native_tools_toolchains = [
        ":system_make_toolchain",
    ],
    register_built_tools = False,
    register_default_tools = False,
    register_preinstalled_tools = True,
)

native_tool_toolchain(
    name = "system_make",
    path = "/usr/bin/make",
)

toolchain(
    name = "system_make_toolchain",
    toolchain = ":system_make",
    toolchain_type = "@rules_foreign_cc//toolchains:make_toolchain",
)