bazelbuild / bazelbuild/rules_rust

`#link` attribute ignored on macos with `experimental_use_cc_common_link`

Open
#2,501 0 comments 0 reactions 0 assignees View on GitHub
needs-triage
Dominant language
Starlark
Stars
843
Forks
651
Avg merge
2d 18h
Merged PRs (30d)
15

Description

Sample project: https://github.com/criemen/rules_rust_iana_repro

I have a sample project that has
```rust
#[link(name = "blablabla", kind = "framework")]
extern "C" {}
```
in `src/main.rs`, as per the [FFI guide](https://doc.rust-lang.org/nomicon/ffi.html).
I'd expect to get a linker error when building that project with bazel (as I do with cargo), getting a complaint about the missing framework blablabla. However, `rules_rust` with `experimental_use_cc_common_link` doesn't collect the link libraries from the `link` attribute.

You can reproduce the failure by running `bazelisk build -j 20 //:bin -s` in the reproduction repository, and if you disable cc_common linking, then you get a linker error, which disappears when linking with cc_common.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.