Skip to content

Commit 789a257

Browse files
committed
ninjabackend: fix linking of non-bundled static libraries on rustc macos
rustc -lstatic+verbatim=filename is not portable, given that linkers may not support passing unmodified filenames. If we use -bundle, then also use -verbatim (default) and let the system linker find the library by adding prefix/suffix itself. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
1 parent a48754c commit 789a257

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

mesonbuild/backend/ninjabackend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,7 +2048,7 @@ def _link_library(libname: str, static: bool, bundle: bool = False) -> None:
20482048
modifiers = []
20492049
if not bundle and static:
20502050
modifiers.append('-bundle')
2051-
if verbatim:
2051+
elif verbatim:
20522052
modifiers.append(verbatim)
20532053
if modifiers:
20542054
type_ += ':' + ','.join(modifiers)
@@ -2094,7 +2094,7 @@ def _link_library(libname: str, static: bool, bundle: bool = False) -> None:
20942094
link_whole = d in target.link_whole_targets
20952095
if isinstance(target, build.StaticLibrary) or (isinstance(target, build.Executable) and rustc.get_crt_static()):
20962096
static = isinstance(d, build.StaticLibrary)
2097-
libname = os.path.basename(lib) if verbatim else d.name
2097+
libname = os.path.basename(lib) if (verbatim and link_whole) else d.name
20982098
_link_library(libname, static, bundle=link_whole)
20992099
elif link_whole:
21002100
link_whole_args = rustc.linker.get_link_whole_for([lib])

0 commit comments

Comments
 (0)