From 49cde9653c904b7f3ddc6b42bb4cf1bd4646d162 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Wed, 25 Nov 2020 14:43:11 +0100 Subject: ninjabackend: Correct RPATH order [why] If we build and test a library we need to make sure that we find the currently build library object first, before an older system installed one. This can be broken if the library in question is installed in a custom path, and another library we depend on also is installed there. [how] Just move the rpath to the current build artifacts to the front. Solves #8030. Signed-off-by: Fini Jastrow --- .../unit/89 pkgconfig build rpath order/dummy.pc | 7 +++++++ .../unit/89 pkgconfig build rpath order/meson.build | 20 ++++++++++++++++++++ .../unit/89 pkgconfig build rpath order/prog.c | 5 +++++ .../unit/89 pkgconfig build rpath order/prog.cc | 8 ++++++++ .../89 pkgconfig build rpath order/sub/meson.build | 1 + .../unit/89 pkgconfig build rpath order/sub/stuff.c | 3 +++ 6 files changed, 44 insertions(+) create mode 100644 test cases/unit/89 pkgconfig build rpath order/dummy.pc create mode 100644 test cases/unit/89 pkgconfig build rpath order/meson.build create mode 100644 test cases/unit/89 pkgconfig build rpath order/prog.c create mode 100644 test cases/unit/89 pkgconfig build rpath order/prog.cc create mode 100644 test cases/unit/89 pkgconfig build rpath order/sub/meson.build create mode 100644 test cases/unit/89 pkgconfig build rpath order/sub/stuff.c (limited to 'test cases') diff --git a/test cases/unit/89 pkgconfig build rpath order/dummy.pc b/test cases/unit/89 pkgconfig build rpath order/dummy.pc new file mode 100644 index 000000000..9e3048b24 --- /dev/null +++ b/test cases/unit/89 pkgconfig build rpath order/dummy.pc @@ -0,0 +1,7 @@ +prefix=/foo +libdir=${prefix}/dummy + +Name: dummy +Description: Nonexisting lib but add an rpath +Version: 1.0.0 +Libs: -Wl,-rpath,${libdir} diff --git a/test cases/unit/89 pkgconfig build rpath order/meson.build b/test cases/unit/89 pkgconfig build rpath order/meson.build new file mode 100644 index 000000000..76ed8de25 --- /dev/null +++ b/test cases/unit/89 pkgconfig build rpath order/meson.build @@ -0,0 +1,20 @@ +project('build rpath', 'c', 'cpp') + +subdir('sub') +pkgconf_dep = dependency('dummy') + +executable('prog', 'prog.c', + dependencies : pkgconf_dep, + link_with : l, + build_rpath : '/foo/bar', + install_rpath : '/baz', + install : true, + ) + +executable('progcxx', 'prog.cc', + dependencies : pkgconf_dep, + link_with : l, + build_rpath : '/foo/bar', + install_rpath : 'baz', + install : true, + ) diff --git a/test cases/unit/89 pkgconfig build rpath order/prog.c b/test cases/unit/89 pkgconfig build rpath order/prog.c new file mode 100644 index 000000000..45b2fa3df --- /dev/null +++ b/test cases/unit/89 pkgconfig build rpath order/prog.c @@ -0,0 +1,5 @@ +int get_stuff(); + +int main(int argc, char **argv) { + return get_stuff(); +} diff --git a/test cases/unit/89 pkgconfig build rpath order/prog.cc b/test cases/unit/89 pkgconfig build rpath order/prog.cc new file mode 100644 index 000000000..c7c212370 --- /dev/null +++ b/test cases/unit/89 pkgconfig build rpath order/prog.cc @@ -0,0 +1,8 @@ +#include +#include + +int main(int argc, char **argv) { + std::string* s = new std::string("Hello"); + delete s; + return 0; +} diff --git a/test cases/unit/89 pkgconfig build rpath order/sub/meson.build b/test cases/unit/89 pkgconfig build rpath order/sub/meson.build new file mode 100644 index 000000000..6879ec666 --- /dev/null +++ b/test cases/unit/89 pkgconfig build rpath order/sub/meson.build @@ -0,0 +1 @@ +l = shared_library('stuff', 'stuff.c') diff --git a/test cases/unit/89 pkgconfig build rpath order/sub/stuff.c b/test cases/unit/89 pkgconfig build rpath order/sub/stuff.c new file mode 100644 index 000000000..d56d8b0ea --- /dev/null +++ b/test cases/unit/89 pkgconfig build rpath order/sub/stuff.c @@ -0,0 +1,3 @@ +int get_stuff() { + return 0; +} -- cgit v1.3