FS#79002 - [rust-musl] Linking failure: attempting to use removed LFS64 symbols in musl 1.2.4

Attached to Project: Arch Linux
Opened by kpcyrd (kpcyrd) - Thursday, 06 July 2023, 13:42 GMT
Last edited by Toolybird (Toolybird) - Sunday, 09 July 2023, 07:12 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Jan Alexander Steffens (heftig)
Johannes Löthberg (demize)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

When trying to build the basic hello world I get a linking failure:

```
[root@76ccebf39469 /]# pacman -Suy rust-musl --noconfirm
[...]
[root@76ccebf39469 /]# cargo new --bin foo
Created binary (application) `foo` package
[root@76ccebf39469 foo]# cargo run --target x86_64-unknown-linux-musl
Compiling foo v0.1.0 (/foo)
error: linking with `cc` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/usr/lib64/rustlib/x86_64-unknown-linux-gnu/bin:/usr/lib64/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" VSLANG="1033" "cc" "-m64" "/usr/lib64/rustlib/x86_64-unknown-linux-musl/lib/self-contained/rcrt1.o" "/usr/lib64/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crti.o" "/usr/lib64/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtbeginS.o" "/tmp/rustc3OyRYG/symbols.o" "/foo/target/x86_64-unknown-linux-musl/debug/deps/foo-5ac834d7932ab526.166bbg97p0argtz8.rcgu.o" "/foo/target/x86_64-unknown-linux-musl/debug/deps/foo-5ac834d7932ab526.1holly6b9n7hqluc.rcgu.o" "/foo/target/x86_64-unknown-linux-musl/debug/deps/foo-5ac834d7932ab526.2tnh89jwoni2vv5z.rcgu.o" "/foo/target/x86_64-unknown-linux-musl/debug/deps/foo-5ac834d7932ab526.41y4jy54syf7cp6d.rcgu.o" "/foo/target/x86_64-unknown-linux-musl/debug/deps/foo-5ac834d7932ab526.4p9fmkr3ehqt1033.rcgu.o" "/foo/target/x86_64-unknown-linux-musl/debug/deps/foo-5ac834d7932ab526.7vrdkm7lnx43dn8.rcgu.o" "/foo/target/x86_64-unknown-linux-musl/debug/deps/foo-5ac834d7932ab526.2dcb6l7et1x18xy3.rcgu.o" "-Wl,--as-needed" "-L" "/foo/target/x86_64-unknown-linux-musl/debug/deps" "-L" "/foo/target/debug/deps" "-L" "/usr/lib64/rustlib/x86_64-unknown-linux-musl/lib" "-Wl,-Bstatic" "/usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-bedd8f029c3de37e.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libpanic_unwind-8fbf226e8909dce7.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libobject-ac248ec0244adfb4.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libmemchr-afdc761fb4f5b564.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libaddr2line-8730070d04a9cc1c.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libgimli-2b419a0bf84feba6.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_demangle-90d41c5a795e9bcd.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd_detect-500ea091a71642ce.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libhashbrown-12cea4edf1e52f73.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libminiz_oxide-3758188674e8194a.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libadler-60da827943ed6f8f.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_alloc-743b46d5b6585f1e.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libunwind-30fd35320846e460.rlib" "-lunwind" "/usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libcfg_if-684d926bbdc9216b.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-musl/lib/liblibc-7514698a93a3ce5f.rlib" "-lc" "/usr/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc-90de70d63ec4b5eb.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_core-62b64d473a5f2891.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libcore-ebe0bc455770d481.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libcompiler_builtins-ac64780b3f766a15.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-nostartfiles" "-L" "/usr/lib64/rustlib/x86_64-unknown-linux-musl/lib" "-L" "/usr/lib64/rustlib/x86_64-unknown-linux-musl/lib/self-contained" "-o" "/foo/target/x86_64-unknown-linux-musl/debug/deps/foo-5ac834d7932ab526" "-Wl,--gc-sections" "-static-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "/usr/lib64/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtendS.o" "/usr/lib64/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtn.o"
= note: /usr/sbin/ld: /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-bedd8f029c3de37e.rlib(std-bedd8f029c3de37e.std.1b7b6736-cgu.0.rcgu.o): in function `std::sys::unix::fs::stat::{{closure}}':
/rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys/unix/fs.rs:1539: undefined reference to `stat64'
/usr/sbin/ld: /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys/unix/fs.rs:1539: undefined reference to `stat64'
/usr/sbin/ld: /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-bedd8f029c3de37e.rlib(std-bedd8f029c3de37e.std.1b7b6736-cgu.0.rcgu.o): in function `std::sys::unix::fs::File::open_c::{{closure}}':
/rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys/unix/fs.rs:1037: undefined reference to `open64'
/usr/sbin/ld: /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-bedd8f029c3de37e.rlib(std-bedd8f029c3de37e.std.1b7b6736-cgu.0.rcgu.o): in function `std::sys::unix::cvt':
/rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys/unix/mod.rs:(.text._ZN3std3sys4unix2fs4File6open_c17h03474253e57245caE+0xfa): undefined reference to `open64'
/usr/sbin/ld: /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-bedd8f029c3de37e.rlib(std-bedd8f029c3de37e.std.1b7b6736-cgu.0.rcgu.o): in function `std::sys::unix::fs::File::file_attr':
/rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys/unix/fs.rs:1056: undefined reference to `fstat64'
collect2: error: ld returned 1 exit status

= note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the `-l` flag to specify native libraries to link
= note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

error: could not compile `foo` (bin "foo") due to previous error
```

There's a recent bug report in gentoo about rust+musl with identical error messages: https://bugs.gentoo.org/903607

It was fixed like this:

https://github.com/orbea/gentoo/commit/31661253a5b77ed18e38fc27fa22ebb9deca8257

The commit message states there was a change in LFS64 symbols in musl 1.2.4, which was released 2 months ago in Arch Linux.

Using the `x86_64-unknown-linux-musl` files from rustup still works on Arch Linux.

Additional info:

* rust-musl 1:1.70.0-1
* musl version present in rust-musl build environment: `installed = musl-1.2.4-1-x86_64`
* upstream: https://github.com/rust-lang/rust/pull/107129
* upstream: https://github.com/rust-lang/libc/pull/3068
* upstream: https://github.com/rust-lang/libc/pull/2935
* https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4
This task depends upon

Closed by  Toolybird (Toolybird)
Sunday, 09 July 2023, 07:12 GMT
Reason for closing:  Duplicate
Additional comments about closing:   FS#78698 
Comment by Toolybird (Toolybird) - Thursday, 06 July 2023, 13:47 GMT
 FS#78698 

Loading...