mbox series

[RFC,0/3] RFC: Fixing rust segfault (#16058) to support Ubuntu 26.04 on Scarthgap

Message ID 20260626-ycongal-scarthgap-rust-segfault-v1-0-97df64b7b298@smile.fr
Headers show
Series RFC: Fixing rust segfault (#16058) to support Ubuntu 26.04 on Scarthgap | expand

Message

Yoann Congal June 26, 2026, 11:37 a.m. UTC
Hello,

I'm currently trying to support Ubuntu 26.04 on Scarthgap, but by doing
so, I awaken bugs fixed on master. The current (and hardest one yet) is:
  16058 – AB-INT: rust do_test_compile/do_install segfault
  https://bugzilla.yoctoproject.org/show_bug.cgi?id=16058

I've this bug triggered here: 
https://autobuilder.yoctoproject.org/valkyrie/?#/builders/40/builds/3981

To fix that, I've tried to backport the fixes mentionned in the bug:
* commit 74ba238ff1ba ("rust: Enable dynamic linking with llvm")
* (commit c31859be39c6 ("rust-llvm: Disable libedit") because I
  trigerred a libedit related linking issue)
* commit d0671c3dad87 ("rust: enable dynamic LLVM linking by default")

But that last commit appears difficult to backport: It was made after
master switch the LLVM compiling rust from rust-llvm to common llvm.

I've hacked the backport until it passes testing:
https://autobuilder.yoctoproject.org/valkyrie/?#/builders/29/builds/4085
... but I'm really *NOT* sure this is the right approach. Hence this RFC
with the patches I ended-up with.

If anyone could check/review/improve these patches to help me get them
to a mergable state, that'd be nice. Otherwise, I would have no other
choice than never support Ubuntu 26.04 on Scarthgap.

Thanks!

I've copied the bug CC list for awareness:

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
Richard Purdie (1):
      rust-llvm: Disable libedit

Sunil Dora (2):
      rust: Enable dynamic linking with llvm
      WIP backport: rust: enable dynamic LLVM linking by default

 meta/lib/oeqa/selftest/cases/rust.py           |  2 +-
 meta/recipes-devtools/rust/rust-llvm_1.75.0.bb | 40 ++++++++++++++++++++++++--
 meta/recipes-devtools/rust/rust_1.75.0.bb      |  6 ++++
 3 files changed, 45 insertions(+), 3 deletions(-)
---
base-commit: f42bc5a91196691a30d92482fdf2eca7eabdbe25
change-id: 20260626-ycongal-scarthgap-rust-segfault-812ae2a9c95d

Best regards,

Comments

Alexander Kanavin June 26, 2026, 2:57 p.m. UTC | #1
On Fri, 26 Jun 2026 at 13:38, Yoann Congal <yoann.congal@smile.fr> wrote:
> I've hacked the backport until it passes testing:
> https://autobuilder.yoctoproject.org/valkyrie/?#/builders/29/builds/4085
> ... but I'm really *NOT* sure this is the right approach. Hence this RFC
> with the patches I ended-up with.
>
> If anyone could check/review/improve these patches to help me get them
> to a mergable state, that'd be nice. Otherwise, I would have no other
> choice than never support Ubuntu 26.04 on Scarthgap.

I had a quick look, and they're basically ok.

The key check is to run ldd on the rust-native pieces and confirm that
they indeed start linking libLLVM*so dynamically after the patches (if
it comes from rust-llvm, it's probably named differently). E.g. on my
master build:

alex@Zen2:/srv/storage/alex/yocto/build-64-alt$ ldd
tmp/sysroots-components/x86_64/rust-native/usr/lib/librustc_driver-5e2c75e9f7705310.so
    linux-vdso.so.1 (0x00007f8f929d0000)
    libLLVM.so.22.1 => not found
    libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f8f8ca00000)

alex@Zen2:/srv/storage/alex/yocto/build-64-alt$ ldd
tmp/sysroots-components/x86_64/rust-native/usr/bin/rustc
    linux-vdso.so.1 (0x00007f3eee009000)
    librustc_driver-5e2c75e9f7705310.so =>
/srv/storage/alex/yocto/build-64-alt/tmp/sysroots-components/x86_64/rust-native/usr/bin/../lib/librustc_driver-5e2c75e9f7705310.so
(0x00007f3ee8400000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3ee820c000)
    libLLVM.so.22.1 => not found
    libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f3ee7e00000)

Alex
Yoann Congal June 26, 2026, 3:26 p.m. UTC | #2
On Fri Jun 26, 2026 at 4:57 PM CEST, Alexander Kanavin wrote:
> On Fri, 26 Jun 2026 at 13:38, Yoann Congal <yoann.congal@smile.fr> wrote:
>> I've hacked the backport until it passes testing:
>> https://autobuilder.yoctoproject.org/valkyrie/?#/builders/29/builds/4085
>> ... but I'm really *NOT* sure this is the right approach. Hence this RFC
>> with the patches I ended-up with.
>>
>> If anyone could check/review/improve these patches to help me get them
>> to a mergable state, that'd be nice. Otherwise, I would have no other
>> choice than never support Ubuntu 26.04 on Scarthgap.
>
> I had a quick look, and they're basically ok.
>
> The key check is to run ldd on the rust-native pieces and confirm that
> they indeed start linking libLLVM*so dynamically after the patches (if
> it comes from rust-llvm, it's probably named differently). E.g. on my
> master build:
>
> alex@Zen2:/srv/storage/alex/yocto/build-64-alt$ ldd
> tmp/sysroots-components/x86_64/rust-native/usr/lib/librustc_driver-5e2c75e9f7705310.so
>     linux-vdso.so.1 (0x00007f8f929d0000)
>     libLLVM.so.22.1 => not found
>     libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f8f8ca00000)
>
> alex@Zen2:/srv/storage/alex/yocto/build-64-alt$ ldd
> tmp/sysroots-components/x86_64/rust-native/usr/bin/rustc
>     linux-vdso.so.1 (0x00007f3eee009000)
>     librustc_driver-5e2c75e9f7705310.so =>
> /srv/storage/alex/yocto/build-64-alt/tmp/sysroots-components/x86_64/rust-native/usr/bin/../lib/librustc_driver-5e2c75e9f7705310.so
> (0x00007f3ee8400000)
>     libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3ee820c000)
>     libLLVM.so.22.1 => not found
>     libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f3ee7e00000)

