Failed to compile rust with musl libc

⚓ Rust    📅 2025-07-24    👤 surdeus    👁️ 2      

surdeus

Hi guys, I am working on my own linux distribution, I am the author of the new package manager called ISM (Ingenius System Manager):

I am integrating musl in my distro. Normally rust compile without problem with glibc, but when I try to compile with a musl based system, I am gettting this error:

extracting /sources/ProgrammingLanguages-Main/Rust/1.82.0/Sources/build/cache/2024-09-05/rust-std-1.81.0-x86_64-unknown-linux-gnu.tar.xz
extracting /sources/ProgrammingLanguages-Main/Rust/1.82.0/Sources/build/cache/2024-09-05/rustc-1.81.0-x86_64-unknown-linux-gnu.tar.xz
extracting /sources/ProgrammingLanguages-Main/Rust/1.82.0/Sources/build/cache/2024-09-05/cargo-1.81.0-x86_64-unknown-linux-gnu.tar.xz
Building bootstrap
Traceback (most recent call last):
  File "/sources/ProgrammingLanguages-Main/Rust/1.82.0/Sources/./x.py", line 50, in <module>
    bootstrap.main()
  File "/sources/ProgrammingLanguages-Main/Rust/1.82.0/Sources/src/bootstrap/bootstrap.py", line 1208, in main
    bootstrap(args)
  File "/sources/ProgrammingLanguages-Main/Rust/1.82.0/Sources/src/bootstrap/bootstrap.py", line 1175, in bootstrap
    build.build_bootstrap()
  File "/sources/ProgrammingLanguages-Main/Rust/1.82.0/Sources/src/bootstrap/bootstrap.py", line 921, in build_bootstrap
    run(args, env=env, verbose=self.verbose, cwd=self.rust_root)
  File "/sources/ProgrammingLanguages-Main/Rust/1.82.0/Sources/src/bootstrap/bootstrap.py", line 190, in run
    ret = subprocess.Popen(args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.12/subprocess.py", line 1955, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/sources/ProgrammingLanguages-Main/Rust/1.82.0/Sources/build/x86_64-unknown-linux-gnu/stage0/bin/cargo'

This is the full log: downloading... - TextUp

The config.toml:

change-id = 125535

[llvm]
targets = "X86"
link-shared = true

[build]
target = ["x86_64-unknown-linux-musl"]
docs = false
extended = true
locked-deps = true
tools = ["cargo", "rustdoc"]
vendor = true

[install]
prefix = "/usr"
docdir = "share/doc/rustc-1.82.0"

[rust]
channel = "stable"
lto = "thin"
codegen-units = 1

[target.x86_64-unknown-linux-musl]

The run command to start the building process was:

LIBSSH2_SYS_USE_PKG_CONFIG=1 LIBSQLITE3_SYS_USE_PKG_CONFIG=1 ./x.py build library/std --stage 0

The thing strange is that the file exist :x

1 post - 1 participant

Read full topic

🏷️ Rust_feed