Skip to contentSkip to conversation

Remove rust-llvm dependency after LLVM split

DISCUSSION Deepesh Varatharajan 2 participants 5 messages Sep 16, 2025 – Sep 19, 2025 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hi All,

We have successfully built Rust 1.91 (nightly) using Clang 21.1.0 after removing rust-llvm dependency. Additionally, we used Ross's poky-contrib branch, which separates the LLVM recipe from Clang, to build Rust-1.89 with LLVM 21.1.0 without the rust-llvm dependency successfully and below are the results.

Rust Build Results

With rust-llvm :

real    50m1.506s
user    0m13.196s
sys     0m1.429s
Disk usage 40G

 With LLVM :

real    53m29.662s
user    0m12.940s
sys     0m1.176s
Disk usage 43G

Can we submit the rust-llvm removal patch once Ross's patch is merged into the poky master branch?

Regards,
Deepesh

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 9 lines · Ross Burton

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

Hi Deepesh,

Quoted 4 lines · Deepesh via lists.openembedded.org

We have successfully built Rust 1.91 (nightly) using Clang 21.1.0 after removing rust-llvm dependency. Additionally, we used Ross's poky-contrib branch, which separates the LLVM recipe from Clang, to build Rust-1.89 with LLVM 21.1.0 without the rust-llvm dependency successfully and below are the results.

Quoted 6 lines

Excellent news :)

Can you share a branch with your changes in? I’d love to run it through the performance builders to see what it says.

Cheers,
Ross

The relevant changes are present in the following poky-contrib branch:

https://git.yoctoproject.org/poky-contrib/commit/?h=harish/rust-llvm

We’ve successfully built Rust, the SDK, and passed oe-selftest across all architectures. However, we’re currently facing a build failure when *multilib is enabled*. The issue stems from "llvm-config" attempting to locate dependent libraries in the "lib" directory instead of "lib64".

--- stderr
|   llvm-config: error: missing: poky/build/tmp/work/x86-64-v3-poky-linux/rust/1.89.0/recipe-sysroot/usr/lib/libLLVMDemangle.a |   llvm-config: error: missing: poky/build/tmp/work/x86-64-v3-poky-linux/rust/1.89.0/recipe-sysroot/usr/lib/libLLVMSupport.a

I guess this is related to the following snippet in rust recipe :

 # Copy the natively built llvm-config into the target so we can run it. Horrible,

    # but works!
    if [ ${RUST_ALTERNATE_EXE_PATH_NATIVE} != ${RUST_ALTERNATE_EXE_PATH} -a ! -f ${RUST_ALTERNATE_EXE_PATH} ]; then
        mkdir -p `dirname ${RUST_ALTERNATE_EXE_PATH}`
        cp ${RUST_ALTERNATE_EXE_PATH_NATIVE} ${RUST_ALTERNATE_EXE_PATH}
        if [ -e ${STAGING_LIBDIR_NATIVE}/libc++.so.1 ]; then
            patchelf --set-rpath \$ORIGIN/../../../../../`basename ${STAGING_DIR_NATIVE}`${libdir_native} ${RUST_ALTERNATE_EXE_PATH}
        else
            patchelf --remove-rpath ${RUST_ALTERNATE_EXE_PATH}
        fi
    fi

Is there anything specific I should be watching out for here?

Regards,
Deepesh

Quoted 1 line

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

#3 lore raw
Quoted 1 line · Deepesh Varatharajan
Quoted 1 line

Can you share a branch with your changes in? I’d love to run it through the performance builders to see what it says.

So I rebased this patch on top of my clang/llvm split and the results are encouraging:

https://valkyrie.yocto.io/pub/non-release/20250918-107/testresults/buildperf-alma8/perf-alma8-vk_ross_wrrustllvm_20250918175407_f5c74dc97d3.html

The build time reduction is slightly more than with just the split which is good, and the tmpdir size drop is very noticable too. Excellent work!

For reference, this is the buildperf results for just the clang/llvm split:

https://valkyrie.yocto.io/pub/non-release/20250913-79/testresults/buildperf-debian11/perf-debian12-vk_ross_llvm_20250913145051_e65d2b894fd.html

Cheers,
Ross

#4 lore raw
Quoted 9 lines · Ross Burton

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

Quoted 1 line · Deepesh Varatharajan
Quoted 1 line

Can you share a branch with your changes in? I’d love to run it through the performance builders to see what it says.

So I rebased this patch on top of my clang/llvm split and the results are encouraging:

https://valkyrie.yocto.io/pub/non-release/20250918-107/testresults/buildperf-alma8/perf-alma8-vk_ross_wrrustllvm_20250918175407_f5c74dc97d3.html

Quoted 8 lines

The build time reduction is slightly more than with just the split which is good, and the tmpdir size drop is very noticable too. Excellent work!

For reference, this is the buildperf results for just the clang/llvm split:

https://valkyrie.yocto.io/pub/non-release/20250913-79/testresults/buildperf-debian11/perf-debian12-vk_ross_llvm_20250913145051_e65d2b894fd.html

Cheers,
Ross

Hi All,

As mentioned earlier, we're encountering a Rust build failure when multilib is enabled. The issue stems from "llvm-config" looking for libraries in "$STAGING_DIR_TARGET/usr/lib" instead of the intended "$STAGING_DIR_TARGET/usr/lib" path when multilibs enabled. This appears to be due to a hardcoded library path.

I noticed there's a patch (0005-llvm-allow-env-override-of-exe-and-libdir-path.patch) present in clang. Even though the build fails.

I also attempted to export the $STAGING_LIBDIR variable, but it seems to be unset or overridden during the build process. Is there something I might be missing or overlooking here?

Thanks,
Deepesh

#5 lore raw
Quoted 19 lines · Deepesh Varatharajan
Quoted 17 lines · Ross Burton

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

Quoted 1 line · Deepesh Varatharajan
Quoted 1 line

Can you share a branch with your changes in? I’d love to run it through the performance builders to see what it says.

So I rebased this patch on top of my clang/llvm split and the results are encouraging:

https://valkyrie.yocto.io/pub/non-release/20250918-107/testresults/buildperf-alma8/perf-alma8-vk_ross_wrrustllvm_20250918175407_f5c74dc97d3.html

The build time reduction is slightly more than with just the split which is good, and the tmpdir size drop is very noticable too.  Excellent work!

For reference, this is the buildperf results for just the clang/llvm split:

https://valkyrie.yocto.io/pub/non-release/20250913-79/testresults/buildperf-debian11/perf-debian12-vk_ross_llvm_20250913145051_e65d2b894fd.html

Quoted 7 lines
Quoted 2 lines

Cheers,
Ross

Hi All,

As mentioned earlier, we're encountering a Rust build failure when multilib is enabled. The issue stems from "llvm-config" looking for libraries in "$STAGING_DIR_TARGET/usr/lib" instead of the intended "$STAGING_DIR_TARGET/usr/lib" path when multilibs enabled. This appears to be due to a hardcoded library path.

Apologies for the confusion in my earlier message,

The issue stems from "llvm-config" looking for libraries in "$STAGING_DIR_TARGET/usr/lib" instead of the intended "$STAGING_DIR_TARGET/usr/lib64" path when multilibs enabled. This appears to be due to a hardcoded library path.

llvm-config: error: missing: poky/build/tmp/work/x86-64-v3-poky-linux/rust/1.89.0/recipe-sysroot/usr/lib/libLLVMX86Disassembler.a
llvm-config: error: missing: poky/build/tmp/work/x86-64-v3-poky-linux/rust/1.89.0/recipe-sysroot/usr/lib/libLLVMX86TargetMCA.a

But these files are present in poky/build/tmp/work/x86-64-v3-poky-linux/rust/1.89.0/recipe-sysroot/usr/lib64 location.

Quoted 9 lines

I noticed there's a patch (0005-llvm-allow-env-override-of-exe-and-libdir-path.patch) present in clang. Even though the build fails.

I also attempted to export the $STAGING_LIBDIR variable, but it seems to be unset or overridden during the build process. Is there something I might be missing or overlooking here?

Thanks,
Deepesh