From 1f18869377d39fece73447188018be8f5046850e Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Tue, 6 Dec 2016 11:08:46 -0600 Subject: [PATCH] workaround bug in the -C crate_hash option The -C crate_hash option does not work if multiple versions of the same crate are being linked into a binary. This can happen if different dependencies depend on different versions of the same crate. The -C crate_hash argument causes all versions of a given crate to have the same crate hash which in turn causes the compiler to select the wrong one internally and crash. This works around issue #126 for Cargo builds but does not fix the underlying cause. --- classes/rust-bin.bbclass | 1 + classes/rust-common.bbclass | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/classes/rust-bin.bbclass b/classes/rust-bin.bbclass index 8afe5cb..42d5b48 100644 --- a/classes/rust-bin.bbclass +++ b/classes/rust-bin.bbclass @@ -3,6 +3,7 @@ inherit rust DEPENDS_append = " patchelf-native" RDEPENDS_${PN} += "${RUSTLIB_DEP}" +RUSTFLAGS += "-C crate_hash=${BB_TASKHASH}" RUSTC_ARCHFLAGS += "-C opt-level=3 -g -L ${STAGING_DIR_HOST}/${rustlibdir}" EXTRA_OEMAKE += 'RUSTC_ARCHFLAGS="${RUSTC_ARCHFLAGS}"' diff --git a/classes/rust-common.bbclass b/classes/rust-common.bbclass index 1788153..903e8af 100644 --- a/classes/rust-common.bbclass +++ b/classes/rust-common.bbclass @@ -5,7 +5,7 @@ FILES_${PN}-dev += "${rustlibdir}/*.rlib" FILES_${PN}-dbg += "${rustlibdir}/.debug" RUSTLIB = "-L ${STAGING_LIBDIR}/rust" -RUSTFLAGS += "-C rpath -C crate_hash=${BB_TASKHASH} ${RUSTLIB}" +RUSTFLAGS += "-C rpath ${RUSTLIB}" RUSTLIB_DEP ?= "libstd-rs" # Responsible for taking Yocto triples and converting it to Rust triples