Skip to content

Shared libraries with binaries #31

@sohaibiftikhar

Description

@sohaibiftikhar

So usually if I build a binary that needs a shared library (which is not installed in the system) I can do something like add a directory structure:

bin
  |-- my_ _bin
lib
  |-- shared_lib.so

And then when linking in the shared lib set the rpath as $ORIGIN/../lib/ which helps discover the shared libs.
How do I do this with the cc_rules? I can see that the shared lib never makes it to the plz-out/bin so setting something relative seems hard.

Even if I add an additional lib to the output directory using the optional_outs it still does not make it to the plz-out/bin directory which makes running things which need a shared library hard with plz run //path/to/executable. Any suggestions/help with this would be nice.

Currently I have something like:

linker_flags = ["--rpath=$ORIGIN/../../gen/path/to/mylib/"]

Which is pretty nasty (and not very scalable sadly)
Ideally this should be just --rpath=$ORIGIN/../path/to/mylib/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions