Closed slendermon closed 1 year ago
Thank you for the report. This is indeed an issue similar to something we had before with ARM 64-bit systems.
I pushed a fix for this. This is something that is specific to MUSL used by alpine, it should not have much to do with the cargo version from my perspective.
Could you test whether the fix works and let me know?
Sorry, there were some more errors I didn't list
And this is after the fix:
error[E0425]: cannot find value `USER_PROCESS` in crate `libc`
--> src/auth/utmpx.rs:31:27
|
31 | s.ut_type = libc::USER_PROCESS;
| ^^^^^^^^^^^^ help: a constant with a similar name exists: `PRIO_PROCESS`
|
::: /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.139/src/unix/linux_like/linux/musl/mod.rs:625:1
|
625 | pub const PRIO_PROCESS: ::c_int = 0;
| ------------------------------- similarly named constant `PRIO_PROCESS` defined here
error[E0425]: cannot find function `setutxent` in crate `libc`
--> src/auth/utmpx.rs:72:15
|
72 | libc::setutxent();
| ^^^^^^^^^ help: a function with a similar name exists: `setgrent`
|
::: /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.139/src/unix/linux_like/linux/mod.rs:3826:5
|
3826 | pub fn setgrent();
| ----------------- similarly named function `setgrent` defined here
error[E0425]: cannot find function `pututxline` in crate `libc`
--> src/auth/utmpx.rs:73:15
|
73 | libc::pututxline(&entry as *const utmpx);
| ^^^^^^^^^^ not found in `libc`
error[E0425]: cannot find value `DEAD_PROCESS` in crate `libc`
--> src/auth/utmpx.rs:87:31
|
87 | entry.ut_type = libc::DEAD_PROCESS;
| ^^^^^^^^^^^^ help: a constant with a similar name exists: `PRIO_PROCESS`
|
::: /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.139/src/unix/linux_like/linux/musl/mod.rs:625:1
|
625 | pub const PRIO_PROCESS: ::c_int = 0;
| ------------------------------- similarly named constant `PRIO_PROCESS` defined here
error[E0425]: cannot find function `setutxent` in crate `libc`
--> src/auth/utmpx.rs:96:19
|
96 | libc::setutxent();
| ^^^^^^^^^ help: a function with a similar name exists: `setgrent`
|
::: /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.139/src/unix/linux_like/linux/mod.rs:3826:5
|
3826 | pub fn setgrent();
| ----------------- similarly named function `setgrent` defined here
error[E0425]: cannot find function `pututxline` in crate `libc`
--> src/auth/utmpx.rs:97:19
|
97 | libc::pututxline(&entry as *const utmpx);
| ^^^^^^^^^^ not found in `libc`
error[E0425]: cannot find function `endutxent` in crate `libc`
--> src/auth/utmpx.rs:98:19
|
98 | libc::endutxent();
| ^^^^^^^^^ help: a function with a similar name exists: `endgrent`
|
::: /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.139/src/unix/linux_like/linux/mod.rs:3827:5
|
3827 | pub fn endgrent();
| ----------------- similarly named function `endgrent` defined here
error[E0308]: mismatched types
--> src/chvt.rs:39:33
|
39 | if unsafe { libc::ioctl(fd, KDGKBTYPE, &mut arg) } > 0 {
| ----------- ^^^^^^^^^ expected `i32`, found `u64`
| |
| arguments to this function are incorrect
|
note: function defined here
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.139/src/unix/linux_like/linux/musl/mod.rs:729:12
|
729 | pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
| ^^^^^
help: you can convert a `u64` to an `i32` and panic if the converted value doesn't fit
|
39 | if unsafe { libc::ioctl(fd, KDGKBTYPE.try_into().unwrap(), &mut arg) } > 0 {
| ++++++++++++++++++++
error[E0308]: mismatched types
--> src/chvt.rs:99:45
|
99 | let activate = unsafe { libc::ioctl(fd, VT_ACTIVATE, ttynum as c_int) };
| ----------- ^^^^^^^^^^^ expected `i32`, found `u64`
| |
| arguments to this function are incorrect
|
note: function defined here
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.139/src/unix/linux_like/linux/musl/mod.rs:729:12
|
729 | pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
| ^^^^^
help: you can convert a `u64` to an `i32` and panic if the converted value doesn't fit
|
99 | let activate = unsafe { libc::ioctl(fd, VT_ACTIVATE.try_into().unwrap(), ttynum as c_int) };
| ++++++++++++++++++++
error[E0308]: mismatched types
--> src/chvt.rs:104:41
|
104 | let wait = unsafe { libc::ioctl(fd, VT_WAITACTIVE, ttynum) };
| ----------- ^^^^^^^^^^^^^ expected `i32`, found `u64`
| |
| arguments to this function are incorrect
|
note: function defined here
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.139/src/unix/linux_like/linux/musl/mod.rs:729:12
|
729 | pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
| ^^^^^
help: you can convert a `u64` to an `i32` and panic if the converted value doesn't fit
|
104 | let wait = unsafe { libc::ioctl(fd, VT_WAITACTIVE.try_into().unwrap(), ttynum) };
| ++++++++++++++++++++
Ah. Yes, I see. Alpine Linux and musl
does not implement utmpx. Maybe, for now, it is an idea just to put utmpx
behind a platform cfg
, since I don't see any people working on utmps
support within the Rust ecosystem. Utmpx is also not strictly necessary.
I will see what I can do.
Could you please confirm that this indeed solves the issue? Cross-compilation to x86_64-unknown-linux-musl
now works for me, but there might still be some linking problem.
Sorry this time for being very late to reply, but it does compile without issue. I will have to test if the actual program works.
Edit: Yes it works fine on Alpine. I don't see a symlink for it in /usr/bin? But Alpine does use different init so I had to change the install.sh script to remove systemd service. Thanks for the hard work
cargo 1.70.0
rustc 1.70.0
(alpine) linux 6.1.34-4
I use openrc init system, if that matters
I used cargo, not a package manager
Compiled with cargo build from git clone lemur, ran into error
I use an x86_64 cpu
I think its trying to give me 32bit, but I use 64bit