bazelbuild / bazelbuild/rules_rust

Generated libraries with the same name fail to link

Open
#3,735 6 comments 0 reactions 1 assignee Claimed by @krasimirgg View on GitHub
needs-triage
Dominant language
Starlark
Stars
843
Forks
651
Avg merge
2d 18h
Merged PRs (30d)
15

Description

If Rust tries to link against two generated libraries with the same name, there will be the error:
```
ld.lld: error: undefined symbol: app_function
>>> referenced by app.1555d9328bfdc04c-cgu.0
>>> bazel-out/k8-fastbuild/bin/app.app.1555d9328bfdc04c-cgu.0.rcgu.o:(app::main::h288a2b8d569cac4d)
collect2: error: ld returned 1 exit status
```

Possible breaking change introduced here: https://github.com/bazelbuild/rules_rust/pull/3647

It's likely the `depsets` before allowed same name binaries to exist due to a nested structure.

Example which shows the breaking change along with workarounds:
https://github.com/finn-ball/rules_rust_binary_clash
[rules_rust_binary_clash-main.zip](https://github.com/user-attachments/files/29808680/rules_rust_binary_clash-main.zip)

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.