Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@taiki-e
Copy link
Contributor

@taiki-e taiki-e commented Jan 27, 2025

Currently building for Android fails with the following errors:

$ cargo build --target=aarch64-linux-android --features=std
   Compiling getrandom v0.3.0 (/Users/taiki/projects/forks/others/getrandom)
   Compiling cfg-if v1.0.0
error[E0432]: unresolved import `libc`
 --> src/backends/../util_libc.rs:6:13
  |
6 |         use libc::__errno as errno_location;
  |             ^^^^ use of unresolved module or unlinked crate `libc`
  |
  = help: if you wanted to use a crate named `libc`, use `cargo add libc` to add it to your `Cargo.toml`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `libc`
  --> src/backends/../util_libc.rs:68:47
   |
68 |                 if err.raw_os_error() != Some(libc::EINTR) {
   |                                               ^^^^ use of unresolved module or unlinked crate `libc`
   |
   = help: if you wanted to use a crate named `libc`, use `cargo add libc` to add it to your `Cargo.toml`

<ommited>

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `libc`
   --> src/backends/use_file.rs:207:23
    |
207 |         let mut pfd = libc::pollfd {
    |                       ^^^^ use of unresolved module or unlinked crate `libc`
    |
    = help: if you wanted to use a crate named `libc`, use `cargo add libc` to add it to your `Cargo.toml`

This is because android set target_env to "", but the following condition has not(any(target_env = "", ..)) for both Linux and Android:

getrandom/Cargo.toml

Lines 33 to 35 in aa96363

# linux_android / linux_android_with_fallback
[target.'cfg(all(any(target_os = "linux", target_os = "android"), not(any(target_env = "", getrandom_backend = "custom"))))'.dependencies]
libc = { version = "0.2.154", default-features = false }

@taiki-e
Copy link
Contributor Author

taiki-e commented Jan 27, 2025

As for CI failure in "Build / Apple Other", it will probably be resolved in the next nightly: rust-lang/rust#136098

Cargo.toml Outdated Show resolved Hide resolved
@newpavlov newpavlov merged commit ac379da into rust-random:master Jan 27, 2025
57 of 58 checks passed
@taiki-e taiki-e deleted the android branch January 27, 2025 19:12
@newpavlov newpavlov mentioned this pull request Jan 27, 2025
newpavlov added a commit that referenced this pull request Jan 28, 2025
### Fixed
- Build error on Android [#588]

[#588]: #588
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.