Openembedded Core Discussions
 help / color / mirror / Atom feed
From: "Mathieu Dubois-Briand" <mathieu.dubois-briand@bootlin.com>
To: "Marco Felsch" <m.felsch@pengutronix.de>,
	<openembedded-core@lists.openembedded.org>
Cc: <yocto@pengutronix.de>, "Marco Felsch" <marco.felsch@gmail.com>
Subject: Re: [OE-core] [PATCH] rust: enable fully static linking with TCLIBC=glibc
Date: Thu, 03 Dec 2026 07:38:35 +0100	[thread overview]
Message-ID: <DNAW356KT35W.ANDV5EU04RRO@bootlin.com> (raw)
In-Reply-To: <20261130-mfe-rust-static-glibc-v1-1-5c24d978d5ef@pengutronix.de>

On Mon Nov 30, 2026 at 9:29 PM CET, Marco Felsch wrote:
> From: Marco Felsch <marco.felsch@gmail.com>
>
> Rust binaries built with TCLIBC=glibc and -C target-feature=+crt-static
> were still dynamically linked, because the generated target spec only set
> crt-static-respected for musl, so rustc ignored +crt-static. Upstream rustc
> sets it for all Linux targets (base/linux.rs), so do the same. No other
> change is needed: with crt-static the libc and unwind crates statically
> link libc, libm, libpthread, libdl, librt, libutil, libgcc_eh and libgcc,
> which glibc and libgcc already provide in the target sysroot.
>
> Rename rust-static-musl-test to rust-static-test and RustStaticMuslTest to
> RustStaticTest with a musl and a new glibc test, as the same check applies
> to both.
>
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
> Add the moment only musl supports static builds albeit everything is in
> place to static link against glibc as well. Of course the static linked
> binary is not as small as musl builds, but a BSP can avoid multiconfig
> setups.
>
> I've tested this with rsinit, a Rust based initrd application which
> requires only a dm-verity params file in addition to the static linked
> Rust binary bundled as CPIO.
>
> Regards,
> Marco

Hi Marco,

It looks like the added test is failing on ARM host:

2026-12-02 22:03:55,845 - oe-selftest - INFO -  ... FAIL
2026-12-02 22:03:55,845 - oe-selftest - INFO - 1: 49/54 804/840 (46.30s) (1 failed) (rust.RustStaticTest.test_static_glibc_linking)
2026-12-02 22:03:55,845 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/openembedded-core/meta/lib/oeqa/selftest/cases/rust.py", line 184, in test_static_glibc_linking
    self.check_static_linking("glibc")
  File "/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/openembedded-core/meta/lib/oeqa/selftest/cases/rust.py", line 167, in check_static_linking
    self.assertEqual(result.status, 0,
  File "/usr/lib64/python3.12/unittest/case.py", line 885, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/usr/lib64/python3.12/unittest/case.py", line 878, in _baseAssertEqual
    raise self.failureException(msg)
AssertionError: 1 != 0 : bitbake rust-static-test failed:

https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/5420

Can you have a look at the issue?

Thanks,
Mathieu

-- 
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


  reply	other threads:[~2026-12-03  6:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 20:29 [PATCH] rust: enable fully static linking with TCLIBC=glibc Marco Felsch
2026-12-03  6:38 ` Mathieu Dubois-Briand [this message]
2026-12-03 10:52   ` [OE-core] " Marco Felsch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DNAW356KT35W.ANDV5EU04RRO@bootlin.com \
    --to=mathieu.dubois-briand@bootlin.com \
    --cc=m.felsch@pengutronix.de \
    --cc=marco.felsch@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=yocto@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox