From f4d3065787d8c034b11a2aa7125b713b34eb87cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Char=E2=98=86?= <50830649+char5742@users.noreply.github.com> Date: Wed, 22 Mar 2023 23:09:46 +0900 Subject: [PATCH] =?UTF-8?q?Android=20(arm64)=20=E5=90=91=E3=81=91=E3=83=93?= =?UTF-8?q?=E3=83=AB=E3=83=89=E3=81=AE=E8=BF=BD=E5=8A=A0=20(#444)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ryo Yamashita --- .cargo/config.toml | 3 +++ .github/workflows/build_and_deploy.yml | 21 +++++++++++++++++++-- Cargo.lock | 11 +++++------ crates/voicevox_core/Cargo.toml | 7 ++++--- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 3a2825a80..bd4998b67 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -10,3 +10,6 @@ ORT_OUT_DIR = { value = "target/debug/deps", relative = true } [target.aarch64-unknown-linux-gnu] linker = "aarch64-linux-gnu-gcc" + +[target.aarch64-linux-android] +linker = "aarch64-linux-android29-clang" diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 793c71efa..966ca0e26 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -72,6 +72,11 @@ jobs: artifact_name: linux-arm64-cpu whl_local_version: cpu use_cuda: false + - os: ubuntu-20.04 + features: "" + target: aarch64-linux-android + artifact_name: linux-arm64-cpu + use_cuda: false - os: macos-11 features: "" target: aarch64-apple-darwin @@ -88,6 +93,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Set up Python 3.8 + if: matrix.whl_local_version uses: actions/setup-python@v4 with: python-version: "3.8" @@ -102,6 +108,16 @@ jobs: run: | sudo apt update sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu + - uses: nttld/setup-ndk@v1 + if: matrix.target == 'aarch64-linux-android' + with: + ndk-version: r25b + - name: Set path for android + if: matrix.target == 'aarch64-linux-android' + shell: bash + run: | + echo "$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin" >> "$GITHUB_PATH" + echo "AR_aarch64_linux_android=llvm-ar" >> "$GITHUB_ENV" - name: Install cargo-binstall uses: taiki-e/install-action@cargo-binstall - name: Install cbindgen @@ -115,7 +131,7 @@ jobs: shell: bash run: | cargo set-version "$VERSION" --exclude voicevox_core_python_api --exclude download --exclude xtask - cargo set-version "$VERSION+"${{ matrix.whl_local_version }} -p voicevox_core_python_api + if ${{ matrix.whl_local_version }}; then cargo set-version "$VERSION+"${{ matrix.whl_local_version }} -p voicevox_core_python_api; fi - name: generate voicevox_core.h shell: bash run: cbindgen --crate voicevox_core_c_api -o ./voicevox_core.h @@ -124,6 +140,7 @@ jobs: env: ORT_USE_CUDA: ${{ matrix.use_cuda }} - name: build voicevox_core_python_api + if: matrix.whl_local_version id: build-voicevox-core-python-api shell: bash run: | @@ -171,7 +188,7 @@ jobs: ${{ env.ASSET_NAME }}.zip target_commitish: ${{ github.sha }} - name: Upload Python whl to Release - if: env.VERSION != 'DEBUG' && env.SKIP_UPLOADING_RELEASE_ASSET == '0' + if: env.VERSION != 'DEBUG' && env.SKIP_UPLOADING_RELEASE_ASSET == '0' && matrix.whl_local_version uses: softprops/action-gh-release@v1 with: prerelease: true diff --git a/Cargo.lock b/Cargo.lock index d8a994999..886a5df43 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2047,7 +2047,7 @@ checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" [[package]] name = "onnxruntime" version = "0.1.0" -source = "git+https://github.com/VOICEVOX/onnxruntime-rs.git?rev=405f62fb53df1b59b0e69adafbd1c28e4d5c2787#405f62fb53df1b59b0e69adafbd1c28e4d5c2787" +source = "git+https://github.com/VOICEVOX/onnxruntime-rs.git?rev=09dc0c764e6f1d5c4bdcb8a96cfc3c41789e66bc#09dc0c764e6f1d5c4bdcb8a96cfc3c41789e66bc" dependencies = [ "lazy_static", "ndarray", @@ -2059,7 +2059,7 @@ dependencies = [ [[package]] name = "onnxruntime-sys" version = "0.0.25" -source = "git+https://github.com/VOICEVOX/onnxruntime-rs.git?rev=405f62fb53df1b59b0e69adafbd1c28e4d5c2787#405f62fb53df1b59b0e69adafbd1c28e4d5c2787" +source = "git+https://github.com/VOICEVOX/onnxruntime-rs.git?rev=09dc0c764e6f1d5c4bdcb8a96cfc3c41789e66bc#09dc0c764e6f1d5c4bdcb8a96cfc3c41789e66bc" dependencies = [ "flate2", "once_cell", @@ -2077,7 +2077,7 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "open_jtalk" version = "0.1.25" -source = "git+https://github.com/VOICEVOX/open_jtalk-rs.git?rev=9edab53f0bfa877dbb37224d17fd0f3efbe32abd#9edab53f0bfa877dbb37224d17fd0f3efbe32abd" +source = "git+https://github.com/VOICEVOX/open_jtalk-rs.git?rev=aa50be1c372a4733e9b5eed79902af1d4b3f155a#aa50be1c372a4733e9b5eed79902af1d4b3f155a" dependencies = [ "open_jtalk-sys", "thiserror", @@ -2086,7 +2086,7 @@ dependencies = [ [[package]] name = "open_jtalk-sys" version = "0.16.111" -source = "git+https://github.com/VOICEVOX/open_jtalk-rs.git?rev=9edab53f0bfa877dbb37224d17fd0f3efbe32abd#9edab53f0bfa877dbb37224d17fd0f3efbe32abd" +source = "git+https://github.com/VOICEVOX/open_jtalk-rs.git?rev=aa50be1c372a4733e9b5eed79902af1d4b3f155a#aa50be1c372a4733e9b5eed79902af1d4b3f155a" dependencies = [ "bindgen", "cmake", @@ -2347,8 +2347,7 @@ dependencies = [ [[package]] name = "process_path" version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f676f11eb0b3e2ea0fbaee218fa6b806689e2297b8c8adc5bf73df465c4f6171" +source = "git+https://github.com/wesleywiser/process_path.git?rev=ff028326505f7198ce528feecead9a367a43adc4#ff028326505f7198ce528feecead9a367a43adc4" dependencies = [ "libc", "winapi", diff --git a/crates/voicevox_core/Cargo.toml b/crates/voicevox_core/Cargo.toml index 04b361885..0965f851c 100644 --- a/crates/voicevox_core/Cargo.toml +++ b/crates/voicevox_core/Cargo.toml @@ -17,13 +17,14 @@ derive-new = "0.5.9" easy-ext.workspace = true fs-err.workspace = true once_cell.workspace = true -onnxruntime = { git = "https://github.com/VOICEVOX/onnxruntime-rs.git", rev="405f62fb53df1b59b0e69adafbd1c28e4d5c2787" } -process_path = "0.1.4" +onnxruntime = { git = "https://github.com/VOICEVOX/onnxruntime-rs.git", rev="09dc0c764e6f1d5c4bdcb8a96cfc3c41789e66bc" } +# FIXME: 最新のコミットでのみAndroidのビルドが通るため +process_path = {git = "https://github.com/wesleywiser/process_path.git", rev = "ff028326505f7198ce528feecead9a367a43adc4" } serde.workspace = true serde_json.workspace = true thiserror.workspace = true tracing.workspace = true -open_jtalk = { git = "https://github.com/VOICEVOX/open_jtalk-rs.git", rev="9edab53f0bfa877dbb37224d17fd0f3efbe32abd" } +open_jtalk = { git = "https://github.com/VOICEVOX/open_jtalk-rs.git", rev="aa50be1c372a4733e9b5eed79902af1d4b3f155a" } regex = "1.6.0" [dev-dependencies]