On 2026-02-13 2:51 p.m., Dora, Sunil Kumar via lists.openembedded.org wrote:
On Thu, Feb 12, 2026 at 10:36 PM, Ross Burton wrote:

    What’s the impact on the native sysroot and target packages when
    we link rust against all of libLLVM.so dynamically vs statically
    linking the pieces that are used?

Hi Ross,

Below are the observed impacts when linking Rust against shared libLLVM.so versus
statically linking LLVM components.

On Native:
**********
All required LLVM-related libraries were already present in recipe-sysroot-native before switching Rust to dynamic LLVM. Dynamic linking does not introduce any new native dependencies.
Existing llvm-native artifacts are reused.

Static:
-rw-r--r-- 1 xxx users 213M Feb 13 00:29 librustc_driver-4b6f2c2478f9ef2c.so
Dynamic:
-rw-r--r-- 1 xxx users 132M Feb 13 00:52 librustc_driver-4b6f2c2478f9ef2c.so

So on native we see ~81 MB reduction in librustc_driver, with no additional sysroot growth.

On Target:
**********
librustc_driver shrinks from 144.8 MB to 84.2 MB (~60 MB reduction).
However, dynamic linking introduces shared libLLVM.so plus a few runtime dependencies.

Static:
root@qemux86-64:~# ls -lh /usr/lib/librustc_driver-*.so
-rw-r--r--    1 root     root      144.8M Apr  5  2011 /usr/lib/librustc_driver-151eed90355bbdac.so

Dynamic:
root@qemux86-64:~# ls -lh /usr/lib/librustc_driver-*.so
-rw-r--r--    1 root     root       84.2M Apr  5  2011 /usr/lib/librustc_driver-151eed90355bbdac.so

New dynamic dependencies:
root@qemux86-64:~# ldd /usr/lib/librustc_driver-*.so
        libLLVM.so.21.1 libffi.so.8 libxml2.so.16

Size contribution on target:
 - libLLVM.so.21.1 ≈ 75.5 MB
 - libxml2.so.16 ≈ 1.2 MB
 - libffi.so.8 ≈ 42.5 KB

When LLVM is only used by Rust, this results in a net image increase of approximately 15–16 MB.


Good, that's annoying but acceptable increase: ~7% to work-around this bug.

I'm still a bit uncomfortable with changing the way that target Rust is built to deal with a Rust-native problem. Also there's the question about dynamic linking increasing runtime by a small amount. Finally, I worry that few people/distros change the default linking to by dynamic.

So I won't object to this work-around especially if we can easily limit it to -native. Have you tried that? In a few years, we won't have this mix of toolchain versions and can drop this change

so if this gets merged please open a tracking bug so that we don't forget.

../Randy







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

Reply via email to