Skip to content

Bootstrap failed when multilibs are enabled in yocto environment from 1.83 #138983

Closed
@DeepeshvRajan

Description

@DeepeshvRajan

In Yocto, we are attempting to build Rust with multilibs enabled. During the process, due to an additional check introduced in Rust 1.83 (68034f8), the bootstrap process attempts to execute the following command:

rust/build/tmp/work/core2-64-poky-linux/rust/1.83.0/rustc-1.83.0-src/build/x86_64-unknown-linux-gnu/stage1/bin/rustc --target=x86_64-poky-linux-gnu --print=file-names --crate-type=proc-macro

However, it fails with the following error:

rust/build/tmp/work/core2-64-poky-linux/rust/1.83.0/rustc-1.83.0-src/build/x86_64-unknown-linux-gnu/stage1/bin/rustc: error while loading shared libraries: librustc_driver-8f30db6f3d93a748.so: cannot open shared object file: No such file or directory

The failure occurs because the dependent .so files for rustc are placed inside the lib64 directory, but rustc is trying to find them in the lib directory. This issue only happens in Stage 1 of the build process. In Stage 2, the behavior works as expected, with rustc correctly searching in the lib64 directory.

For stage1 :

rust/build/tmp/work/core2-64-poky-linux/rust/1.83/rustc-1.83.0-src/build/x86_64-unknown-linux-gnu/stage1/bin > readelf -d rustc

Dynamic section at offset 0x2dc0 contains 27 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [librustc_driver-109effcb13e61f4a.so]
 0x0000000000000001 (NEEDED)             Shared library: [libstd-48bf5a1412e91aba.so]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000001d (RUNPATH)            Library runpath: [rust/build/tmp/work/core2-64-poky-linux/rust/1.83.0/recipe-sysroot-native/usr/lib:rust/build/tmp/work/core2-64-poky-linux/rust/1.83.0/recipe-sysroot-native/lib:$ORIGIN/../lib]

For stage2 :

rust/build/tmp/work/core2-64-poky-linux/rust/1.83.0/rustc-1.83.0-src/build/x86_64-unknown-linux-gnu/stage2/bin > readelf -d rustc

Dynamic section at offset 0x2dc0 contains 27 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [librustc_driver-ca461ae9df3c32c3.so]
 0x0000000000000001 (NEEDED)             Shared library: [libstd-e58ab20a7b688164.so]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000001d (RUNPATH)            Library runpath: [rust/build/tmp/work/core2-64-poky-linux/rust/1.83.0/recipe-sysroot-native/usr/lib:rust/build/tmp/work/core2-64-poky-linux/rust/1.83.0/recipe-sysroot-native/lib:$ORIGIN/../lib64]

During the bootstrapping process, we've noticed that when RPATH is set to true for Rust, it points to $ORIGIN/../lib on Linux systems. However, in stage2, it is pointing to $ORIGIN/../lib64, which seems correct. Is this the expected behavior, or are we missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions