From: Peter Tatrai <[email protected]>

LLVM requires zlib and zstd support for compression routines
used by rustc_codegen_llvm and related components.

Recipe-level RUSTFLAGS are not propagated in qemu image, causing bootstrap
test linkage failures. When these libraries are absent in the selftest
execution environment, bootstrap test binaries fail to link and cause
following failure:

  error: linking with `target-rust-ccld` failed: exit status: 1
  = note: undefined reference to `compress2'
  = note: undefined reference to `uncompress'
  = note: undefined reference to `ZSTD_decompress'
  = note: undefined reference to `ZSTD_isError'
  = note: undefined reference to `ZSTD_compress2'
  = note: undefined reference to `crc32'

Explicitly pass `-lz` and `-lzstd` in the image and ensure the corresponding
runtime libraries are present in the image.
It was initially reported on qemuppc and later seen across all tested
architectures (arm32/64, riscv64, x86_32/64).

https://lists.openembedded.org/g/openembedded-core/message/225636

Signed-off-by: Peter Tatrai <[email protected]>
Signed-off-by: Yash Shinde <[email protected]>
---
 meta/lib/oeqa/selftest/cases/rust.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/rust.py 
b/meta/lib/oeqa/selftest/cases/rust.py
index 31222e2456..01a98339a6 100644
--- a/meta/lib/oeqa/selftest/cases/rust.py
+++ b/meta/lib/oeqa/selftest/cases/rust.py
@@ -47,7 +47,7 @@ class RustSelfTestSystemEmulated(OESelftestTestCase, 
OEPTestResultTestCase):
         bitbake("{} -c test_compile".format(recipe))
         builddir = get_bb_var("RUSTSRC", "rust")
         # build core-image-minimal with required packages
-        default_installed_packages = ["libgcc", "libstdc++", "libatomic", 
"libgomp"]
+        default_installed_packages = ["libgcc", "libstdc++", "libatomic", 
"libgomp", "libzstd"]
         features = []
         features.append('IMAGE_FEATURES += "ssh-server-dropbear"')
         features.append('CORE_IMAGE_EXTRA_INSTALL += "{0}"'.format(" 
".join(default_installed_packages)))
@@ -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)
-- 
2.49.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#227535): 
https://lists.openembedded.org/g/openembedded-core/message/227535
Mute This Topic: https://lists.openembedded.org/mt/116729127/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to