-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
External dependencies should have a features = ["-please_disable_this_feature", ..."]
switch
#16273
Comments
/cc @oquenchil |
This can be solved with a module extension when the community migrates to Bzlmod. You can have a module extension (e.g. provided by rules_cc) to generate a repo for each C++ module, which contains a list of features that should be enabled/disabled. For example, for C++ module "foo":
At the beginning of foo's BUILD files
Then the root module can use the same module extension to override what features should be given to a specific module.
|
The problem statement document (https://docs.google.com/document/d/1moQfNcEIttsk6vYanNKIy3ZuK53hQUFq1b1r0rmsYVg/edit#heading=h.xxnnwabymk1v) is interesting, and helps shed light on what I'm dealing with. Is there any solution -- hackish or otherwise -- that I can implement in bazel 4.2.1? |
Well, you can certainly patch your external dependencies, right? |
Okay. I was hoping for something a little less "all-in". |
@aaron-michaux 😅 Sorry, I cannot think of any better solution. |
This bazel-discuss thread has another example of a situation where this would be useful: https://groups.google.com/g/bazel-discuss/c/YiFe0KR77xM/m/pBfxl5C2BAAJ |
Description of the feature request:
Some external dependencies are already "bazelified", such as grpc, which is a blessing and a curse. The problem is that your toolchain is going to pass down all the flags for all your enabled features, including things like "-D_FORTIFY_SOURCE", and "-Werror", and then your dependency will fail to build.
When supplying your own BUILD file for a non-bazelified repo, you can switch things off:
If I could do something like this:
What underlying problem are you trying to solve with this feature?
Obviously, with all the code in the world, in various states of shininess, it becomes important to be able to control which flags are used to build the code. And that shouldn't create a "lowest-common-denominator" burden for downstream code. In theory, I should be able to be as pedantic as I want, and still be able to build and link to code written by more pragmatically oriented development teams.
Which operating system are you running Bazel on?
Ubuntu 20.04
What is the output of
bazel info release
?release 4.2.1
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?No response
Have you found anything relevant by searching the web?
https://stackoverflow.com/questions/63588902/in-bazel-how-to-prevent-some-c-compiler-flags-from-passing-to-external-depend
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: