bazel-skylib icon indicating copy to clipboard operation
bazel-skylib copied to clipboard

Feature Request: native_binary to support shared library dependency

Open tsawada opened this issue 3 years ago • 1 comments

I would like to run a precompiled binary that depends on precompiled .so libraries distributed together. I tried putting it in runfiles via data dependency using filegroup(srcs = ["*.so"]) but it doesn't work. I think I still need to tweak rpath.

It'd be great if it is easy to run such binary with native_binary.

tsawada avatar Jul 22 '22 17:07 tsawada

I'm not sure if there is a clean and general way to implement such a feature in native_binary. Consider, for example, how to distinguish .so files that are early loading-time dependencies ($LD_PRELOAD) vs. normal loading-time dependencies ($LD_LIBRARY_PATH) vs. later run-time dependencies (dynamic plugins).

I think that if you need to run a bundle consisting of a precompiled binary and a bunch of dynamic lib deps, the best solution might be to write a little shell script - and thus, use an sh_binary.

tetromino avatar Jul 26 '22 19:07 tetromino