Add rust runtime tests
v2 cover Add rust runtime tests
This series adds runtime tests for rust and cargo, merges (most of) the include files into the base recipes and fixes target cargo builds.
Also add SDK_TOOLCHAIN_LANGS for selection of target toolchains as part of packagegroup-core-sdk.
Changes in v2:
- Drop rust.inc/rust.bb merge, not actually made use of in the change set
- Reorder so cargo test goes after build fixes
Alex Kiernan (10):
oeqa/runtime/rust: Add basic compile/run test
libstd-rs: Merge .inc into .bb
libstd-rs: Move source directory to library/test
rust-llvm: Merge .inc into .bb
rust-llvm: Update LLVM_VERSION to match embedded version
cargo: Merge .inc into .bb
cargo: Extend DEBUG_PREFIX_MAP to cover vendor packagegroup-rust-sdk-target: Add Rust SDK target packagegroup
packagegroup-core-sdk: Add SDK toolchain language selection support oeqa/runtime/rust: Add cargo test
meta/lib/oeqa/files/test.rs | 2 + meta/lib/oeqa/runtime/cases/rust.py | 41 ++++++++++ .../packagegroups/packagegroup-core-sdk.bb | 10 ++- .../packagegroup-rust-sdk-target.bb | 14 ++++ meta/recipes-devtools/cargo/cargo.inc | 69 ---------------- meta/recipes-devtools/cargo/cargo_1.66.0.bb | 73 ++++++++++++++++- meta/recipes-devtools/rust/libstd-rs.inc | 40 --------- .../recipes-devtools/rust/libstd-rs_1.66.0.bb | 46 ++++++++++- meta/recipes-devtools/rust/rust-llvm.inc | 78 ------------------ .../recipes-devtools/rust/rust-llvm_1.66.0.bb | 82 ++++++++++++++++++- 10 files changed, 260 insertions(+), 195 deletions(-) create mode 100644 meta/lib/oeqa/files/test.rs create mode 100644 meta/recipes-core/packagegroups/packagegroup-rust-sdk-target.bb delete mode 100644 meta/recipes-devtools/cargo/cargo.inc delete mode 100644 meta/recipes-devtools/rust/libstd-rs.inc delete mode 100644 meta/recipes-devtools/rust/rust-llvm.inc
Signature · 1 line
2.39.0
PATCH v2 1/10 oeqa/runtime/rust: Add basic compile/run test
---
Changes in v2:
- Drop rust.inc/rust.bb merge, not actually made use of in the change set
- Reorder so cargo test goes after build fixes
meta/lib/oeqa/files/test.rs | 2 ++ meta/lib/oeqa/runtime/cases/rust.py | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 meta/lib/oeqa/files/test.rs
meta/lib/oeqa/files/test.rs new file +2 -0
@@ -0,0 +1,2 @@ +fn main () { +}
meta/lib/oeqa/runtime/cases/rust.py +24 -0
@@ -8,6 +8,30 @@ from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends from oeqa.runtime.decorator.package import OEHasPackage +class RustCompileTest(OERuntimeTestCase): + + @classmethod + def setUp(cls): + dst = '/tmp/' + src = os.path.join(cls.tc.files_dir, 'test.rs') + cls.tc.target.copyTo(src, dst) + + @classmethod + def tearDown(cls): + files = '/tmp/test.rs /tmp/test' + cls.tc.target.run('rm %s' % files) + + @OETestDepends(['ssh.SSHTest.test_ssh']) + @OEHasPackage(['rust']) + def test_rust_compile(self): + status, output = self.target.run('rustc /tmp/test.rs -o /tmp/test') + msg = 'rust compile failed, output: %s' % output + self.assertEqual(status, 0, msg=msg) + + status, output = self.target.run('/tmp/test') + msg = 'running compiled file failed, output: %s' % output + self.assertEqual(status, 0, msg=msg) + class RustHelloworldTest(OERuntimeTestCase): @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(['rust-hello-world'])
Signature · 1 line
2.39.0
PATCH v2 2/10 libstd-rs: Merge .inc into .bb
In reply to Alex Kiernan---
(no changes since v1)
meta/recipes-devtools/rust/libstd-rs.inc | 40 ------------------- .../recipes-devtools/rust/libstd-rs_1.66.0.bb | 40 ++++++++++++++++++- 2 files changed, 39 insertions(+), 41 deletions(-) delete mode 100644 meta/recipes-devtools/rust/libstd-rs.inc
meta/recipes-devtools/rust/libstd-rs.inc deleted +0 -40
@@ -1,40 +0,0 @@ -SUMMARY = "Rust standard libaries" -HOMEPAGE = "http://www.rust-lang.org" -SECTION = "devel" -LICENSE = "(MIT | Apache-2.0) & Unicode-TOU" -LIC_FILES_CHKSUM = "file://../../COPYRIGHT;md5=92289ed52a60b63ab715612ad2915603" - -RUSTLIB_DEP = "" -inherit cargo - -DEPENDS:append:libc-musl = " libunwind" -# rv32 does not have libunwind ported yet -DEPENDS:remove:riscv32 = "libunwind" -DEPENDS:remove:riscv64 = "libunwind" - -# Embed bitcode in order to allow compiling both with and without LTO -RUSTFLAGS += "-Cembed-bitcode=yes" -# Needed so cargo can find libbacktrace -RUSTFLAGS += "-L ${STAGING_LIBDIR} -C link-arg=-Wl,-soname,libstd.so" - -S = "${RUSTSRC}/src/libstd" - -CARGO_FEATURES ?= "panic-unwind backtrace" -CARGO_BUILD_FLAGS += "--features '${CARGO_FEATURES}'" -CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor" - -do_compile:prepend () { - export CARGO_TARGET_DIR="${B}" - # For Rust 1.13.0 and newer - export RUSTC_BOOTSTRAP="1" -} - -do_install () { - mkdir -p ${D}${rustlibdir} - - # With the incremental build support added in 1.24, the libstd deps directory also includes dependency - # files that get installed. Those are really only needed to incrementally rebuild the libstd library - # itself and don't need to be installed. - rm -f ${B}/${RUST_TARGET_SYS}/${BUILD_DIR}/deps/*.d - cp ${B}/${RUST_TARGET_SYS}/${BUILD_DIR}/deps/* ${D}${rustlibdir} -}
meta/recipes-devtools/rust/libstd-rs_1.66.0.bb +39 -1
@@ -1,7 +1,45 @@ +SUMMARY = "Rust standard libaries" +HOMEPAGE = "http://www.rust-lang.org" +SECTION = "devel" +LICENSE = "(MIT | Apache-2.0) & Unicode-TOU" +LIC_FILES_CHKSUM = "file://../../COPYRIGHT;md5=92289ed52a60b63ab715612ad2915603" + require rust-source.inc -require libstd-rs.inc # libstd moved from src/libstd to library/std in 1.47+ S = "${RUSTSRC}/library/std" +RUSTLIB_DEP = "" +inherit cargo + +DEPENDS:append:libc-musl = " libunwind" +# rv32 does not have libunwind ported yet +DEPENDS:remove:riscv32 = "libunwind" +DEPENDS:remove:riscv64 = "libunwind" + +# Embed bitcode in order to allow compiling both with and without LTO +RUSTFLAGS += "-Cembed-bitcode=yes" +# Needed so cargo can find libbacktrace +RUSTFLAGS += "-L ${STAGING_LIBDIR} -C link-arg=-Wl,-soname,libstd.so" + +CARGO_FEATURES ?= "panic-unwind backtrace" +CARGO_BUILD_FLAGS += "--features '${CARGO_FEATURES}'" +CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor" + +do_compile:prepend () { + export CARGO_TARGET_DIR="${B}" + # For Rust 1.13.0 and newer + export RUSTC_BOOTSTRAP="1" +} + +do_install () { + mkdir -p ${D}${rustlibdir} + + # With the incremental build support added in 1.24, the libstd deps directory also includes dependency + # files that get installed. Those are really only needed to incrementally rebuild the libstd library + # itself and don't need to be installed. + rm -f ${B}/${RUST_TARGET_SYS}/${BUILD_DIR}/deps/*.d + cp ${B}/${RUST_TARGET_SYS}/${BUILD_DIR}/deps/* ${D}${rustlibdir} +} + BBCLASSEXTEND = "nativesdk"
Signature · 1 line
2.39.0
PATCH v2 3/10 libstd-rs: Move source directory to library/test
In reply to Alex KiernanBuilding libstd-rs from library/std omits proc_macro from the sysroot. Using library/test causes that to be installed which then allows cargo to build (https://github.com/meta-rust/meta-rust/issues/266)
---
(no changes since v1)
meta/recipes-devtools/rust/libstd-rs_1.66.0.bb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
meta/recipes-devtools/rust/libstd-rs_1.66.0.bb +4 -2
@@ -6,8 +6,10 @@ LIC_FILES_CHKSUM = "file://../../COPYRIGHT;md5=92289ed52a60b63ab715612ad2915603" require rust-source.inc -# libstd moved from src/libstd to library/std in 1.47+ -S = "${RUSTSRC}/library/std" +# Building with library/std omits proc_macro from the sysroot. Using +# library/test causes that to be installed which then allows cargo to +# build (https://github.com/meta-rust/meta-rust/issues/266) +S = "${RUSTSRC}/library/test" RUSTLIB_DEP = "" inherit cargo
Signature · 1 line
2.39.0
PATCH v2 4/10 rust-llvm: Merge .inc into .bb
In reply to Alex Kiernan---
(no changes since v1)
meta/recipes-devtools/rust/rust-llvm.inc | 78 ------------------ .../recipes-devtools/rust/rust-llvm_1.66.0.bb | 80 ++++++++++++++++++- 2 files changed, 79 insertions(+), 79 deletions(-) delete mode 100644 meta/recipes-devtools/rust/rust-llvm.inc
meta/recipes-devtools/rust/rust-llvm.inc deleted +0 -78
@@ -1,78 +0,0 @@ -SUMMARY = "LLVM compiler framework (packaged with rust)" -LICENSE ?= "Apache-2.0-with-LLVM-exception" -HOMEPAGE = "http://www.rust-lang.org" - -SRC_URI += "file://0002-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \ - file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch;striplevel=2 \ - file://0003-llvm-fix-include-benchmarks.patch;striplevel=2" - -S = "${RUSTSRC}/src/llvm-project/llvm" - -LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=8a15a0759ef07f2682d2ba4b893c9afe" - -inherit cmake python3native - -DEPENDS += "ninja-native rust-llvm-native" - -ARM_INSTRUCTION_SET:armv5 = "arm" -ARM_INSTRUCTION_SET:armv4t = "arm" - -# rustc_llvm with debug info is not recognized as a valid crate that's -# generated by rust-llvm-native. -CFLAGS:remove = "-g" -CXXFLAGS:remove = "-g" - -LLVM_DIR = "llvm${LLVM_RELEASE}" - -EXTRA_OECMAKE = " \ - -DCMAKE_BUILD_TYPE=Release \ - -DLLVM_TARGETS_TO_BUILD='ARM;AArch64;Mips;PowerPC;RISCV;X86' \ - -DLLVM_BUILD_DOCS=OFF \ - -DLLVM_ENABLE_TERMINFO=OFF \ - -DLLVM_ENABLE_ZLIB=OFF \ - -DLLVM_ENABLE_LIBXML2=OFF \ - -DLLVM_ENABLE_FFI=OFF \ - -DLLVM_INSTALL_UTILS=ON \ - -DLLVM_BUILD_EXAMPLES=OFF \ - -DLLVM_INCLUDE_EXAMPLES=OFF \ - -DLLVM_BUILD_TESTS=OFF \ - -DLLVM_INCLUDE_TESTS=OFF \ - -DLLVM_TARGET_ARCH=${TARGET_ARCH} \ - -DCMAKE_INSTALL_PREFIX:PATH=${libdir}/llvm-rust \ -" -EXTRA_OECMAKE:append:class-target = "\ - -DCMAKE_CROSSCOMPILING:BOOL=ON \ - -DLLVM_BUILD_TOOLS=OFF \ - -DLLVM_TABLEGEN=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-tblgen \ - -DLLVM_CONFIG_PATH=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config \ -" - -EXTRA_OECMAKE:append:class-nativesdk = "\ - -DCMAKE_CROSSCOMPILING:BOOL=ON \ - -DLLVM_BUILD_TOOLS=OFF \ - -DLLVM_TABLEGEN=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-tblgen \ - -DLLVM_CONFIG_PATH=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config \ -" - -# The debug symbols are huge here (>2GB) so suppress them since they -# provide almost no value. If you really need them then override this -INHIBIT_PACKAGE_DEBUG_SPLIT = "1" - -export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm-rust/bin/llvm-config" - -do_install:append () { - # we don't need any of this stuff to build Rust - rm -rf "${D}/usr/lib/cmake" -} - -PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liblto" - -# Add the extra locations to avoid the complaints about unpackaged files -FILES:${PN}-bugpointpasses = "${libdir}/llvm-rust/lib/BugpointPasses.so" -FILES:${PN}-llvmhello = "${libdir}/llvm-rust/lib/LLVMHello.so" -FILES:${PN}-liblto = "${libdir}/llvm-rust/lib/libLTO.so.*" -FILES:${PN}-staticdev =+ "${libdir}/llvm-rust/*/*.a" -FILES:${PN} += "${libdir}/libLLVM*.so.* ${libdir}/llvm-rust/lib/*.so.* ${libdir}/llvm-rust/bin" -FILES:${PN}-dev += "${datadir}/llvm ${libdir}/llvm-rust/lib/*.so ${libdir}/llvm-rust/include ${libdir}/llvm-rust/share ${libdir}/llvm-rust/lib/cmake" - -BBCLASSEXTEND = "native nativesdk"
meta/recipes-devtools/rust/rust-llvm_1.66.0.bb +79 -1
85 lines not on this page · raw message
Signature · 1 line
2.39.0
PATCH v2 5/10 rust-llvm: Update LLVM_VERSION to match embedded version
In reply to Alex Kiernan---
(no changes since v1)
meta/recipes-devtools/rust/rust-llvm_1.66.0.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/rust/rust-llvm_1.66.0.bb +1 -1
@@ -4,7 +4,7 @@ HOMEPAGE = "http://www.rust-lang.org" # check src/llvm-project/llvm/CMakeLists.txt for llvm version in use # -LLVM_RELEASE = "14.0.5" +LLVM_RELEASE = "15.0.2" require rust-source.inc
Signature · 1 line
2.39.0
PATCH v2 6/10 cargo: Merge .inc into .bb
In reply to Alex Kiernan---
(no changes since v1)
meta/recipes-devtools/cargo/cargo.inc | 69 -------------------- meta/recipes-devtools/cargo/cargo_1.66.0.bb | 71 ++++++++++++++++++++- 2 files changed, 69 insertions(+), 71 deletions(-) delete mode 100644 meta/recipes-devtools/cargo/cargo.inc
meta/recipes-devtools/cargo/cargo.inc deleted +0 -69
@@ -1,69 +0,0 @@ -SUMMARY ?= "Cargo, a package manager for Rust." -HOMEPAGE = "https://crates.io" -LICENSE = "MIT | Apache-2.0" -SECTION = "devel" - -DEPENDS = "openssl zlib curl ca-certificates libssh2" - -LIC_FILES_CHKSUM = " \ - file://LICENSE-MIT;md5=b377b220f43d747efdec40d69fcaa69d \ - file://LICENSE-APACHE;md5=71b224ca933f0676e26d5c2e2271331c \ - file://LICENSE-THIRD-PARTY;md5=f257ad009884cb88a3a87d6920e7180a \ -" - - -S = "${RUSTSRC}/src/tools/cargo" -CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor" -EXCLUDE_FROM_WORLD = "1" - -inherit cargo pkgconfig - -do_cargo_setup_snapshot () { - ${WORKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig - # Need to use uninative's loader if enabled/present since the library paths - # are used internally by rust and result in symbol mismatches if we don't - if [ ! -z "${UNINATIVE_LOADER}" -a -e "${UNINATIVE_LOADER}" ]; then - patchelf-uninative ${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo --set-interpreter ${UNINATIVE_LOADER} - fi -} - -addtask cargo_setup_snapshot after do_unpack before do_configure -do_cargo_setup_snapshot[dirs] += "${WORKDIR}/${CARGO_SNAPSHOT}" -do_cargo_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER" - - -do_compile:prepend () { - export RUSTC_BOOTSTRAP="1" -} - -do_install () { - install -d "${D}${bindir}" - 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 -# libgit2-sys and arbitrary system libgit2 versions, so better keep this turned off. -#export LIBGIT2_SYS_USE_PKG_CONFIG = "1" - -# Needed for pkg-config to be used -export LIBSSH2_SYS_USE_PKG_CONFIG = "1" - -# When building cargo-native we don't have cargo-native to use and depend on, -# 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" - -
meta/recipes-devtools/cargo/cargo_1.66.0.bb +69 -2
75 lines not on this page · raw message
Signature · 1 line
2.39.0
PATCH v2 7/10 cargo: Extend DEBUG_PREFIX_MAP to cover vendor
In reply to Alex KiernanThe cargo build builds vendored libgit and curl, but these exist outside ${S} which DEBUG_PREFIX_MAP covers.
---
(no changes since v1)
meta/recipes-devtools/cargo/cargo_1.66.0.bb | 2 ++ 1 file changed, 2 insertions(+)
meta/recipes-devtools/cargo/cargo_1.66.0.bb +2 -0
@@ -20,6 +20,8 @@ EXCLUDE_FROM_WORLD = "1" inherit cargo pkgconfig +DEBUG_PREFIX_MAP += "-fdebug-prefix-map=${RUSTSRC}/vendor=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}" + do_cargo_setup_snapshot () { ${WORKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig # Need to use uninative's loader if enabled/present since the library paths
Signature · 1 line
2.39.0
PATCH v2 8/10 packagegroup-rust-sdk-target: Add Rust SDK target packagegroup
In reply to Alex Kiernan---
(no changes since v1)
.../packagegroups/packagegroup-rust-sdk-target.bb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 meta/recipes-core/packagegroups/packagegroup-rust-sdk-target.bb
meta/recipes-core/packagegroups/packagegroup-rust-sdk-target.bb new file +14 -0
@@ -0,0 +1,14 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# + +SUMMARY = "Target packages for the Rust SDK" + +inherit packagegroup + +RDEPENDS:${PN} = " \ + rust \ + cargo \ +"
Signature · 1 line
2.39.0
PATCH v2 9/10 packagegroup-core-sdk: Add SDK toolchain language selection support
In reply to Alex KiernanUse SDK_TOOLCHAIN_LANGS to allow different language support to be selected within SDKs. Initially supported options are rust and go.
---
(no changes since v1)
.../packagegroups/packagegroup-core-sdk.bb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
meta/recipes-core/packagegroups/packagegroup-core-sdk.bb +9 -1
@@ -11,6 +11,11 @@ inherit packagegroup #PACKAGEFUNCS =+ 'generate_sdk_pkgs' +SDK_TOOLCHAIN_LANGS ??= "" +SDK_TOOLCHAIN_LANGS:remove:sdkmingw32 = "rust" +# libstd-rs doesn't build for mips n32 with compiler constraint errors +SDK_TOOLCHAIN_LANGS:remove:mipsarchn32 = "rust" + RDEPENDS:packagegroup-core-sdk = "\ packagegroup-core-buildessential \ coreutils \
@@ -23,7 +28,10 @@ RDEPENDS:packagegroup-core-sdk = "\ less \ ldd \ file \ - tcl" + tcl \ + ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'go', 'packagegroup-go-sdk-target', '', d)} \ + ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'rust', 'packagegroup-rust-sdk-target', '', d)} \ +" SANITIZERS = "libasan-dev libubsan-dev" SANITIZERS:arc = ""
Signature · 1 line
2.39.0
Re: [OE-Core][PATCH v2 09/10] packagegroup-core-sdk: Add SDK toolchain language selection support
Quoted 28 lines · Alex Kiernan
Use
SDK_TOOLCHAIN_LANGSto allow different language support to be selected within SDKs. Initially supported options are rust and go.Signed-off-by Alex Kiernan <[email protected]>---
(no changes since v1)
.../packagegroups/packagegroup-core-sdk.bb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)meta/recipes-core/packagegroups/packagegroup-core-sdk.bb +5
-0@@ -11,6 +11,11 @@ inherit packagegroup #PACKAGEFUNCS =+ 'generate_sdk_pkgs' +SDK_TOOLCHAIN_LANGS ??= "" +SDK_TOOLCHAIN_LANGS:remove:sdkmingw32 = "rust" +# libstd-rs doesn't build for mips n32 with compiler constraint errors +SDK_TOOLCHAIN_LANGS:remove:mipsarchn32 = "rust" + RDEPENDS:packagegroup-core-sdk = "\ packagegroup-core-buildessential \ coreutils \
meta/recipes-core/packagegroups/packagegroup-core-sdk.bb RDEPENDS:packagegroup-core-sdk = "\ · line 34
Quoted 8 lines
meta/recipes-core/packagegroups/packagegroup-core-sdk.bb +4
-1@@ -23,7 +28,10 @@ RDEPENDS:packagegroup-core-sdk = "\ less \ ldd \ file \ - tcl" + tcl \ + ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'go', 'packagegroup-go-sdk-target', '', d)} \ + ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'rust', 'packagegroup-rust-sdk-target', '', d)} \ +"
I'm a little torn on this. I created SDK_TOOLCHAIN_LANGS as a control for the SDKs from populate_sdk. Whether the target SDK images should follow that as well, I'm less sure.
It is probably fine and I nearly didn't send a comment but I just wanted to see what others think.
We could perhaps do something like:
TARGET_TOOLCHAIN_LANGS ??= "${SDK_TOOLCHAIN_LANGS}"
in the recipe to cover the ability to separate the two if we wanted...
Cheers,
Richard
Re: [OE-Core][PATCH v2 09/10] packagegroup-core-sdk: Add SDK toolchain language selection support
Quoted 43 lines · Richard Purdie
Quoted 28 lines · Alex Kiernan
Use
SDK_TOOLCHAIN_LANGSto allow different language support to be selected within SDKs. Initially supported options are rust and go.Signed-off-by Alex Kiernan <[email protected]>---
(no changes since v1)
.../packagegroups/packagegroup-core-sdk.bb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)meta/recipes-core/packagegroups/packagegroup-core-sdk.bb +5
-0@@ -11,6 +11,11 @@ inherit packagegroup #PACKAGEFUNCS =+ 'generate_sdk_pkgs' +SDK_TOOLCHAIN_LANGS ??= "" +SDK_TOOLCHAIN_LANGS:remove:sdkmingw32 = "rust" +# libstd-rs doesn't build for mips n32 with compiler constraint errors +SDK_TOOLCHAIN_LANGS:remove:mipsarchn32 = "rust" + RDEPENDS:packagegroup-core-sdk = "\ packagegroup-core-buildessential \ coreutils \meta/recipes-core/packagegroups/packagegroup-core-sdk.bb RDEPENDS:packagegroup-core-sdk = "\ · line 34
Quoted 8 lines
meta/recipes-core/packagegroups/packagegroup-core-sdk.bb +4
-1@@ -23,7 +28,10 @@ RDEPENDS:packagegroup-core-sdk = "\ less \ ldd \ file \ - tcl" + tcl \ + ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'go', 'packagegroup-go-sdk-target', '', d)} \ + ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'rust', 'packagegroup-rust-sdk-target', '', d)} \ +"I'm a little torn on this. I created
SDK_TOOLCHAIN_LANGSas a control for the SDKs frompopulate_sdk. Whether the target SDK images should follow that as well, I'm less sure.
Quoted 9 lines
It is probably fine and I nearly didn't send a comment but I just wanted to see what others think.
We could perhaps do something like:
TARGET_TOOLCHAIN_LANGS??= "${SDK_TOOLCHAIN_LANGS}"in the recipe to cover the ability to separate the two if we wanted...
I ummed and ahhed about reusing it... so I think it's a good discussion point...
Signature · 1 line
Alex Kiernan
Re: [OE-Core][PATCH v2 09/10] packagegroup-core-sdk: Add SDK toolchain language selection support
In reply to Richard PurdieQuoted 45 lines · Richard Purdie
Quoted 4 lines · Alex Kiernan
Use
SDK_TOOLCHAIN_LANGSto allow different language support to be selected within SDKs. Initially supported options are rust and go.Signed-off-by Alex Kiernan <[email protected]>Review
Quoted 8 lines
---
(no changes since v1)
.../packagegroups/packagegroup-core-sdk.bb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)(quoted diff) +0
-0b/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb
Quoted 16 lines
index
d70aff22c725..0e480e6ac756100644meta/recipes-core/packagegroups/packagegroup-core-sdk.bb +5
-0@@ -11,6 +11,11 @@ inherit packagegroup #PACKAGEFUNCS =+ 'generate_sdk_pkgs' +SDK_TOOLCHAIN_LANGS ??= "" +SDK_TOOLCHAIN_LANGS:remove:sdkmingw32 = "rust" +# libstd-rs doesn't build for mips n32 with compiler constraint errors +SDK_TOOLCHAIN_LANGS:remove:mipsarchn32 = "rust" + RDEPENDS:packagegroup-core-sdk = "\ packagegroup-core-buildessential \ coreutils \meta/recipes-core/packagegroups/packagegroup-core-sdk.bb RDEPENDS:packagegroup-core-sdk = "\ · line 32
Quoted 6 lines
meta/recipes-core/packagegroups/packagegroup-core-sdk.bb +2
-1@@ -23,7 +28,10 @@ RDEPENDS:packagegroup-core-sdk = "\ less \ ldd \ file \ - tcl" + tcl \ + ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'go','packagegroup-go-sdk-target', '', d)} \
meta/recipes-core/packagegroups/packagegroup-core-sdk.bb RDEPENDS:packagegroup-core-sdk = "\ · line 33
Quoted 1 line
meta/recipes-core/packagegroups/packagegroup-core-sdk.bb +1
-0+ ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'rust','packagegroup-rust-sdk-target', '', d)} \
meta/recipes-core/packagegroups/packagegroup-core-sdk.bb RDEPENDS:packagegroup-core-sdk = "\ · line 34
Quoted 1 line
meta/recipes-core/packagegroups/packagegroup-core-sdk.bb +1
-0+"I'm a little torn on this. I created
SDK_TOOLCHAIN_LANGSas a control for the SDKs frompopulate_sdk. Whether the target SDK images should follow that as well, I'm less sure.
Quoted 6 lines
It is probably fine and I nearly didn't send a comment but I just wanted to see what others think.
We could perhaps do something like:
TARGET_TOOLCHAIN_LANGS??= "${SDK_TOOLCHAIN_LANGS}"
Let’s go with this approach. It’s in line with other similar variables
Quoted 21 lines
in the recipe to cover the ability to separate the two if we wanted...
Cheers,
Richard
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#174922):
https://lists.openembedded.org/g/openembedded-core/message/174922
Mute This Topic: https://lists.openembedded.org/mt/95805446/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
PATCH v2 10/10 oeqa/runtime/rust: Add cargo test
In reply to Alex Kiernan---
(no changes since v1)
meta/lib/oeqa/runtime/cases/rust.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
meta/lib/oeqa/runtime/cases/rust.py +17 -0
@@ -20,6 +20,8 @@ class RustCompileTest(OERuntimeTestCase): def tearDown(cls): files = '/tmp/test.rs /tmp/test' cls.tc.target.run('rm %s' % files) + dirs = '/tmp/hello' + cls.tc.target.run('rm -r %s' % dirs) @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(['rust'])
@@ -32,6 +34,21 @@ class RustCompileTest(OERuntimeTestCase): msg = 'running compiled file failed, output: %s' % output self.assertEqual(status, 0, msg=msg) + @OETestDepends(['ssh.SSHTest.test_ssh']) + @OEHasPackage(['cargo']) + def test_cargo_compile(self): + status, output = self.target.run('cargo new /tmp/hello') + msg = 'cargo new failed, output: %s' % output + self.assertEqual(status, 0, msg=msg) + + status, output = self.target.run('cargo build --manifest-path=/tmp/hello/Cargo.toml') + msg = 'cargo build failed, output: %s' % output + self.assertEqual(status, 0, msg=msg) + + status, output = self.target.run('/tmp/hello/target/debug/hello') + msg = 'running compiled file failed, output: %s' % output + self.assertEqual(status, 0, msg=msg) + class RustHelloworldTest(OERuntimeTestCase): @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(['rust-hello-world'])
Signature · 1 line
2.39.0
Hello,
This is currently running on the AB and I got the following failures:
https://autobuilder.yoctoproject.org/typhoon/#/builders/64/builds/6375/steps/11/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/102/builds/3985/steps/11/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/63/builds/6334/steps/11/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/107/builds/3960/steps/11/logs/stdio
Quoted 54 lines · Alex Kiernan
This series adds runtime tests for rust and cargo, merges (most of) the include files into the base recipes and fixes target cargo builds.
Also add
SDK_TOOLCHAIN_LANGSfor selection of target toolchains as part of packagegroup-core-sdk.Changes in v2:
- Drop rust.inc/rust.bb merge, not actually made use of in the change set
- Reorder so cargo test goes after build fixesAlex Kiernan (10):
oeqa/runtime/rust: Add basic compile/run test
libstd-rs: Merge .inc into .bb
libstd-rs: Move source directory to library/test
rust-llvm: Merge .inc into .bb
rust-llvm: UpdateLLVM_VERSIONto match embedded version
cargo: Merge .inc into .bb
cargo: ExtendDEBUG_PREFIX_MAPto cover vendor packagegroup-rust-sdk-target: Add Rust SDK target packagegroup
packagegroup-core-sdk: Add SDK toolchain language selection support oeqa/runtime/rust: Add cargo testmeta/lib/oeqa/files/test.rs | 2 + meta/lib/oeqa/runtime/cases/rust.py | 41 ++++++++++ .../packagegroups/packagegroup-core-sdk.bb | 10 ++- .../packagegroup-rust-sdk-target.bb | 14 ++++ meta/recipes-devtools/cargo/cargo.inc | 69 ---------------- meta/recipes-devtools/cargo/cargo_1.66.0.bb | 73 ++++++++++++++++- meta/recipes-devtools/rust/libstd-rs.inc | 40 --------- .../recipes-devtools/rust/libstd-rs_1.66.0.bb | 46 ++++++++++- meta/recipes-devtools/rust/rust-llvm.inc | 78 ------------------ .../recipes-devtools/rust/rust-llvm_1.66.0.bb | 82 ++++++++++++++++++- 10 files changed, 260 insertions(+), 195 deletions(-) create mode 100644 meta/lib/oeqa/files/test.rs create mode 100644 meta/recipes-core/packagegroups/packagegroup-rust-sdk-target.bb delete mode 100644 meta/recipes-devtools/cargo/cargo.inc delete mode 100644 meta/recipes-devtools/rust/libstd-rs.inc delete mode 100644 meta/recipes-devtools/rust/rust-llvm.incSignature · 11 lines
2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#174906): https://lists.openembedded.org/g/openembedded-core/message/174906 Mute This Topic: https://lists.openembedded.org/mt/95805431/3617179 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Thanks. Busy the next few days, but at least one looks like the crossbeam atomics problem.
Quoted 78 lines · On Wed, 21 Dec 2022, 21:20 Alexandre Belloni, <[email protected]>…
Hello,
This is currently running on the AB and I got the following failures:
https://autobuilder.yoctoproject.org/typhoon/#/builders/64/builds/6375/steps/11/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/102/builds/3985/steps/11/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/63/builds/6334/steps/11/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/107/builds/3960/steps/11/logs/stdio
Quoted 24 lines · Alex Kiernan
This series adds runtime tests for rust and cargo, merges (most of) the include files into the base recipes and fixes target cargo builds.
Also add
SDK_TOOLCHAIN_LANGSfor selection of target toolchains as part of packagegroup-core-sdk.Changes in v2:
- Drop rust.inc/rust.bb merge, not actually made use of in the change set
- Reorder so cargo test goes after build fixesAlex Kiernan (10):
oeqa/runtime/rust: Add basic compile/run test
libstd-rs: Merge .inc into .bb
libstd-rs: Move source directory to library/test
rust-llvm: Merge .inc into .bb
rust-llvm: UpdateLLVM_VERSIONto match embedded version
cargo: Merge .inc into .bb
cargo: ExtendDEBUG_PREFIX_MAPto cover vendor packagegroup-rust-sdk-target: Add Rust SDK target packagegroup
packagegroup-core-sdk: Add SDK toolchain language selection support oeqa/runtime/rust: Add cargo testQuoted 13 lines
meta/lib/oeqa/files/test.rs | 2 + meta/lib/oeqa/runtime/cases/rust.py | 41 ++++++++++ .../packagegroups/packagegroup-core-sdk.bb | 10 ++- .../packagegroup-rust-sdk-target.bb | 14 ++++ meta/recipes-devtools/cargo/cargo.inc | 69 ---------------- meta/recipes-devtools/cargo/cargo_1.66.0.bb | 73 ++++++++++++++++- meta/recipes-devtools/rust/libstd-rs.inc | 40 --------- .../recipes-devtools/rust/libstd-rs_1.66.0.bb | 46 ++++++++++- meta/recipes-devtools/rust/rust-llvm.inc | 78 ------------------ .../recipes-devtools/rust/rust-llvm_1.66.0.bb | 82 ++++++++++++++++++- 10 files changed, 260 insertions(+), 195 deletions(-) create mode 100644 meta/lib/oeqa/files/test.rs create mode 100644 meta/recipes-core/packagegroups/packagegroup-rust-sdk-target.bb
Quoted 4 lines
delete mode 100644 meta/recipes-devtools/cargo/cargo.inc delete mode 100644 meta/recipes-devtools/rust/libstd-rs.inc delete mode 100644 meta/recipes-devtools/rust/rust-llvm.incQuoted 8 lines
--
2.39.0-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#174906):https://lists.openembedded.org/g/openembedded-core/message/174906
Quoted 3 lines
Mute This Topic: https://lists.openembedded.org/mt/95805431/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [Quoted 2 lines
-=-=-=-=-=-=-=-=-=-=-=-
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com