Open
Description
We have a proprietry Rust library we have been using for the past few years. We compile it to a .a file on GNU/Linux linked against musl libc, and then link it to our C++ libraries or applications.
This used to work fine until Rust version 1.83.0. But, with any newer versions we get the following linker error:
ld.lld: error: undefined symbol: posix_spawn_file_actions_addchdir_np
>>> referenced by unix.rs:706 (library/std/src/sys/process/unix/unix.rs:706)
>>> std-35c5a11e4fef3042.std.b3e601a09ed2eba9-cgu.0.rcgu.o:(std::sys::process::unix::unix::_$LT$impl$u20$std..sys..process..unix..common..Command$GT$::spawn::h08060e6e1d5b59e5) in archive /home/mamadou/dev/SomeProject/stage/lib/linux/rustc/x86-64/debug/libSomeRustLib.a
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
I've noticed issue #99740 and pull request 3949 has introduced something related to this.
Code
I expected to see this happen:
The code should
Instead, this happened: explanation
Version it worked on
It most recently worked on: Rust 1.83.0
Version with regression
Any version newer than v1.83.0
fails to link.
rustc --version --verbose
:
rustc 1.87.0 (17067e9ac 2025-05-09)
binary: rustc
commit-hash: 17067e9ac6d7ecb70e50f92c1944e545188d2359
commit-date: 2025-05-09
host: x86_64-unknown-linux-gnu
release: 1.87.0
LLVM version: 20.1.1