-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Building shared objects: is there any way to stop cc_libraries from generating non-PIC static libraries? #1740
Comments
I also noticed that Bazel has the notion of an implicit output of a rule. Sadly, currently |
Hey, I just noticed that under You really want to document these when it's complex like this :O |
You can disable PIC in your CROSSTOOL, if you'd like. There's a needsPic field. re: implicit outputs, we're trying to remove them across the board for c++. We want to make the c++ rules suitable for other platforms, and implicit outputs produce platform-specific artifacts. For example, a Windows cc_library would produce a .lib, not a .a. Sorry you've had to wait so long for me to engage on this. And yes, we certainly need to more broadly document the cc rules |
@calpeyser That sounds nice. I guess disabling needsPic and adding -fpic as the default compiler option should work for me. |
Adding fuel to the fire here: in -c opt mode, a library produces both ".a" and ".pic.a" outputs; if you have a genrule downstream that needs to consume this output, this makes it hard to do so, since you need to use |
Is there anything that needs to be done here? Feel free to reopen if yes. I guess Steven's point is valid, so if you still think this should be fixed, please open a separate issue. Thank you everybody! |
Here's an example:
which is what I believe the currently recommended idiom for building a shared object.
Here's the question:
if I type
bazel build //...:all
, all source code in librariesfoo
,bar
andbaz
will be built twice, once with -fPIC and once without. However, since I have no actual use with the non-fPIC versions, such building time and energy is wasted.Is there some way to fix this?
Thanks.
The text was updated successfully, but these errors were encountered: