All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] Rust oe-selftest script
@ 2021-09-13 17:35 pgowda.cve
  2021-09-13 17:35 ` [PATCH 2/4] Rust cross testing file Pgowda
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: pgowda.cve @ 2021-09-13 17:35 UTC (permalink / raw)
  To: openembedded-core
  Cc: richard.purdie, rwmacleod, umesh.kalappa0, vinay.m.engg,
	alex.kanavin, Pgowda

The file builds remote-test-server and executes rust testing
remotely using background ssh. It adds the necessary test environment
and variables to run the rust oe-selftest.

Print the results in case of failure of runCmd().

Signed-off-by: Pgowda <pgowda.cve@gmail.com>
---
 meta/lib/oeqa/selftest/cases/rust.py | 54 ++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 meta/lib/oeqa/selftest/cases/rust.py

diff --git a/meta/lib/oeqa/selftest/cases/rust.py b/meta/lib/oeqa/selftest/cases/rust.py
new file mode 100644
index 0000000000..4ebb9045f4
--- /dev/null
+++ b/meta/lib/oeqa/selftest/cases/rust.py
@@ -0,0 +1,54 @@
+# SPDX-License-Identifier: MIT
+import os
+import subprocess
+from oeqa.core.decorator import OETestTag
+from oeqa.core.case import OEPTestResultTestCase
+from oeqa.selftest.case import OESelftestTestCase
+from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu, Command
+from oeqa.utils.sshcontrol import SSHControl
+
+# Total time taken for testing is of about 2hr 20min, with PARALLEL_MAKE set to 40 number of jobs.
+class RustSelfTestBase(OESelftestTestCase, OEPTestResultTestCase):
+
+	def run_check_emulated(self, *args, **kwargs):
+		# build remote-test-server before image build
+		recipe = "rust-testsuite"
+		bitbake("{} -c compile".format(recipe))
+		builddir = get_bb_var("B", "rust-testsuite")
+		# build core-image-minimal with required packages
+		default_installed_packages = ["libgcc", "libstdc++", "libatomic", "libgomp"]
+		features = []
+		features.append('IMAGE_FEATURES += "ssh-server-openssh"')
+		features.append('CORE_IMAGE_EXTRA_INSTALL += "{0}"'.format(" ".join(default_installed_packages)))
+		self.write_config("\n".join(features))
+		bitbake("core-image-minimal")
+		# wrap the execution with a qemu instance
+		with runqemu("core-image-minimal", runqemuparams = "nographic", qemuparams = "-m 512") as qemu:
+#		with runqemu("core-image-minimal", runqemuparams = "nographic") as qemu:
+			# Copy remote-test-server to image through scp
+			ssh = SSHControl(ip=qemu.ip, logfile=qemu.sshlog, user="root")
+			ssh.copy_to(builddir + "/" + "build/x86_64-unknown-linux-gnu/stage1-tools-bin/remote-test-server","~/")
+			# Execute remote-test-server on image through background ssh
+			command = '~/remote-test-server -v remote'
+			sshrun=subprocess.Popen(("ssh", '-o',  'UserKnownHostsFile=/dev/null', '-o',  'StrictHostKeyChecking=no', '-f', "root@%s" % qemu.ip, command),
+                                shell=False,
+                                stdout=subprocess.PIPE,
+                                stderr=subprocess.PIPE)
+			# Get the values of variables.
+			targetsys = get_bb_var("TARGET_SYS", "rust-testsuite")
+			rustlibpath = get_bb_var("STAGING_LIBDIR_NATIVE", "rust-testsuite")
+			tmpdir = get_bb_var("TMPDIR", "rust-testsuite")
+			testargs = "--no-fail-fast --bless"
+			# Set path for target-poky-linux-gcc, RUST_TARGET_PATH and hosttools.
+			cmd = " export PATH=%s/../bin:$PATH;" % rustlibpath
+			cmd = cmd + " export PATH=%s/../bin/%s:%s/hosttools:$PATH;" % (rustlibpath, targetsys, tmpdir)
+			cmd = cmd + " export RUST_TARGET_PATH=%s/rustlib;" % rustlibpath
+			# Trigger testing.
+			cmd = cmd + " export TEST_DEVICE_ADDR=\"%s:12345\";" % qemu.ip
+			cmd = cmd + " cd %s;  python3 src/bootstrap/bootstrap.py test %s --target %s ;" % (builddir, testargs, targetsys)
+			result = runCmd(cmd)
+
+@OETestTag("toolchain-system")
+class RustSelfTestSystemEmulated(RustSelfTestBase):
+	def test_rust(self):
+		self.run_check_emulated("rust")
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] Rust cross testing file
  2021-09-13 17:35 [PATCH 1/4] Rust oe-selftest script pgowda.cve
@ 2021-09-13 17:35 ` Pgowda
  2021-09-13 17:35 ` [PATCH 3/4] Rust oe-selftest file Pgowda
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Pgowda @ 2021-09-13 17:35 UTC (permalink / raw)
  To: openembedded-core
  Cc: richard.purdie, rwmacleod, umesh.kalappa0, vinay.m.engg,
	alex.kanavin, Pgowda

The file is main entry point for rust oe-selftest.
It configures, compiles and runs the test suite framework.

It implements the above using the following functions:
setup_cargo_environment(): Build bootstrap and some early stage tools.
do_rust_setup_snapshot(): Install the snapshot version of rust binaries.
do_configure(): To generate config.toml
do_compile(): To build "remote-test-server" for qemutarget image.

Signed-off-by: Pgowda <pgowda.cve@gmail.com>
---
 meta/recipes-devtools/rust/rust-testsuite.inc | 157 ++++++++++++++++++
 1 file changed, 157 insertions(+)
 create mode 100644 meta/recipes-devtools/rust/rust-testsuite.inc

diff --git a/meta/recipes-devtools/rust/rust-testsuite.inc b/meta/recipes-devtools/rust/rust-testsuite.inc
new file mode 100644
index 0000000000..0a8abbef21
--- /dev/null
+++ b/meta/recipes-devtools/rust/rust-testsuite.inc
@@ -0,0 +1,157 @@
+SUMMARY = "Rust testing"
+HOMEPAGE = "https://rustc-dev-guide.rust-lang.org/tests/intro.html"
+SECTION = "test"
+LICENSE = "MIT | Apache-2.0"
+
+inherit rust
+inherit cargo_common
+
+DEPENDS += "file-native python3-native"
+EXCLUDE_FROM_WORLD = "1"
+
+S = "${RUSTSRC}"
+# Path of target specification file "target-poky-linux.json"
+export RUST_TARGET_PATH="${STAGING_LIBDIR_NATIVE}/rustlib"
+
+export FORCE_CRATE_HASH="${BB_TASKHASH}"
+
+# We don't want to use bitbakes vendoring because the rust sources do their
+# own vendoring.
+CARGO_DISABLE_BITBAKE_VENDORING = "1"
+
+# We can't use RUST_BUILD_SYS here because that may be "musl" if
+# TCLIBC="musl". Snapshots are always -unknown-linux-gnu
+SNAPSHOT_BUILD_SYS = "${BUILD_ARCH}-unknown-linux-gnu"
+setup_cargo_environment () {
+    # The first step is to build bootstrap and some early stage tools,
+    # these are build for the same target as the snapshot, e.g.
+    # x86_64-unknown-linux-gnu.
+    # Later stages are build for the native target (i.e. target.x86_64-linux)
+    cargo_common_do_configure
+
+    printf '[target.%s]\n' "${SNAPSHOT_BUILD_SYS}" >> ${CARGO_HOME}/config
+    printf "linker = '%s'\n" "${RUST_BUILD_CCLD}" >> ${CARGO_HOME}/config
+}
+
+include rust-common.inc
+do_rust_setup_snapshot () {
+    for installer in "${WORKDIR}/rust-snapshot-components/"*"/install.sh"; do
+        "${installer}" --prefix="${WORKDIR}/rust-snapshot" --disable-ldconfig
+    done
+
+    # Some versions of rust (e.g. 1.18.0) tries to find cargo in stage0/bin/cargo
+    # and fail without it there.
+    mkdir -p ${RUSTSRC}/build/${BUILD_SYS}
+    ln -sf ${WORKDIR}/rust-snapshot/ ${RUSTSRC}/build/${BUILD_SYS}/stage0
+}
+addtask rust_setup_snapshot after do_unpack before do_configure
+do_rust_setup_snapshot[dirs] += "${WORKDIR}/rust-snapshot"
+
+python do_configure() {
+    import json
+    from distutils.version import LooseVersion
+    try:
+        import configparser
+    except ImportError:
+        import ConfigParser as configparser
+
+    # toml is rather similar to standard ini like format except it likes values
+    # that look more JSON like. So for our purposes simply escaping all values
+    # as JSON seem to work fine.
+
+    e = lambda s: json.dumps(s)
+
+    config = configparser.RawConfigParser()
+
+    # [target.ARCH-unknown-linux-gnu] in case of x86_64 [target.ARCH-poky-linux]
+    target_section = "target.{}".format(d.getVar('TARGET_SYS', True))
+    config.add_section(target_section)
+
+    # Points to wrapper files which contain target specific compiler and linker commands.
+    config.set(target_section, "cxx", e(d.expand("${RUST_TARGET_CXX}")))
+    config.set(target_section, "cc", e(d.expand("${RUST_TARGET_CC}")))
+    config.set(target_section, "linker", e(d.expand("${RUST_TARGET_CCLD}")))
+
+    # If we don't do this rust-native will compile it's own llvm for BUILD.
+    # [target.${BUILD_ARCH}-unknown-linux-gnu]
+    target_section = "target.{}".format(d.getVar('SNAPSHOT_BUILD_SYS', True))
+    config.add_section(target_section)
+
+    # Wrapper scripts of build system.
+    config.set(target_section, "cxx", e(d.expand("${RUST_BUILD_CXX}")))
+    config.set(target_section, "cc", e(d.expand("${RUST_BUILD_CC}")))
+
+    # [llvm]
+    config.add_section("llvm")
+    config.set("llvm", "targets", e("ARM;AArch64;Mips;PowerPC;RISCV;X86"))
+
+    # [rust]
+    config.add_section("rust")
+    config.set("rust", "rpath", e(True))
+    config.set("rust", "channel", e("stable"))
+
+    if LooseVersion(d.getVar("PV")) < LooseVersion("1.32.0"):
+        config.set("rust", "use-jemalloc", e(False))
+
+    # Whether or not to optimize the compiler and standard library
+    config.set("rust", "optimize", e(True))
+
+    # Emits extraneous output from tests to ensure that failures of the test
+    # harness are debuggable just from logfiles
+    config.set("rust", "verbose-tests", e(True))
+
+    # Override default linker cc.
+    config.set("rust", "default-linker", e(d.expand("${RUST_BUILD_CCLD}")))
+
+    # [build]
+    config.add_section("build")
+    config.set("build", "submodules", e(False))
+    config.set("build", "docs", e(False))
+
+    rustc = d.expand("${WORKDIR}/rust-snapshot/bin/rustc")
+    config.set("build", "rustc", e(rustc))
+
+    cargo = d.expand("${WORKDIR}/rust-snapshot/bin/cargo")
+    config.set("build", "cargo", e(cargo))
+
+    config.set("build", "vendor", e(True))
+
+    targets = [d.getVar("TARGET_SYS", True)]
+    config.set("build", "target", e(targets))
+
+    hosts = [d.getVar("SNAPSHOT_BUILD_SYS", True)]
+    config.set("build", "host", e(hosts))
+
+    # We can't use BUILD_SYS since that is something the rust snapshot knows
+    # nothing about when trying to build some stage0 tools (like fabricate)
+    config.set("build", "build", e(d.getVar("SNAPSHOT_BUILD_SYS", True)))
+
+    with open("config.toml", "w") as f:
+        config.write(f)
+
+    # set up ${WORKDIR}/cargo_home
+    bb.build.exec_func("setup_cargo_environment", d)
+}
+
+
+rust_runx () {
+    echo "COMPILE ${PN}" "$@"
+
+    # CFLAGS, LDFLAGS, CXXFLAGS, CPPFLAGS are used by rust's build for a
+    # wide range of targets (not just TARGET). Yocto's settings for them will
+    # be inappropriate, avoid using.
+    unset CFLAGS
+    unset LDFLAGS
+    unset CXXFLAGS
+    unset CPPFLAGS
+
+    oe_cargo_fix_env
+
+    python3 src/bootstrap/bootstrap.py ${@oe.utils.parallel_make_argument(d, '-j %d')} "$@" --verbose
+}
+rust_runx[vardepsexclude] += "PARALLEL_MAKE"
+
+do_compile () {
+
+    rust_runx build src/tools/remote-test-server --target "${TARGET_SYS}"
+}
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] Rust oe-selftest file
  2021-09-13 17:35 [PATCH 1/4] Rust oe-selftest script pgowda.cve
  2021-09-13 17:35 ` [PATCH 2/4] Rust cross testing file Pgowda
