rules_foreign_cc icon indicating copy to clipboard operation
rules_foreign_cc copied to clipboard

Set `copt` for internal tools like `make` and `pkgconfig`

Open mering opened this issue 1 year ago • 4 comments

Please add some way to pass compiler flags for building the rules_foreign_cc internal tools.

We want to build our own code base with -Werror but we don't have a way to disable warnings for those external tool we don't have control over.

mering avatar Nov 29 '24 12:11 mering

rules_foreign_cc could definitely expose some starlark flags for this type of thing. I think using --host_copt does apply to some of these now, but that might be too wide for what you want. You could also patch in the flags until this is resolved:

https://github.com/bazel-contrib/rules_foreign_cc/blob/be14ccaec581826e7eef97277ffde05cc0d8d868/foreign_cc/built_tools/make_build.bzl#L101-L101

keith avatar Dec 02 '24 18:12 keith

@keith Thanks for the code hint. Although I explicitly want to enable -Werror also for --host_copt to build all of our own tools with -Werror as well.

mering avatar Dec 03 '24 09:12 mering

PRs would be welcome in this area but this isn't something that I'll have bandwidth to get to doing anytime in the near future.

jsharpe avatar Dec 06 '24 20:12 jsharpe

It appears that it might be possible to do it via --repo_env=BAZEL_CONLYOPTS=-Werror , but that might not be what you want globally.

baryluk avatar Jun 30 '25 12:06 baryluk