Currently the rust_bindgen (rust-bindgen) rule depends on a local_repository to make libstdc++ binaries available to the rule.
|
def _local_libstdcpp_impl(repository_ctx): |
|
os = repository_ctx.os.name.lower() |
|
if os == "linux": |
|
repository_ctx.symlink("/usr/lib/x86_64-linux-gnu/libstdc++.so.6", "libstdc++.so.6") |
|
repository_ctx.file("BUILD.bazel", _LIBSTDCPP_BUILD_FILE.format("libstdc++.so.6")) |
|
elif os.startswith("mac"): |
|
repository_ctx.symlink("/usr/lib/libstdc++.6.dylib", "libstdc++.6.dylib") |
|
repository_ctx.file("BUILD.bazel", _LIBSTDCPP_BUILD_FILE.format("libstdc++.6.dylib")) |
|
else: |
|
fail(os + " is not supported.") |
|
repository_ctx.file("WORKSPACE.bazel", _COMMON_WORKSPACE.format(repository_ctx.name)) |
|
|
|
_local_libstdcpp = repository_rule( |
|
implementation = _local_libstdcpp_impl, |
|
) |
This is pretty non-hermetic and I believe is the reason why we can't use the bindgen rules on MacOS. Instead, the rule should build it's own version of libstdc++ or use a pre-compiled one that exists in a shared location (not something that is installed to the host).
Currently the
rust_bindgen(rust-bindgen) rule depends on a local_repository to makelibstdc++binaries available to the rule.rules_rust/bindgen/repositories.bzl
Lines 99 to 113 in eb06a79
This is pretty non-hermetic and I believe is the reason why we can't use the bindgen rules on MacOS. Instead, the rule should build it's own version of libstdc++ or use a pre-compiled one that exists in a shared location (not something that is installed to the host).