@ 2021-09-13 17:35 ` Pgowda
  2021-09-13 17:35 ` [PATCH 4/4] Modify target cpu for powerpc to "7400" Pgowda
  2021-09-15  8:35 ` [PATCH 1/4] Rust oe-selftest script Richard Purdie
  3 siblings, 0 replies; 9+ messages in thread
From: Pgowda @ 2021-09-13 17:35 UTC (permalink / raw)
  To: openembedded-core
  Cc: richard.purdie, rwmacleod, umesh.kalappa0, vinay.m.engg,
	alex.kanavin, Pgowda

Add file for rust oe-selftest

Signed-off-by: Pgowda <pgowda.cve@gmail.com>
---
 meta/recipes-devtools/rust/rust-testsuite_1.54.0.bb | 3 +++
 1 file changed, 3 insertions(+)
 create mode 100644 meta/recipes-devtools/rust/rust-testsuite_1.54.0.bb

diff --git a/meta/recipes-devtools/rust/rust-testsuite_1.54.0.bb b/meta/recipes-devtools/rust/rust-testsuite_1.54.0.bb
new file mode 100644
index 0000000000..ad758b71f4
--- /dev/null
+++ b/meta/recipes-devtools/rust/rust-testsuite_1.54.0.bb
@@ -0,0 +1,3 @@
+require rust-testsuite.inc
+require rust-source-${PV}.inc
+require rust-snapshot-${PV}.inc
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] Modify target cpu for powerpc to "7400"
  2021-09-13 17:35 [PATCH 1/4] Rust oe-selftest script pgowda.cve
  2021-09-13 17:35 ` [PATCH 2/4] Rust cross testing file Pgowda
  2021-09-13 17:35 ` [PATCH 3/4] Rust oe-selftest file Pgowda
@ 2021-09-13 17:35 ` Pgowda
  2021-09-13 17:56   ` [OE-core] " Khem Raj
  2021-09-15  8:35 ` [PATCH 1/4] Rust oe-selftest script Richard Purdie
  3 siblings, 1 reply; 9+ messages in thread