Ok! So that looks good, because with the patches I get:
$ ldd tmp/sysroots-components/x86_64/rust-native/usr/bin/rustc
	linux-vdso.so.1 (0x00007ffc06548000)
	librustc_driver-686d20105d1a2cf7.so => $BUILD/tmp/sysroots-components/x86_64/rust-native/usr/bin/../lib/librustc_driver-686d20105d1a2cf7.so (0x00007fcec0a00000)
	libstd-64729a5a222c378b.so => $BUILD/tmp/sysroots-components/x86_64/rust-native/usr/bin/../lib/libstd-64729a5a222c378b.so (0x00007fcec08c0000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fcec06de000)
	libLLVM-17.so => not found
	libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fcec0400000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fcec4d63000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fcec0320000)
	$BUILD/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00007fcec4d98000)

And even: $ oe-run-native rust-native /bin/ldd $BUILD/tmp/work/x86_64-linux/rust-native/1.75.0/recipe-sysroot-native/usr/bin/rustc
Getting sysroot...
	linux-vdso.so.1 (0x00007ffd807b1000)
	librustc_driver-686d20105d1a2cf7.so => $BUILD/tmp/work/x86_64-linux/rust-native/1.75.0/recipe-sysroot-native/usr/bin/../lib/librustc_driver-686d20105d1a2cf7.so (0x00007f9ab0800000)
	libstd-64729a5a222c378b.so => $BUILD/tmp/work/x86_64-linux/rust-native/1.75.0/recipe-sysroot-native/usr/bin/../lib/libstd-64729a5a222c378b.so (0x00007f9ab06c0000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9ab04de000)
	libLLVM-17.so => $BUILD/tmp/work/x86_64-linux/rust-native/1.75.0/recipe-sysroot-native/usr/bin/../lib/./libLLVM-17.so (0x00007f9aab000000)
	libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f9aaac00000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f9ab04be000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9ab03de000)
	$BUILD/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00007f9ab4ae2000)

=> It does, in fact, dynamically link on the built libLLVM-17.so.

Thanks!

>
> Alex