| commit | 991d63860b8a2e5ad00c26ebe0632a06c18e9ee6 | [log] [tgz] |
|---|---|---|
| author | Dan Katz <katzdm@gmail.com> | Wed Dec 17 17:42:06 2025 -0800 |
| committer | Copybara-Service <copybara-worker@google.com> | Wed Dec 17 17:43:44 2025 -0800 |
| tree | 529178958ba7cae65845d20d72f73c96410dfc24 | |
| parent | d6dc63124242e697b6896777db0ca83c103643b5 [diff] |
Avoid deduplicating linkopts of cc_shared_library dependencies. 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](https://github.com/bazelbuild/bazel/blob/HEAD/src/test/tools/bzlmod/MODULE.bazel.lock#L113) has been updated. I've tested it locally by `cat`ing a `local_path_override` directive to the `MODULE.bazel` file that [gets synthesized](https://github.com/bazelbuild/bazel/blob/e887cfbfd641f57a3cdd950249daf9b568ebaeb5/src/main/starlark/tests/builtins_bzl/cc_builtin_tests.sh#L49) 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. Closes #27755. PiperOrigin-RevId: 845984933 Change-Id: I5606b9f6f61e699f829d19bd34cb672026d50e50
{Fast, Correct} - Choose two
Build and test software of any size, quickly and reliably.
Speed up your builds and tests: Bazel rebuilds only what is necessary. With advanced local and distributed caching, optimized dependency analysis and parallel execution, you get fast and incremental builds.
One tool, multiple languages: Build and test Java, C++, Android, iOS, Go, and a wide variety of other language platforms. Bazel runs on Windows, macOS, and Linux.
Scalable: Bazel helps you scale your organization, codebase, and continuous integration solution. It handles codebases of any size, in multiple repositories or a huge monorepo.
Extensible to your needs: Easily add support for new languages and platforms with Bazel's familiar extension language. Share and re-use language rules written by the growing Bazel community.
Follow our tutorials:
To report a security issue, please email security@bazel.build with a description of the issue, the steps you took to create the issue, affected versions, and, if known, mitigations for the issue. Our vulnerability management team will respond within 3 working days of your email. If the issue is confirmed as a vulnerability, we will open a Security Advisory. This project follows a 90 day disclosure timeline.
See CONTRIBUTING.md