Skip to content

Conversation

aherrmann
Copy link
Owner

Adds support to provide a cc_shared_library target as a dependency of a cc_library|binary|test target (or similar).

To that end cc_shared_library emits a CcInfo provider that captures the generated dynamic library. However, Bazel's CC API requires a CC toolchain to generated a CcInfo for a dynamic library. cc_shared_library registers an optional dependency on a CC toolchain. The CcInfo is only emitted if that CC toolchain dependency is filled.

Adds e2e and analysis tests for direct and transitive Zig shared library dependencies of CC targets and tests that the CC toolchain dependency is indeed optional.

  • Add e2e test for Zig library as C dependency
  • Emit CcInfo for zig_shared_library
  • zig_shared_library optional CC toolchain dependency
  • zig_shared_library depends on cpp fragment
  • Pass feature_configuration and cc_toolchain
  • Forward requested and disabled features
  • Mark test as small
  • Only request cctoolchain when needed
  • Create analysis test for simple shared library
  • Analysis test for optional cc toolchain dependency
  • rename C add-test
  • Test transitive C dependency
  • Forward transitive CcInfo
  • analysis test case for transitive solib
  • Analysis test for transitive shared libraries
  • Fix simple shared library analysis tests
  • Update generated files and formatting

@aherrmann
Copy link
Owner Author

Required for #14 and #428.

These caused runtime errors of the following form with remote
execution enabled.
```
/buildbuddy-execroot/bazel-out/k8-fastbuild/bin/cc-dependencies/shared-library/add-test.runfiles/_main/cc-dependencies/shared-library/add-test: Relink `/buildbuddy-execroot/bazel-out/k8-fastbuild/bin/cc-dependencies/shared-library/add-test.runfiles/_main/cc-dependencies/shared-library/../../_solib_k8/_U_S_Scc-dependencies_Sshared-library_Cadd___Ucc-dependencies_Sshared-library/libadd.so' with `/lib/x86_64-linux-gnu/libm.so.6' for IFUNC symbol `cosf'
```
@aherrmann aherrmann enabled auto-merge March 15, 2025 21:15
@aherrmann aherrmann merged commit 3ca08c3 into main Mar 15, 2025
63 checks passed
@aherrmann aherrmann deleted the cc-info-lib branch March 15, 2025 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant