rust: Link staticlib/cdylib link targets like link targets from any other language

staticlib/cdylib only provide a C ABI, i.e. contain no Rust metadata,
and can be linked like a link target from any other language.
pull/11667/head
Sebastian Dröge 2 years ago committed by Xavier Claessens
parent a787b0cd5f
commit e184fc84b3
  1. 5
      mesonbuild/backend/ninjabackend.py

@ -1904,7 +1904,10 @@ class NinjaBackend(backends.Backend):
# TODO: we likely need to use verbatim to handle name_prefix and name_suffix
for d in target.link_targets:
linkdirs.add(d.subdir)
if d.uses_rust():
# staticlib and cdylib provide a plain C ABI, i.e. contain no Rust
# metadata. As such they should be treated like any other external
# link target
if d.uses_rust() and d.rust_crate_type not in ['staticlib', 'cdylib']:
# specify `extern CRATE_NAME=OUTPUT_FILE` for each Rust
# dependency, so that collisions with libraries in rustc's
# sysroot don't cause ambiguity

Loading…
Cancel
Save