coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

uucore failing to build on 64-bit android

Open xquantxz opened this issue 2 years ago • 7 comments

Compilation on 64-bit android fails with the following errors:

error[E0277]: the trait bound `i64: From<u64>` is not satisfied
   --> src/uucore/src/lib/features/fsext.rs:626:29
    |
626 |         return self.f_bsize.into();
    |                             ^^^^ the trait `From<u64>` is not implemented for `i64`
    |
    = help: the following other types implement trait `From<T>`:                                                                    <i64 as From<bool>>
              <i64 as From<i8>>
              <i64 as From<i16>>
              <i64 as From<i32>>
              <i64 as From<u8>>
              <i64 as From<u16>>
              <i64 as From<u32>>
              <i64 as From<NonZeroI64>>
    = note: required for `u64` to implement `Into<i64>`

error[E0277]: the trait bound `i64: From<u64>` is not satisfied                                                          --> src/uucore/src/lib/features/fsext.rs:690:28
    |
690 |         return self.f_type.into();
    |                            ^^^^ the trait `From<u64>` is not implemented for `i64`
    |
    = help: the following other types implement trait `From<T>`:
              <i64 as From<bool>>
              <i64 as From<i8>>
              <i64 as From<i16>>
              <i64 as From<i32>>
              <i64 as From<u8>>
              <i64 as From<u16>>
              <i64 as From<u32>>
              <i64 as From<NonZeroI64>>
    = note: required for `u64` to implement `Into<i64>`

For more information about this error, try `rustc --explain E0277`.

xquantxz avatar Oct 18 '23 14:10 xquantxz

@sylvestre I think the CI/CD has only 32bit (x86) for android running. Is that true? Should we integrate the x64 build as well for this ticket?

cre4ture avatar Jan 09 '24 19:01 cre4ture

This concrete issue was fixed with #5939. Even though the linked pull request is not closed, we can close this issue. I will create new issues for the remaining, not yet merged improvements from the PR #5821.

cre4ture avatar Mar 14 '24 12:03 cre4ture

I got different error while trying to compile this project in termux/package-builder container.

error[E0432]: unresolved import `uucore::libc::getloadavg`
  --> src/uu/uptime/src/platform/unix.rs:18:5
   |
18 | use uucore::libc::getloadavg;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^ no `getloadavg` in the root

error[E0432]: unresolved import `uucore::utmpx`
  --> src/uu/uptime/src/platform/unix.rs:80:17
   |
80 |     use uucore::utmpx::*;
   |                 ^^^^^ could not find `utmpx` in `uucore`

error[E0433]: failed to resolve: use of undeclared type `Utmpx`
  --> src/uu/uptime/src/platform/unix.rs:85:17
   |
85 |     for line in Utmpx::iter_all_records() {
   |                 ^^^^^ use of undeclared type `Utmpx`

Some errors have detailed explanations: E0432, E0433.
For more information about an error, try `rustc --explain E0432`.

I have tried to build this project with the following command.

	make \
		CARGOFLAGS="--target aarch64-linux-android" \
		PROFILE=release

bionic has its own implementation of

  • getloadavg https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/bionic/getloadavg.cpp
  • utmpx https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/include/utmpx.h

Biswa96 avatar Apr 22 '24 16:04 Biswa96

@Biswa96 We are currently not building in a container but in a android VM. Can you provide a link or more detailed description about the reasons about using the package-builder as you mentioned?

cre4ture avatar Apr 22 '24 21:04 cre4ture

We are currently not building in a container but in a android VM.

Would not the target platform be same?

Here is the cross compile build environment https://github.com/termux/termux-packages/wiki/Build-environment

Biswa96 avatar Apr 23 '24 03:04 Biswa96

Would not the target platform be same?

should be. but we are also not using make for the android build. is there some specific reason for you to use make? This is what our CI does for android on the android VM:

cargo build --features feat_os_unix_android

I also tested if the for you failing uptime is supported by the resulting binary. Answer: No. So its likely that it would also fail in our CI if uptime would be build.

cre4ture avatar Apr 23 '24 17:04 cre4ture

is there some specific reason for you to use make?

It was my mistake. I did not read the cargo files. The cargo build --features feat_os_unix_android command worked. Thank you.

Biswa96 avatar Apr 24 '24 14:04 Biswa96