diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 1e5a13e7325f..09f84f12d4e6 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -611,7 +611,7 @@ def rpaths_for_bundled_shared_libraries(self, target, exclude_system=True):
         for dep in target.external_deps:
             if not isinstance(dep, (dependencies.ExternalLibrary, dependencies.PkgConfigDependency)):
                 continue
-            la = dep.link_args
+            la = dep.get_link_args(raw=True)
             if len(la) != 1 or not os.path.isabs(la[0]):
                 continue
             # The only link argument is an absolute path to a library file.
diff --git a/run_unittests.py b/run_unittests.py
index 0b18ef55b402..591800db6cb4 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -7858,7 +7858,7 @@ def test_static_link(self):
         # Test that installed libraries works
         self.new_builddir()
         self.prefix = oldprefix
-        meson_args = [f'-Dc_link_args=-L{libdir}',
+        meson_args = [f'-Dc_link_args=-L{libdir} -Wl,-rpath,{libdir}',
                       '--fatal-meson-warnings']
         testdir = os.path.join(self.unit_test_dir, '67 static link')
         env = {'PKG_CONFIG_LIBDIR': os.path.join(libdir, 'pkgconfig')}