feat(foreign-cc): derive runtime library search directories#1536
Draft
jsun-splunk wants to merge 1 commit into
Draft
feat(foreign-cc): derive runtime library search directories#1536jsun-splunk wants to merge 1 commit into
jsun-splunk wants to merge 1 commit into
Conversation
b9adfbf to
641ee6a
Compare
2ecebfa to
35f722c
Compare
9466108 to
ee25ba1
Compare
d7a0e51 to
497b12d
Compare
a1eda81 to
0284492
Compare
47d6468 to
cb4638f
Compare
Add opt-in runtime library search directory derivation for foreign_cc
outputs. This lets foreign-built binaries and shared libraries resolve
shared libraries from `deps`, `dynamic_deps`, and this rule's own declared
shared-library outputs without relying on loader environment variables such
as `LD_LIBRARY_PATH`.
Public attrs:
- `runtime_library_search_directories`
- `additional_dynamic_runtime_library_search_origins`
- `additional_executable_runtime_library_search_origins`
Example:
```python
configure_make(
name = "python",
out_binaries = ["python3.10"],
out_shared_libs = ["libpython3.10.so"],
runtime_library_search_directories = "enabled",
additional_dynamic_runtime_library_search_origins = [
"lib/python3.10/lib-dynload",
],
deps = [":openssl"],
)
```
`runtime_library_search_directories` accepts `auto`, `enabled`, and
`disabled`. The global build setting defaults to `disabled`, so existing
targets keep the previous behavior unless a target opts in or the build
setting is enabled.
Default origins are derived from declared output `File.short_path` values.
Shared-library link actions use declared shared-library output directories.
Executable link actions use declared binary output directories. Additional
origins are install-tree-relative paths joined under this rule's INSTALLDIR.
The implementation derives dependency origins from `LibraryToLink` dynamic
libraries and adds Bazel `_solib` sibling search paths for solib symlink
layouts. Runtime search derivation is skipped for Windows C++ toolchains.
Wire the runtime search path flags as common implementation flags.
However, support is limited to `cmake`, `configure_make`, `make` and
`meson`. `Ninja` and `boost` support is currently disabled.
Add unit coverage for enablement, default origins, additional origins,
self-output search paths, `_solib` paths, deduplication, and global
build-setting resolution. Add integration coverage for runtime
dependency chains and self-contained output bundles.
cb4638f to
ca0d499
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add opt-in runtime library search directory derivation for foreign_cc
outputs. This lets foreign-built binaries and shared libraries resolve
shared libraries from
deps,dynamic_deps, and this rule's own declaredshared-library outputs without relying on loader environment variables such
as
LD_LIBRARY_PATH.Public attrs:
runtime_library_search_directoriesadditional_dynamic_runtime_library_search_originsadditional_executable_runtime_library_search_originsExample:
runtime_library_search_directoriesacceptsauto,enabled, anddisabled. The global build setting defaults todisabled, so existingtargets keep the previous behavior unless a target opts in or the build
setting is enabled.
Default origins are derived from declared output
File.short_pathvalues.Shared-library link actions use declared shared-library output directories.
Executable link actions use declared binary output directories. Additional
origins are install-tree-relative paths joined under this rule's INSTALLDIR.
The implementation derives dependency origins from
LibraryToLinkdynamiclibraries and adds Bazel
_solibsibling search paths for solib symlinklayouts. Runtime search derivation is skipped for Windows C++ toolchains.
Wire the runtime search path flags as common implementation flags.
However, support is limited to
cmake,configure_make,makeandmeson.Ninjaandboostsupport is currently disabled.Add unit coverage for enablement, default origins, additional origins,
self-output search paths,
_solibpaths, deduplication, and globalbuild-setting resolution. Add integration coverage for runtime
dependency chains and self-contained output bundles.
Depends on #1401.