diff mbox series

[v2,1/2] oeqa/selftest/rust: pass zlib/zstd link args to test build

Message ID 20251103082911.1792759-2-peter.tatrai.ext@siemens.com
State New
Headers show
Series Fix Rust self-test failures on PowerPC | expand

Commit Message

P. Tatrai Nov. 3, 2025, 8:29 a.m. UTC
From: Peter Tatrai <peter.tatrai.ext@siemens.com>

Pass -lz and -lzstd linker arguments via RUSTFLAGS when running the
bootstrap test suite.

The Rust self-test executes 'python3 src/bootstrap/bootstrap.py test --target'
on the host, which builds and links test binaries for the target architecture
(these binaries are then uploaded to QEMU for execution). The test binaries
use LLVM's compression functionality and require explicit linker flags for
zlib and zstd.

The RUSTFLAGS exported at recipe level (in rust_1.90.0.bb) do not propagate
to this bootstrap test invocation in the selftest harness, so we must set them
explicitly in the test command.

This fixes PowerPC (qemuppc) test failures with undefined references:
  undefined reference to 'compress2'
  undefined reference to 'uncompress'
  undefined reference to 'ZSTD_decompress'
  undefined reference to 'ZSTD_isError'
  undefined reference to 'ZSTD_compress2'
  undefined reference to 'crc32'

Signed-off-by: Peter Tatrai <peter.tatrai.ext@siemens.com>
---
 meta/lib/oeqa/selftest/cases/rust.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexander Kanavin Nov. 3, 2025, 11:22 a.m. UTC | #1
On Mon, 3 Nov 2025 at 09:29, Tatrai, Peter via lists.openembedded.org
<peter.tatrai.ext=siemens.com@lists.openembedded.org> wrote:
> This fixes PowerPC (qemuppc) test failures with undefined references:
>   undefined reference to 'compress2'
>   undefined reference to 'uncompress'
>   undefined reference to 'ZSTD_decompress'
>   undefined reference to 'ZSTD_isError'
>   undefined reference to 'ZSTD_compress2'
>   undefined reference to 'crc32'
> -            cmd = cmd + " export RUSTFLAGS='-C strip=debuginfo';"
> +            cmd = cmd + " export RUSTFLAGS='-C strip=debuginfo -Clink-arg=-lz -Clink-arg=-lzstd';"

But this still does not explain why the issue is specific to powerpc.
Can you get to the bottom of it?

Alex
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/rust.py b/meta/lib/oeqa/selftest/cases/rust.py
index 31222e2456..819ff6af9e 100644
--- a/meta/lib/oeqa/selftest/cases/rust.py
+++ b/meta/lib/oeqa/selftest/cases/rust.py
@@ -124,7 +124,7 @@  class RustSelfTestSystemEmulated(OESelftestTestCase, OEPTestResultTestCase):
             cmd = cmd + " export RUST_TARGET_PATH=%s/rust-targets;" % rustlibpath
             # Strip debug symbols from test binaries to reduce size (300+ MB -> ~140 MB)
             # PowerPC mac99 QEMU has 768MB RAM limit, so we need to minimize test binary sizes
-            cmd = cmd + " export RUSTFLAGS='-C strip=debuginfo';"
+            cmd = cmd + " export RUSTFLAGS='-C strip=debuginfo -Clink-arg=-lz -Clink-arg=-lzstd';"
             # 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)