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
v 5 cc_library, linkstatic=False fails to emit .so file #16271
Comments
For the record, I prefer the 4.2.0 way, emitting both files. |
On Fri, Sep 16, 2022 at 7:38 AM oquenchil ***@***.***> wrote:
I thought this could be explained by rewriting cc_library to Starlark but
as far as I can see the logic is the same. See here
<https://cs.opensource.google/bazel/bazel/+/master:src/main/starlark/builtins_bzl/common/cc/cc_library.bzl;drc=eb181661ff7e72781f46b7994a5e5c9bab45d5dd;l=239-260>
and here
<https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java;drc=3e13f4cbb60bfcd7edd3949184cda42f0785fe54;l=414-435>
.
Is dynamic linking enabled in your toolchain?
Not sure what you mean. I'm not using a custom toolchain, just whatever
bazel discovers on my Mac, which is just the xcode toolchain.
… @keith <https://github.com/keith> have you noticed anything similar on
Mac yourself?
—
Reply to this email directly, view it on GitHub
<#16271 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAES2NGRV74KUHXIKDYSI5DV6RS5NANCNFSM6AAAAAAQLWZMSE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
The default mac toolchain stopped supporting dynamic linking in 5.0: ec55533 |
I hadn't noticed this, but that commit looks pretty intentional about disabling this 🤔 |
On Fri, Sep 16, 2022 at 9:55 AM pcjanzen ***@***.***> wrote:
The default mac toolchain stopped supporting dynamic linking in 5.0:
ec55533
<ec55533>
What does that mean? Pretty sure Apple did not stop supporting .so files
or dlopen. cc_binary with linkshared=True seems to work. I don't fully
understand the problem that change was supposed to fix, but it is a
breaking change. Anyway "stop supporting dynamic linking" and "make
cc_library stop emitting .so files" are different things, from my
perspective.
… —
Reply to this email directly, view it on GitHub
<#16271 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAES2NFZBSHF5XXPQE3RL6TV6SC5LANCNFSM6AAAAAAQLWZMSE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
@trybka Do you have some background for this? |
The feature There is a lot more detail in #4341 (comment). TL;DR these .so files do not work properly on Apple platforms. I believe if you want functional .so files you should use |
Description of the bug:
Under version 4.2.0, the following emits libalpha.a and libalpha.so
cc_library(
name = "alpha",
srcs = [
"alpha.c",
],
linkstatic = False,
)
Under version 5 and up, it only emits libalpha.a
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
In a fresh directory:
.bazelversion
BUILD.bazel:
WORKSPACE.bazel:
alpha.c:
Then, setting .bazelversion to 4.2.0:
Change .bazelversion to 5.0.0:
Same result for .bazelversion 5.3.0, latest, and last_green
Which operating system are you running Bazel on?
MacOS Monterey 12.5.1
What is the output of
bazel info release
?Depends on what's in .bazelversion
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.Tested with .bazelversion last_green, which gives:
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?The text was updated successfully, but these errors were encountered: