From 5a3a8eae0db1d0ab04149a1d98f754354bed7b41 Mon Sep 17 00:00:00 2001 From: CloudWebRTC Date: Sat, 30 Nov 2024 21:49:21 +0800 Subject: [PATCH] fixed ffi build for android. (#409) fixed ffi build for android. --- .github/workflows/builds.yml | 4 +++ .github/workflows/ffi-builds.yml | 47 +++++++++++++++++--------------- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 48403b16b..4940634da 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -54,10 +54,13 @@ jobs: target: aarch64-unknown-linux-gnu - os: ubuntu-20.04 target: aarch64-linux-android + ndk_arch: aarch64-unknown-linux-musl - os: ubuntu-20.04 target: armv7-linux-androideabi + ndk_arch: arm-unknown-linux-musleabihf - os: ubuntu-20.04 target: x86_64-linux-android + ndk_arch: x86_64-unknown-linux-musl name: Build (${{ matrix.target }}) runs-on: ${{ matrix.os }} @@ -85,5 +88,6 @@ jobs: - name: Build (Android) if: ${{ contains(matrix.target, 'android') }} run: | + ln -sf $ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/lib/${{ matrix.ndk_arch }}/{libunwind.so,libc++abi.a} $ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/lib/ cargo install cargo-ndk cargo ndk --target ${{ matrix.target }} build --release -p livekit --workspace -vv diff --git a/.github/workflows/ffi-builds.yml b/.github/workflows/ffi-builds.yml index 34a2ea8e4..ccba91f91 100644 --- a/.github/workflows/ffi-builds.yml +++ b/.github/workflows/ffi-builds.yml @@ -78,28 +78,30 @@ jobs: dylib: liblivekit_ffi.so target: aarch64-unknown-linux-gnu name: ffi-linux-arm64 - ## android builds broke - # - os: ubuntu-20.04 - # platform: android - # dylib: liblivekit_ffi.so - # jar: libwebrtc.jar - # target: aarch64-linux-android - # name: ffi-android-arm64 - # buildargs: --no-default-features --features "rustls-tls-webpki-roots" - # - os: ubuntu-20.04 - # platform: android - # dylib: liblivekit_ffi.so - # jar: libwebrtc.jar - # target: armv7-linux-androideabi - # name: ffi-android-armv7 - # buildargs: --no-default-features --features "rustls-tls-webpki-roots" - # - os: ubuntu-20.04 - # platform: android - # dylib: liblivekit_ffi.so - # jar: libwebrtc.jar - # target: x86_64-linux-android - # name: ffi-android-x86_64 - # buildargs: --no-default-features --features "rustls-tls-webpki-roots" + - os: ubuntu-20.04 + platform: android + dylib: liblivekit_ffi.so + jar: libwebrtc.jar + target: aarch64-linux-android + ndk_arch: aarch64-unknown-linux-musl + name: ffi-android-arm64 + buildargs: --no-default-features --features "rustls-tls-webpki-roots" + - os: ubuntu-20.04 + platform: android + dylib: liblivekit_ffi.so + jar: libwebrtc.jar + target: armv7-linux-androideabi + ndk_arch: arm-unknown-linux-musleabihf + name: ffi-android-armv7 + buildargs: --no-default-features --features "rustls-tls-webpki-roots" + - os: ubuntu-20.04 + platform: android + dylib: liblivekit_ffi.so + jar: libwebrtc.jar + target: x86_64-linux-android + ndk_arch: x86_64-unknown-linux-musl + name: ffi-android-x86_64 + buildargs: --no-default-features --features "rustls-tls-webpki-roots" name: Build (${{ matrix.target }}) runs-on: ${{ matrix.os }} @@ -157,6 +159,7 @@ jobs: if: ${{ matrix.platform == 'android' }} run: | cd livekit-ffi/ + ln -sf $ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/lib/${{ matrix.ndk_arch }}/{libunwind.so,libc++abi.a} $ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/lib/ cargo install cargo-ndk cargo ndk --bindgen --target ${{ matrix.target }} build --release ${{ matrix.buildargs }}