bazel-contrib / bazel-contrib/rules_go
ld: warning: ignoring duplicate libraries: '-lm'
- Dominant language
- Go
- Stars
- 1.5k
- Forks
- 762
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 12
Description
# ld: warning: ignoring duplicate libraries: '-lm'
## Environment
- Bazel: 9.1.1
- rules_go: (auto-resolved via Bzlmod, version unknown)
- OS: macOS (darwin_arm64)
- Toolchain: rules_go default Go SDK via Bzlmod
- Build mode: `CGO_ENABLED=1`
---
## Summary
After running `bazel clean`, subsequent `bazel build` / `bazel run` triggers a linker warning:
The warning appears during Go linking (`GoLink` step) when building targets using `rules_go`.
---
## Reproduction Steps
1. Clean Bazel output:
```bash
bazel clean
bazel run //xx/:app
```
Contributor guide
Research direction
Start by reproducing the issue with `bazel clean` followed by `bazel run //xx/:app` on macOS with `CGO_ENABLED=1`. Inspect the `GoLink` action and its linker inputs to determine where duplicate `-lm` flags are introduced. Done means the affected build and run targets complete without the duplicate-library warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100