From: Pgowda @ 2021-09-13 17:35 UTC (permalink / raw)
  To: openembedded-core
  Cc: richard.purdie, rwmacleod, umesh.kalappa0, vinay.m.engg,
	alex.kanavin, Pgowda

During rust testing, some ui test failed due to following message.
'powerpc' is not a recognized processor for this target in rust

Hence the target cpu was renamed to "7400" in "llvm_cpu" as per
default tune for qemuppc.

Signed-off-by: Pgowda <pgowda.cve@gmail.com>
---
 meta/recipes-devtools/rust/rust-common.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/rust/rust-common.inc b/meta/recipes-devtools/rust/rust-common.inc
index 153fa3aa97..aece1247a4 100644
--- a/meta/recipes-devtools/rust/rust-common.inc
+++ b/meta/recipes-devtools/rust/rust-common.inc
@@ -265,7 +265,7 @@ def llvm_cpu(d):
     trans['x86-64'] = "x86-64"
     trans['i686'] = "i686"
     trans['i586'] = "i586"
-    trans['powerpc'] = "powerpc"
+    trans['powerpc'] = "7400"
     trans['mips64'] = "mips64"
     trans['mips64el'] = "mips64"
     trans['riscv64'] = "generic-rv64"
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [OE-core] [PATCH 4/4] Modify target cpu for powerpc to "7400"
  2021-09-13 17:35 ` [PATCH 4/4] Modify target cpu for powerpc to "7400" Pgowda
@ 2021-09-13 17:56   ` Khem Raj
  0 siblings, 0 replies; 9+ messages in thread
