From 50b8d801349570999bf76954569352c21380a4e5 Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Thu, 23 Mar 2023 15:22:30 +0100 Subject: [PATCH 1/2] Add a github workflow to cross compile This should fail --- .github/workflows/ci.yml | 48 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b41e20..0d944bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,5 +12,53 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + + - name: Install Rust Toolchain + run: rustup toolchain install stable --profile minimal --no-self-update + - name: Run rustfmt run: cargo fmt --all --check + + check: + name: Check + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macOS-latest, windows-latest] + + steps: + - uses: actions/checkout@master + + - name: Install Rust Toolchain + run: rustup toolchain install stable --profile minimal --no-self-update + + - uses: swatinem/rust-cache@v2 + + - name: Run cargo check + run: cargo check + + cross: + name: Cross compile + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: + - i686-unknown-linux-gnu + - armv7-linux-androideabi + - aarch64-linux-android + + steps: + - uses: actions/checkout@master + + - name: Install Rust Toolchain + run: rustup toolchain install stable --profile minimal --no-self-update + + - uses: swatinem/rust-cache@v2 + + - name: Install cross + run: cargo install cross + + - name: Rust check + run: cross check --target ${{ matrix.target }} From c003d2d35d0360f8c1ce5faf1c4d032beee4931b Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Thu, 23 Mar 2023 15:27:42 +0100 Subject: [PATCH 2/2] Fix the android dlopen call --- src/interface/android.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interface/android.rs b/src/interface/android.rs index 4012f84..3fad9df 100644 --- a/src/interface/android.rs +++ b/src/interface/android.rs @@ -13,7 +13,7 @@ pub fn get_libc_ifaddrs() -> Option<( fn load_symbol(sym: &'static str) -> Option { const LIB_NAME: &str = "libc.so"; - match dlopen::raw::Library::open(LIB_NAME) { + match dlopen2::raw::Library::open(LIB_NAME) { Ok(lib) => match unsafe { lib.symbol::(sym) } { Ok(val) => Some(val), Err(err) => {