diff options
| author | Seán de Búrca <leftmostcat@gmail.com> | 2025-07-13 09:51:40 -0700 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2025-07-19 10:31:20 -0700 |
| commit | bf864662b6b7fa4ffed846fb9b3c76cba8fafc49 (patch) | |
| tree | f6a7a030ca41fcb8214d4bfa9937f97c75055d0d /mesonbuild/backend/ninjabackend.py | |
| parent | ab261f9951f235c776b8664fbdbf0365a8cf535d (diff) | |
| download | meson-bf864662b6b7fa4ffed846fb9b3c76cba8fafc49.tar.gz | |
Always add libdirs to rustc command
This works around an issue in which meson provides absolute paths to
rustc, but rustc pulls metadata from an external rlib and adds link args
without adding library paths.
Fixes: #14622
Diffstat (limited to 'mesonbuild/backend/ninjabackend.py')
| -rw-r--r-- | mesonbuild/backend/ninjabackend.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index bca6876e6..ba75ce737 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -2096,20 +2096,24 @@ class NinjaBackend(backends.Backend): for a in e.get_link_args(): if a in rustc.native_static_libs: # Exclude link args that rustc already add by default - pass + continue elif a.startswith('-L'): args.append(a) - elif a.endswith(('.dll', '.so', '.dylib', '.a', '.lib')) and isinstance(target, build.StaticLibrary): + continue + elif a.endswith(('.dll', '.so', '.dylib', '.a', '.lib')): dir_, lib = os.path.split(a) linkdirs.add(dir_) - if not verbatim: - lib, ext = os.path.splitext(lib) - if lib.startswith('lib'): - lib = lib[3:] - static = a.endswith(('.a', '.lib')) - _link_library(lib, static) - else: - args.append(f'-Clink-arg={a}') + + if isinstance(target, build.StaticLibrary): + if not verbatim: + lib, ext = os.path.splitext(lib) + if lib.startswith('lib'): + lib = lib[3:] + static = a.endswith(('.a', '.lib')) + _link_library(lib, static) + continue + + args.append(f'-Clink-arg={a}') for d in linkdirs: d = d or '.' |
