-
Notifications
You must be signed in to change notification settings - Fork 38
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
Enable supports_dynamic_linker feature on darwin #326
Conversation
The `supports_dynamic_linker` is not turned on, resulting shared library is not producde by cc_library or cc_test Ref: bazelbuild/bazel#16479 https://github.com/bazelbuild/bazel/blob/c5cb07ac4603cef03d7037d603971e1f4e9184c9/src/main/starlark/builtins_bzl/common/cc/cc_library.bzl#L94
The linked ref also mentioned it was removed due to bazelbuild/bazel@ec55533. But I'm not sure if it's safe to enable just on darwin. |
It's not safe to. For the same reason from that commit message. There are some other threads about this around too I can probably dig up later |
Thanks for the reply @keith . In that case is |
Yes. You can also use cc_binary with the linkshared attribute. The difference being both of those require you to fully specify your deps to move issues to link time instead of runtime |
Thank you! |
related links:
the general issue is that when you were creating this type of library you would link your static library as a dylib without any of your dependencies, and any symbols that weren't there were just assumed to exist at runtime. This is very much against the model that apple platforms try to enforce of having all symbols understood at link time. I believe the reason this is ok on linux is that |
I see, thanks for you detailed reply. I now understands the limitation on macOS. I do have a generic question regarding those cc_* rules after reading your reply though. If I want to produce a shared library for binary redistribution, for example I want to submit libmyproject to homebrew. Is it true that I would better use cc_binary or cc_shared_library instead of cc_library, as the later is intended for intermediate usage? The reason I'm asking this is because it seems |
i think you'd be better off with |
Thank you again! I will have a try of that flag! |
The
supports_dynamic_linker
is not turned on, resulting shared library is not producde by cc_library or cc_testRef: bazelbuild/bazel#16479 https://github.com/bazelbuild/bazel/blob/c5cb07ac4603cef03d7037d603971e1f4e9184c9/src/main/starlark/builtins_bzl/common/cc/cc_library.bzl#L94