aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/ninjabackend.py
diff options
context:
space:
mode:
authorAdam C. Foltzer <acfoltzer@galois.com>2018-02-21 10:22:18 -0800
committerJussi Pakkanen <jpakkane@gmail.com>2018-02-22 22:16:58 +0200
commit3332f3364901ac282c545e1a463618e86e70cdf9 (patch)
tree70401bf342f5e4e2055a9e1699960b549b24f040 /mesonbuild/backend/ninjabackend.py
parent2f21e1ffc06ca41dac132018e8bef5bd2fe95ab1 (diff)
downloadmeson-3332f3364901ac282c545e1a463618e86e70cdf9.zip
meson-3332f3364901ac282c545e1a463618e86e70cdf9.tar.gz
meson-3332f3364901ac282c545e1a463618e86e70cdf9.tar.bz2
Fix Rust compiler-private library ambiguity
When building a Rust target with Rust library dependencies, an `--extern` argument is now specified to avoid ambiguity between the dependency library, and any crates of the same name in `rustc`'s private sysroot. Includes an illustrative test case.
Diffstat (limited to 'mesonbuild/backend/ninjabackend.py')
-rw-r--r--mesonbuild/backend/ninjabackend.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 59eaf6b..e8c8b39 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -1276,6 +1276,10 @@ int dummy;
linkdirs = OrderedDict()
for d in target.link_targets:
linkdirs[d.subdir] = True
+ # specify `extern CRATE_NAME=OUTPUT_FILE` for each Rust
+ # dependency, so that collisions with libraries in rustc's
+ # sysroot don't cause ambiguity
+ args += ['--extern', '{}={}'.format(d.name, os.path.join(d.subdir, d.filename))]
for d in linkdirs.keys():
if d == '':
d = '.'