bazel-contrib / bazel-contrib/rules_foreign_cc

How to get the output lib directory to set an environment variable

Open
#1,197 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
737
Forks
270
PR merge metrics
No merged PRs in 30d

Description

Thanks for the help in advance. I have a `cmake` rule defined somewhere, which builds Iceoryx. The build results are some header files, some CMake files and some libraries, as specified in the following code section.

In one of the rather strange test, I need to set `LD_LIBRARY_PATH` so that an executable can find the libraries built by `@iceoryx//:iceoryx` target. Can I get some advice how to query that information? Thanks!

```
cmake(
name = "iceoryx",
build_args = [
"--target install",
"-j $$(nproc)",
],
cache_entries = {
...
},
copts = [
...
],
lib_source = ":srcs",
out_binaries = ["iox-roudi"],
out_data_dirs = [
"lib/cmake",
"lib/pkgconfig",
"etc",
],
out_shared_libs = [
"libiceoryx_binding_c.so",
"libiceoryx_hoofs.so",
"libiceoryx_platform.so",
"libiceoryx_posh_config.so",
"libiceoryx_posh_gateway.so",
"libiceoryx_posh_roudi.so",
"libiceoryx_posh.so",
],
visibility = ["//visibility:public"],
working_directory = "iceoryx_meta",
deps = ["@acl"],
tags = ["requires-network"],
)
```

Contributor guide

Open the contributing guide

Research direction

Start with the shown cmake rule, especially out_shared_libs and out_data_dirs, and trace how the @iceoryx//:iceoryx target exposes its generated outputs. Determine how that output location can be queried for LD_LIBRARY_PATH in the described test. Done means the issue has clear guidance for locating the libraries and setting the environment variable.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake
Domain
build-system
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.