From: Khem Raj @ 2021-09-13 17:56 UTC (permalink / raw)
  To: Pgowda
  Cc: Patches and discussions about the oe-core layer, Richard Purdie,
	Randy MacLeod, umesh kalappa0, Vinay Kumar, Alexander Kanavin

On Mon, Sep 13, 2021 at 10:35 AM Pgowda <pgowda.cve@gmail.com> wrote:
>
> During rust testing, some ui test failed due to following message.
> 'powerpc' is not a recognized processor for this target in rust
>
> Hence the target cpu was renamed to "7400" in "llvm_cpu" as per
> default tune for qemuppc.
>
> Signed-off-by: Pgowda <pgowda.cve@gmail.com>
> ---
>  meta/recipes-devtools/rust/rust-common.inc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/recipes-devtools/rust/rust-common.inc b/meta/recipes-devtools/rust/rust-common.inc
> index 153fa3aa97..aece1247a4 100644
> --- a/meta/recipes-devtools/rust/rust-common.inc
> +++ b/meta/recipes-devtools/rust/rust-common.inc
> @@ -265,7 +265,7 @@ def llvm_cpu(d):
>      trans['x86-64'] = "x86-64"
>      trans['i686'] = "i686"
>      trans['i586'] = "i586"
> -    trans['powerpc'] = "powerpc"
> +    trans['powerpc'] = "7400"

