diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2025-09-12 15:35:31 +0200 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2025-10-08 10:51:48 -0700 |
| commit | 2a6a7a9f14a7eed75efbe0eff6659e57b45c5f3c (patch) | |
| tree | 2c528d50e04390a62b15bb149eb00fa27416f3c6 /mesonbuild/backend | |
| parent | 018d224821f91c1d352e71b59e35e6f2fe64b119 (diff) | |
| download | meson-2a6a7a9f14a7eed75efbe0eff6659e57b45c5f3c.tar.gz | |
ninjabackend: rust: fail on unsupported library names
When verbatim is not available, libraries that have custom name_prefix or
name_suffix will not be found. Fail the build completely instead of
ending up with a bad option.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mesonbuild/backend')
| -rw-r--r-- | mesonbuild/backend/ninjabackend.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 4e8af9545..fb5d164b1 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -2041,6 +2041,7 @@ class NinjaBackend(backends.Backend): has_verbatim = mesonlib.version_compare(rustc.version, '>= 1.67.0') def _link_library(libname: str, static: bool, bundle: bool = False) -> None: + orig_libname = libname type_ = 'static' if static else 'dylib' modifiers = [] # Except with -Clink-arg, search is limited to the -L search paths @@ -2052,9 +2053,14 @@ class NinjaBackend(backends.Backend): modifiers.append('+verbatim') else: # undo the effects of -l without verbatim + badname = not is_library(libname) libname, ext = os.path.splitext(libname) if libname.startswith('lib'): libname = libname[3:] + else: + badname = True + if badname: + raise MesonException(f"rustc does not implement '-l{type_}:+verbatim'; cannot link to '{orig_libname}' due to nonstandard name") if modifiers: type_ += ':' + ','.join(modifiers) |
