summaryrefslogtreecommitdiff
path: root/poky/meta/recipes-devtools/cargo/cargo.inc
diff options
context:
space:
mode:
Diffstat (limited to 'poky/meta/recipes-devtools/cargo/cargo.inc')
-rw-r--r--poky/meta/recipes-devtools/cargo/cargo.inc13
1 files changed, 13 insertions, 0 deletions
diff --git a/poky/meta/recipes-devtools/cargo/cargo.inc b/poky/meta/recipes-devtools/cargo/cargo.inc
index 607c51fc3d..40421df4f7 100644
--- a/poky/meta/recipes-devtools/cargo/cargo.inc
+++ b/poky/meta/recipes-devtools/cargo/cargo.inc
@@ -41,6 +41,14 @@ do_install () {
install -m 755 "${B}/target/${CARGO_TARGET_SUBDIR}/cargo" "${D}${bindir}"
}
+do_install:append:class-nativesdk() {
+ # To quote the cargo docs, "Cargo also sets the dynamic library path when compiling
+ # and running binaries with commands like `cargo run` and `cargo test`". Sadly it
+ # sets to libdir but not base_libdir leading to symbol mismatches depending on the
+ # host OS. Fully set LD_LIBRARY_PATH to contain both to avoid this.
+ create_wrapper ${D}/${bindir}/cargo LD_LIBRARY_PATH=${libdir}:${base_libdir}
+}
+
# Disabled due to incompatibility with libgit2 0.28.x (https://github.com/rust-lang/git2-rs/issues/458, https://bugs.gentoo.org/707746#c1)
# as shipped by Yocto Dunfell.
# According to https://github.com/rust-lang/git2-rs/issues/458#issuecomment-522567539, there are no compatibility guarantees between
@@ -54,3 +62,8 @@ export LIBSSH2_SYS_USE_PKG_CONFIG = "1"
# so we must use the locally set up snapshot to bootstrap the build.
BASEDEPENDS:remove:class-native = "cargo-native"
CARGO:class-native = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo"
+
+DEPENDS:append:class-nativesdk = " nativesdk-rust"
+RUSTLIB:append:class-nativesdk = " -L ${STAGING_DIR_HOST}/${SDKPATHNATIVE}/usr/lib/rustlib/${RUST_HOST_SYS}/lib"
+
+