interesting. what happens if you use 'ppc'

>      trans['mips64'] = "mips64"
>      trans['mips64el'] = "mips64"
>      trans['riscv64'] = "generic-rv64"
> --
> 2.31.1
>
>
> 
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] Rust oe-selftest script
  2021-09-13 17:35 [PATCH 1/4] Rust oe-selftest script pgowda.cve
                   ` (2 preceding siblings ...)
  2021-09-13 17:35 ` [PATCH 4/4] Modify target cpu for powerpc to "7400" Pgowda
@ 2021-09-15  8:35 ` Richard Purdie
  2021-09-15 10:07   ` Pgowda
  3 siblings, 1 reply; 9+ messages in thread
From: Richard Purdie @ 2021-09-15  8:35 UTC (permalink / raw)
  To: Pgowda, openembedded-core
  Cc: rwmacleod, umesh.kalappa0, vinay.m.engg, alex.kanavin

On Mon, 2021-09-13 at 10:35 -0700, Pgowda wrote:
> The file builds remote-test-server and executes rust testing
> remotely using background ssh. It adds the necessary test environment
> and variables to run the rust oe-selftest.
> 
> Print the results in case of failure of runCmd().
> 
> Signed-off-by: Pgowda <pgowda.cve@gmail.com>
> ---
>  meta/lib/oeqa/selftest/cases/rust.py | 54 ++++++++++++++++++++++++++++
>  1 file changed, 54 insertions(+)
>  create mode 100644 meta/lib/oeqa/selftest/cases/rust.py

Thanks for this series, it would be great to have these new test cases.

We did see a couple of failures in testing on our infrastructure:

https://autobuilder.yoctoproject.org/typhoon/#/builders/59/builds/3970/steps/19/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/73/builds/3967/steps/20/logs/stdio

I also needed to add a maintainers entry:

http://git.yoctoproject.org/cgit.cgi/poky/commit/?h=master-next&id=50f7a13e69e8987b3629d455f9f56720c376e89b

Cheers,

Richard


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] Rust oe-selftest script
  2021-09-15  8:35 ` [PATCH 1/4] Rust oe-selftest script Richard Purdie
@ 2021-09-15 10:07   ` Pgowda
  2021-09-15 10:19     ` Richard Purdie
  0 siblings, 1 reply; 9+ messages in thread
From: Pgowda @ 2021-09-15 10:07 UTC (permalink / raw)
  To: Richard Purdie
  Cc: openembedded-core, Randy MacLeod, umesh.kalappa0, Vinay Kumar,
	alex.kanavin

[-- Attachment #1: Type: text/plain, Size: 929 bytes --]

Hi Richard,

Thanks for reviewing the patch and your comments.

> We did see a couple of failures in testing on our infrastructure:
We are using the following machine for running tests
Description:    Ubuntu 18.04.3 LTS
Release:        18.04

> https://autobuilder.yoctoproject.org/typhoon/#/builders/59/builds/3970/steps/19/logs/stdio
> https://autobuilder.yoctoproject.org/typhoon/#/builders/73/builds/3967/steps/20/logs/stdio

We did not see the following error while running X86_64 target
 "/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found
Can you please let us know whether this is the failure you mentioned.

Please find attached the log files "rust-testsuite-logs.tar.bz2" for
all 6 targets.
We observed some test failures in the logs but there were no build failures.

> I also needed to add a maintainers entry:
Thanks very much for adding the maintainers entry.

Regards,
pgowda

[-- Attachment #2: rust-testsuite-logs.tar.bz2 --]
[-- Type: application/octet-stream, Size: 1681872 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] Rust oe-selftest script
  2021-09-15 10:07   ` Pgowda
