aboutsummaryrefslogtreecommitdiff
path: root/unittests/allplatformstests.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2021-11-15 17:44:34 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2021-12-22 12:12:11 +0530
commit06b1132f82eaaf805021b4b088701d9754e2af38 (patch)
treef0d27ceae0864a09cba5ac5a8295d3c0345b6459 /unittests/allplatformstests.py
parent95a4c6a62a925fc888e7c07ae3d9937c87e1c759 (diff)
downloadmeson-06b1132f82eaaf805021b4b088701d9754e2af38.zip
meson-06b1132f82eaaf805021b4b088701d9754e2af38.tar.gz
meson-06b1132f82eaaf805021b4b088701d9754e2af38.tar.bz2
Set RPATH for all non-system libs with absolute paths
If a pkg-config dependency has multiple libraries in it, which is the most common case when it has a Requires: directive, or when it has multiple -l args in Libs: (rare), then we don't add -Wl,-rpath directives to it when linking. The existing test wasn't catching it because it was linking to a pkgconfig file with a single library in it. Update the test to demonstrate this. This function was originally added for shared libraries in the source directory, which explains the name: https://github.com/mesonbuild/meson/pull/2397 However, since now it is also used for linking to *all* non-system shared libraries that we link to with absolute paths: https://github.com/mesonbuild/meson/pull/3092 But that PR is incomplete / wrong, because only adding RPATHs for dependencies that specify a single library, which is simply inconsistent. Things will work for some dependencies and not work for others, with no logical reason for it. We should add RPATHs for *all* libraries. There are no special length limits for RPATHs that I can find. For ELF, DT_RPATH or DT_RUNPATH are used, which are just stored in a string table (DT_STRTAB). The maximum length is only a problem when editing pre-existing tags. For Mach-O, each RPATH is stored in a separate LC_RPATH entry so there are no length issues there either. Fixes https://github.com/mesonbuild/meson/issues/9543 Fixes https://github.com/mesonbuild/meson/issues/4372
Diffstat (limited to 'unittests/allplatformstests.py')
-rw-r--r--unittests/allplatformstests.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py
index daa1385..7437d78 100644
--- a/unittests/allplatformstests.py
+++ b/unittests/allplatformstests.py
@@ -1595,7 +1595,7 @@ class AllPlatformTests(BasePlatformTests):
foo_dep = PkgConfigDependency('libfoo', env, kwargs)
# Ensure link_args are properly quoted
libdir = PurePath(prefix) / PurePath(libdir)
- link_args = ['-L' + libdir.as_posix(), '-lfoo']
+ link_args = ['-L' + libdir.as_posix(), '-lfoo', '-lanswer']
self.assertEqual(foo_dep.get_link_args(), link_args)
# Ensure include args are properly quoted
incdir = PurePath(prefix) / PurePath('include')