configure_make should have instructions how to get at the built binaries
It would be nice to have an example of how one can reference a binary named in configure_make.out_binaries.
This is useful if you want to use such a built binary in a toolchain definition. You'd have:
Say I have:
configure_make(
name = "t"
# ...
out_binaries = [ "foo" ],
)
How do I invoke the built foo from say within a build rule?
It seems that t.output_groups has something useful, but extracting content from there seems clunky.
In any case, it would seem useful to have that documented in https://bazelbuild.github.io/rules_foreign_cc/main/configure_make.html
https://github.com/bazelbuild/rules_foreign_cc/issues/376 has some useful information, but ideally this would be front and center in the official docs.
See runnable_binary:
https://github.com/bazelbuild/rules_foreign_cc/blob/e3699b940f5965c5ad56d35b322fa2b11e4452f7/examples/third_party/openssl/BUILD.openssl.bazel#L126
Yes, thank you for the link; but this is something that should be documented too.
Also with a filegroup:
configure_make(
name = "make_foo",
...
out_binaries = ["foo", "bar"],
)
filegroup(
name = "foo_binary",
srcs = [":make_foo"],
output_group = "foo"
)
You can then reference it like $(execpath :foo_binary) etc.
Found in the examples directory.
Thank you - I think this should be part of the documentation for foreign_rules_cc.
The same thing doesn't seem to work for out_shared_libs. Is this expected?
The same thing doesn't seem to work for out_shared_libs. Is this expected?
I think https://github.com/bazelbuild/rules_foreign_cc/pull/1056 enabled that for shared and static libraries.
At least with 0.11.1, I see
% bazel cquery @openssl --output=starlark --starlark:expr="[f for f in target.output_groups]"
INFO: Analyzed target @@openssl//:openssl (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
["Configure_logs", "_hidden_top_level_INTERNAL_", "c_rehash", "gen_dir", "include", "libcrypto.a", "libcrypto.so.3", "libssl.a", "libssl.so.3", "openssl"]
INFO: Elapsed time: 0.091s, Critical Path: 0.00s
INFO: 0 processes.
INFO: Build completed successfully, 0 total actions
Notice the presence of libssl.so.3 and libcrypto.so.3.