@ 2021-09-15 10:19     ` Richard Purdie
  2021-09-22 13:08       ` Pgowda
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Purdie @ 2021-09-15 10:19 UTC (permalink / raw)
  To: pgowda cve
  Cc: openembedded-core, Randy MacLeod, umesh.kalappa0, Vinay Kumar,
	alex.kanavin

On Wed, 2021-09-15 at 15:37 +0530, pgowda cve wrote:
> Hi Richard,
> 
> Thanks for reviewing the patch and your comments.
> 
> > We did see a couple of failures in testing on our infrastructure:
> We are using the following machine for running tests
> Description:    Ubuntu 18.04.3 LTS
> Release:        18.04
> 
> > https://autobuilder.yoctoproject.org/typhoon/#/builders/59/builds/3970/steps/19/logs/stdio
> > https://autobuilder.yoctoproject.org/typhoon/#/builders/73/builds/3967/steps/20/logs/stdio
> 
> We did not see the following error while running X86_64 target
>  "/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found
> Can you please let us know whether this is the failure you mentioned.

Yes, that would seem to be what is failing the build in the first case. In the
other it is slightly different:

/home/pokybuild/yocto-worker/qemux86/build/build-st-41976/tmp/work/core2-32-poky-linux/rust-testsuite/1.54.0-r0/rustc-1.54.0-src/build/x86_64-unknown-linux-gnu/test/run-make/issue-36710/issue-36710/foo: /lib32/libc.so.6: version `GLIBC_2.33' not found (required by /home/pokybuild/yocto-worker/qemux86/build/build-st-41976/tmp/work/core2-32-poky-linux/rust-testsuite/1.54.0-r0/rustc-1.54.0-src/build/x86_64-unknown-linux-gnu/test/run-make/issue-36710/issue-36710/foo)
/home/pokybuild/yocto-worker/qemux86/build/build-st-41976/tmp/work/core2-32-poky-linux/rust-testsuite/1.54.0-r0/rustc-1.54.0-src/build/x86_64-unknown-linux-gnu/test/run-make/issue-36710/issue-36710/foo: /lib32/libc.so.6: version `GLIBC_2.32' not found (required by /home/pokybuild/yocto-worker/qemux86/build/build-st-41976/tmp/work/core2-32-poky-linux/rust-testsuite/1.54.0-r0/rustc-1.54.0-src/build/x86_64-unknown-linux-gnu/test/run-make/issue-36710/issue-36710/foo)
/home/pokybuild/yocto-worker/qemux86/build/build-st-41976/tmp/work/core2-32-poky-linux/rust-testsuite/1.54.0-r0/rustc-1.54.0-src/build/x86_64-unknown-linux-gnu/test/run-make/issue-36710/issue-36710/foo: /lib32/libc.so.6: version `GLIBC_2.34' not found (required by /home/pokybuild/yocto-worker/qemux86/build/build-st-41976/tmp/work/core2-32-poky-linux/rust-testsuite/1.54.0-r0/rustc-1.54.0-src/build/x86_64-unknown-linux-gnu/test/run-make/issue-36710/issue-36710/foo)
make: *** [Makefile:14: all] Error 1

I'd note that one is from a debian10 system with no buildtools, the other is
from a ubuntu 1604 system which does have a buildtools tarball installed. I
suspect it is related to the version of lib on the host verses the version used
in the target.

Perhaps try running the build within a buildtools environment to reproduce?

https://downloads.yoctoproject.org/releases/yocto/milestones/yocto-3.4_M2/buildtools/x86_64-buildtools-extended-nativesdk-standalone-3.3%2Bsnapshot-1ad79313a5c3e6a453fbeb44caac5c5bbad46d3c.sh

> Please find attached the log files "rust-testsuite-logs.tar.bz2" for
> all 6 targets.
> We observed some test failures in the logs but there were no build failures.
> 

Unfortunately we can't merge this until all the tests pass reliably on our
infrastructure.

> > I also needed to add a maintainers entry:
> Thanks very much for adding the maintainers entry.

Cheers,

Richard



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] Rust oe-selftest script
  2021-09-15 10:19     ` Richard Purdie
