Skip to content

Conversation

@katzdm
Copy link

@katzdm katzdm commented Nov 21, 2025

Linker inputs for dependencies of cc_shared_library are currently passing their linkopts as a depset, which leads to deduplication of the flags thereby passed. Consequently, a sequence of well-formed flags like -framework Security -framework IOKit gets collapsed to -framework Security IOKit; the linker then interprets IOKit as an object file that it's unable to locate, which yields a malformed link line.

Passing linkopts directly rather than wrapping it in depset appears to resolve the issue. I've added a test that replicates the original issue; since -framework isn't meaningful on all platforms, I've only enabled it for MacOS.

Note that the tests in this repository utilize the rules_cc repository rather than the built-in rules; therefore, I don't think the new test can be expected to pass until the change has been propagated there, and the controlling MODULE.bazel.lock entry has been updated. I've tested it locally by cating a local_path_override directive to the MODULE.bazel file that gets synthesized for these tests, in order to point the tests towards a local fork of rules_cc with this same change applied; under these conditions, the test passes.

Closes #27735.

@google-cla
Copy link

google-cla bot commented Nov 21, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions github-actions bot added the awaiting-review PR is awaiting review from an assigned reviewer label Nov 21, 2025
@katzdm katzdm force-pushed the deduplicated-linkopts branch from afd371f to 65bf666 Compare November 21, 2025 13:57
Copy link
Collaborator

@fmeum fmeum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fmeum
Copy link
Collaborator

fmeum commented Nov 21, 2025

@bazel-io fork 9.0.0

@bharadwaj08-one
Copy link

@katzdm Could you please take a look at the failing checks?

@bharadwaj08-one bharadwaj08-one added awaiting-user-response Awaiting a response from the author and removed awaiting-review PR is awaiting review from an assigned reviewer labels Nov 24, 2025
@katzdm
Copy link
Author

katzdm commented Nov 24, 2025

@bharadwaj08-one Please see the explanation in the PR description:

Note that the tests in this repository utilize the rules_cc repository rather than the built-in rules; therefore, I don't think the new test can be expected to pass until the change has been propagated there, and the controlling MODULE.bazel.lock entry has been updated. I've tested it locally by cating a local_path_override directive to the MODULE.bazel file that gets synthesized for these tests, in order to point the tests towards a local fork of rules_cc with this same change applied; under these conditions, the test passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-user-response Awaiting a response from the author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linkopts in transitive dependencies are deduplicated by cc_shared_library

4 participants