bazel-contrib / bazel-contrib/rules_foreign_cc

Skip adding linkopts for static library targets

Open
#905 2 comments 0 reactions 0 assignees View on GitHub
Can Close?
Dominant language
Starlark
Stars
737
Forks
270
PR merge metrics
No merged PRs in 30d

Description

One thing I've noticed with rules_foreign_cc in envoy is that if I pass `--linkopt=-foo` to debug something or try a new option, it invalidates all rules_foreign_cc rules. I haven't dug in but my assumption is that linkopts are added to cmake etc configs for every rule even if we're only producing static libraries based on the attributes for the rule.

Do you think it would be safe to exclude them in that case? I worry that it's up to the tools to also use those for other things, so missing important linkopts like `-L/path/to/system/libs` might break even the setup of cmake, even if the target doesn't use it. But ideally these rules would be more stable in this case otherwise.

Contributor guide

Open the contributing guide

Research direction

Start by tracing how rules_foreign_cc processes linkopts and determines whether a target produces static libraries, then inspect the generated CMake or other build configuration inputs. Done means linkopts no longer invalidate static-library targets unnecessarily while options required for configuring or building those targets still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.