@ 2021-09-22 13:08       ` Pgowda
  0 siblings, 0 replies; 9+ messages in thread
From: Pgowda @ 2021-09-22 13:08 UTC (permalink / raw)
  To: Richard Purdie
  Cc: openembedded-core, Randy MacLeod, umesh.kalappa0, Vinay Kumar,
	alex.kanavin

[-- Attachment #1: Type: text/plain, Size: 523 bytes --]

Hi Richard,

> I suspect it is related to the version of lib on the host verses the version used
> in the target.
That seems to be the problem.

> Perhaps try running the build within a buildtools environment to reproduce?
We could reproduce the issue within the buildtools environment.

Please find attached the modified "rust-testsuite.inc" file that fixes the
issue and runs as expected on buildtools environment.
Please review the patch and let us know if any further changes are needed.

Thanks,
pgowda

[-- Attachment #2: rust-testsuite.inc --]
[-- Type: application/octet-stream, Size: 5850 bytes --]

SUMMARY = "Rust testing"
HOMEPAGE = "https://rustc-dev-guide.rust-lang.org/tests/intro.html"
SECTION = "test"
LICENSE = "MIT | Apache-2.0"

inherit rust
inherit cargo_common

DEPENDS += "file-native python3-native"
EXCLUDE_FROM_WORLD = "1"

S = "${RUSTSRC}"

# Path of target specification file "target-poky-linux.json"
export RUST_TARGET_PATH="${STAGING_LIBDIR_NATIVE}/rustlib"

export FORCE_CRATE_HASH="${BB_TASKHASH}"

# We don't want to use bitbakes vendoring because the rust sources do their
# own vendoring.
CARGO_DISABLE_BITBAKE_VENDORING = "1"

# We can't use RUST_BUILD_SYS here because that may be "musl" if
# TCLIBC="musl". Snapshots are always -unknown-linux-gnu
SNAPSHOT_BUILD_SYS = "${BUILD_ARCH}-unknown-linux-gnu"
setup_cargo_environment () {
    # The first step is to build bootstrap and some early stage tools,
    # these are build for the same target as the snapshot, e.g.
    # x86_64-unknown-linux-gnu.
    # Later stages are build for the native target (i.e. target.x86_64-linux)
    cargo_common_do_configure

    printf '[target.%s]\n' "${SNAPSHOT_BUILD_SYS}" >> ${CARGO_HOME}/config
    printf "linker = '%s'\n" "${RUST_BUILD_CCLD}" >> ${CARGO_HOME}/config
}

include rust-common.inc

do_rust_setup_snapshot () {
    for installer in "${WORKDIR}/rust-snapshot-components/"*"/install.sh"; do
        "${installer}" --prefix="${WORKDIR}/rust-snapshot" --disable-ldconfig
    done

    # Some versions of rust (e.g. 1.18.0) tries to find cargo in stage0/bin/cargo
    # and fail without it there.
    mkdir -p ${RUSTSRC}/build/${BUILD_SYS}
    ln -sf ${WORKDIR}/rust-snapshot/ ${RUSTSRC}/build/${BUILD_SYS}/stage0

    # 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
        for bin in cargo rustc rustdoc; do
            patchelf-uninative ${WORKDIR}/rust-snapshot/bin/$bin --set-interpreter ${UNINATIVE_LOADER}
        done
    fi
}
addtask rust_setup_snapshot after do_unpack before do_configure
do_rust_setup_snapshot[dirs] += "${WORKDIR}/rust-snapshot"

python do_configure() {
    import json
    from distutils.version import LooseVersion
    try:
        import configparser
    except ImportError:
        import ConfigParser as configparser

    # toml is rather similar to standard ini like format except it likes values
    # that look more JSON like. So for our purposes simply escaping all values
    # as JSON seem to work fine.

    e = lambda s: json.dumps(s)

    config = configparser.RawConfigParser()

    # [target.ARCH-unknown-linux-gnu] in case of x86_64 [target.ARCH-poky-linux]
    target_section = "target.{}".format(d.getVar('TARGET_SYS', True))
    config.add_section(target_section)

    # Points to wrapper files which contain target specific compiler and linker commands.
    config.set(target_section, "cxx", e(d.expand("${RUST_TARGET_CXX}")))
    config.set(target_section, "cc", e(d.expand("${RUST_TARGET_CC}")))
    config.set(target_section, "linker", e(d.expand("${RUST_TARGET_CCLD}")))

    # If we don't do this rust-native will compile it's own llvm for BUILD.
    # [target.${BUILD_ARCH}-unknown-linux-gnu]
    target_section = "target.{}".format(d.getVar('SNAPSHOT_BUILD_SYS', True))
    config.add_section(target_section)

    # Wrapper scripts of build system.
    config.set(target_section, "cxx", e(d.expand("${RUST_BUILD_CXX}")))
    config.set(target_section, "cc", e(d.expand("${RUST_BUILD_CC}")))

    # [llvm]
    config.add_section("llvm")
    config.set("llvm", "targets", e("ARM;AArch64;Mips;PowerPC;RISCV;X86"))

    # [rust]
    config.add_section("rust")
    config.set("rust", "rpath", e(True))
    config.set("rust", "channel", e("stable"))

    if LooseVersion(d.getVar("PV")) < LooseVersion("1.32.0"):
        config.set("rust", "use-jemalloc", e(False))

    # Whether or not to optimize the compiler and standard library
    config.set("rust", "optimize", e(True))

    # Emits extraneous output from tests to ensure that failures of the test
    # harness are debuggable just from logfiles
    config.set("rust", "verbose-tests", e(True))

    # Override default linker cc.
    config.set("rust", "default-linker", e(d.expand("${RUST_BUILD_CCLD}")))

    # [build]
    config.add_section("build")
    config.set("build", "submodules", e(False))
    config.set("build", "docs", e(False))

    rustc = d.expand("${WORKDIR}/rust-snapshot/bin/rustc")
    config.set("build", "rustc", e(rustc))

    cargo = d.expand("${WORKDIR}/rust-snapshot/bin/cargo")
    config.set("build", "cargo", e(cargo))

    config.set("build", "vendor", e(True))

    targets = [d.getVar("TARGET_SYS", True)]
    config.set("build", "target", e(targets))

    hosts = [d.getVar("SNAPSHOT_BUILD_SYS", True)]
    config.set("build", "host", e(hosts))

    # We can't use BUILD_SYS since that is something the rust snapshot knows
    # nothing about when trying to build some stage0 tools (like fabricate)
    config.set("build", "build", e(d.getVar("SNAPSHOT_BUILD_SYS", True)))

    with open("config.toml", "w") as f:
        config.write(f)

    # set up ${WORKDIR}/cargo_home
    bb.build.exec_func("setup_cargo_environment", d)
}


rust_runx () {
    echo "COMPILE ${PN}" "$@"

    # CFLAGS, LDFLAGS, CXXFLAGS, CPPFLAGS are used by rust's build for a
    # wide range of targets (not just TARGET). Yocto's settings for them will
    # be inappropriate, avoid using.
    unset CFLAGS
    unset LDFLAGS
    unset CXXFLAGS
    unset CPPFLAGS

    oe_cargo_fix_env

    python3 src/bootstrap/bootstrap.py ${@oe.utils.parallel_make_argument(d, '-j %d')} "$@" --verbose
}
rust_runx[vardepsexclude] += "PARALLEL_MAKE"

do_compile () {

    rust_runx build src/tools/remote-test-server --target "${TARGET_SYS}"
}

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-09-22 13:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13 17:35 [PATCH 1/4] Rust oe-selftest script pgowda.cve
2021-09-13 17:35 ` [PATCH 2/4] Rust cross testing file Pgowda
2021-09-13 17:35 ` [PATCH 3/4] Rust oe-selftest file Pgowda
2021-09-13 17:35 ` [PATCH 4/4] Modify target cpu for powerpc to "7400" Pgowda
2021-09-13 17:56   ` [OE-core] " Khem Raj
2021-09-15  8:35 ` [PATCH 1/4] Rust oe-selftest script Richard Purdie
2021-09-15 10:07   ` Pgowda
2021-09-15 10:19     ` Richard Purdie
2021-09-22 13:08       ` Pgowda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.