diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f5547ca4..2071a625 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,6 +40,25 @@ jobs: - name: Build ${{ matrix.profile }} run: | cargo build --profile=${{ matrix.profile }} ${{ matrix.args }} --lib + build-cross: + name: Cross-compile [${{ matrix.target }}] + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: [ + aarch64-linux-android, + arm-linux-androideabi, + armv7-linux-androideabi, + x86_64-unknown-linux-musl, + ] + steps: + - uses: actions/checkout@v4 + - uses: taiki-e/setup-cross-toolchain-action@v1 + with: + target: ${{ matrix.target }} + - run: | + cargo build --lib nop-rebuilds: name: No-op rebuilds runs-on: ubuntu-22.04 diff --git a/CHANGELOG.md b/CHANGELOG.md index f6d010e2..480e8c70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Unreleased - Adjusted various symbolization code paths to stop heap-allocating - Handled potential numeric overflow in Gsym inlined function parser more gracefully +- Fixed build for some Android flavors 0.2.0-alpha.8 diff --git a/src/file_cache.rs b/src/file_cache.rs index 55b7d630..4c059ed3 100644 --- a/src/file_cache.rs +++ b/src/file_cache.rs @@ -11,6 +11,9 @@ use crate::Result; #[derive(Debug, Eq, Hash, PartialEq)] +// `libc` has deprecated `time_t` usage on `musl`. See +// https://github.com/rust-lang/libc/issues/1848 +#[cfg_attr(target_env = "musl", allow(deprecated))] struct EntryMeta { path: PathBuf, dev: libc::dev_t, @@ -22,13 +25,15 @@ struct EntryMeta { impl EntryMeta { fn new(path: PathBuf, stat: &libc::stat) -> Self { + // Casts are necessary because on Android some libc types do not + // use proper typedefs. https://github.com/rust-lang/libc/issues/3285 Self { path, - dev: stat.st_dev, - inode: stat.st_ino, - size: stat.st_size, + dev: stat.st_dev as _, + inode: stat.st_ino as _, + size: stat.st_size as _, mtime_sec: stat.st_mtime, - mtime_nsec: stat.st_mtime_nsec, + mtime_nsec: stat.st_mtime_nsec as _, } } }