]> rtime.felk.cvut.cz Git - coffee/buildroot.git/commit
cmake: Fix RPATH for host libraries built by CMake
authorJan Kundrát <jan.kundrat@cesnet.cz>
Mon, 12 Mar 2018 18:41:00 +0000 (19:41 +0100)
committerPeter Korsgaard <peter@korsgaard.com>
Tue, 13 Mar 2018 08:27:50 +0000 (09:27 +0100)
commit7d43534625ac06ae01987113e912ffaf1aec2302
treebc9465a96c9c03e21012dde7aecbedf38b8a6932
parent814a9c32aed47eb7fb3240ae58175846c7e2de48
cmake: Fix RPATH for host libraries built by CMake

The host shared libraries produced by CMake were missing a proper
DT_RPATH. That became a problem because the DT_RPATH handling is not
transitive by design.

Consider the following scenario:

- pkg-a provides a library (`liba`) which links to `libpcre`
- pkg-b provides a binary (`foo`) and a shared library (`libb`) which is
needed by that binary
- `libb` links to `liba`
- pkg-a and pkg-b are both built by CMake

In this scenario, `foo` is correctly marked with DT_RPATH pointing to
host/lib/, but that path is not used when (recursively) resolving PCRE's
symbols in `liba`. When attempting to run the `foo` binary, the linker
correctly finds both `liba` and `libb`, but it cannot find the
libpcre.so as built by Buildroot for host.

Signed-off-by: Jan Kundrát <jan.kundrat@cesnet.cz>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/pkg-cmake.mk