You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm buildling on aarch64-unknown-linux-musl, and my target is aarch64-unknown-linux-musl (e.g.: there's no cross-compiling going on here).
The above builds fine, but the resulting binary fails to run:
> cargo run
Compiling libc v0.2.137
Compiling memmap2 v0.5.7
Compiling xkbcommon v0.5.0
Compiling hello v0.1.0 (/home/user/hello)
Finished dev [unoptimized + debuginfo] target(s) in 6.67s
Running `target/debug/hello`
error: could not execute process `target/debug/hello` (never executed)
Caused by:
No such file or directory (os error 2)
The resulting binary is clearly linked against glibc, which is not present here:
> ldd target/debug/hello
/lib/ld-linux-aarch64.so.1(0xffffacf0b000)
libxkbcommon.so.0 => /usr/lib/libxkbcommon.so.0(0xffffacebc000)
libc.musl-aarch64.so.1 => /lib/ld-linux-aarch64.so.1(0xffffacf0b000)
> readelf -l target/debug/helloElf file type is EXEC(Executable file)Entry point 0x405328There are 9 program headers, starting at offset 64ProgramHeaders:TypeOffsetVirtAddrPhysAddrFileSizMemSizFlagsAlignPHDR0x00000000000000400x00000000004000400x00000000004000400x00000000000001f80x00000000000001f8R0x8INTERP0x00000000000002380x00000000004002380x00000000004002380x000000000000001b0x000000000000001bR0x1[Requesting program interpreter: /lib/ld-linux-aarch64.so.1]LOAD0x00000000000000000x00000000004000000x00000000004000000x00000000000581dc0x00000000000581dcRE0x10000LOAD0x0000000000058e280x0000000000468e280x0000000000468e280x00000000000073380x0000000000008e40RW0x10000DYNAMIC0x000000000005fcb00x000000000046fcb00x000000000046fcb00x00000000000001f00x00000000000001f0RW0x8TLS0x000000000005d7580x000000000046d7580x000000000046d7580x00000000000000280x0000000000000050R0x8GNU_EH_FRAME0x00000000000561240x00000000004561240x00000000004561240x000000000000132c0x000000000000132cR0x4GNU_STACK0x00000000000000000x00000000000000000x00000000000000000x00000000000000000x0000000000000000RW0x10GNU_RELRO0x0000000000058e280x0000000000468e280x0000000000468e280x00000000000071d80x00000000000071d8R0x1Section to Segment mapping:SegmentSections...
0001.interp02.interp.gnu.hash.dynsym.dynstr.gnu.version.gnu.version_r.rela.dyn.rela.plt.init.plt.text.fini.rodata.debug_gdb_scripts.eh_frame_hdr.gcc_except_table03.eh_frame.tdata.init_array.fini_array.data.rel.ro.dynamic.got.data.bss04.dynamic05.tdata.tbss06.eh_frame_hdr0708.eh_frame.tdata.init_array.fini_array.data.rel.ro.dynamic.got
Any reference to xkbcommon-rs results in the binary being linked to glibc and becoming unusable on this platform. However, looking at xkbcommon-rs, I see no references to glibc, so it's not immediately clear to me what's wrong. OTOH, I'm also not sure how this crate does find and link C-xkbcommon.
Trying to write code that references the C library itself fails to build for me. E.g.: the following fails to build due to not finding C-xkbcommon:
Again, I don't quite see anything in particular in this repo that addresses this, so I'm kinda missing how the whole thing builds -- which should definitely help figure how why the wrong libc gets linked.
I suggest that you should open an issue in Cargo.
This crate only specifies that symbols are to be linked with xkbcommon, but cargo does the actual job.
Yeah, I figured this is an upstream issue somewhere. Using rustup yields the bogus results described above. Using packages from alpine/edge on that same host yield sane builds.
I'm trying to build the following minimal example:
I'm buildling on
aarch64-unknown-linux-musl
, and my target isaarch64-unknown-linux-musl
(e.g.: there's no cross-compiling going on here).The above builds fine, but the resulting binary fails to run:
The resulting binary is clearly linked against glibc, which is not present here:
Any reference to
xkbcommon-rs
results in the binary being linked to glibc and becoming unusable on this platform. However, looking atxkbcommon-rs
, I see no references to glibc, so it's not immediately clear to me what's wrong. OTOH, I'm also not sure how this crate does find and link C-xkbcommon
.Trying to write code that references the C library itself fails to build for me. E.g.: the following fails to build due to not finding C-
xkbcommon
:Again, I don't quite see anything in particular in this repo that addresses this, so I'm kinda missing how the whole thing builds -- which should definitely help figure how why the wrong libc gets linked.
I tried asking in Rust's Zulip chat, but haven't managed to pinpoint what the issue might be. https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Building.20on.20musl.20with.20target.20musl.20links.20to.20glibc
Do you have any idea what might be up?
The text was updated successfully, but these errors were encountered: