From 4bfd2e35953c50c16f89117e7c2d0f27719f3b20 Mon Sep 17 00:00:00 2001 From: thewh1teagle <61390950+thewh1teagle@users.noreply.github.com> Date: Sun, 8 Dec 2024 20:22:55 +0200 Subject: [PATCH 1/6] setup riscv --- .github/workflows/publish-libaec.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/publish-libaec.yml b/.github/workflows/publish-libaec.yml index 9c4b933..31b9974 100644 --- a/.github/workflows/publish-libaec.yml +++ b/.github/workflows/publish-libaec.yml @@ -40,6 +40,12 @@ jobs: archive: "tar" target: "x86_64-unknown-linux-gnu" + - platform: "ubuntu-22.04" # riscv64 + args: "--target riscv64gc-unknown-linux-gnu" + build-dir: "libaec-riscv64gc-unknown-linux-gnu" + archive: "tar" + target: "riscv64gc-unknown-linux-gnu" + - platform: "macos-latest" # Linux arm64 args: "" build-dir: "libaec-android-aarch64" @@ -81,6 +87,12 @@ jobs: echo "CXX=aarch64-linux-gnu-g++" >> $GITHUB_ENV if: matrix.target == 'aarch64-unknown-linux-gnu' + - name: Install riscv64 toolchain + run: | + sudo apt update + sudo apt install gcc-riscv64-linux-gnu g++-riscv64-linux-gnu libc6-dev-riscv64-cross + if: matrix.target == 'riscv64gc-unknown-linux-gnu' + - name: Setup Android NDK uses: nttld/setup-ndk@v1 id: setup-ndk From 32d5e3b9f09da37761ddadf51dc04802f41677e4 Mon Sep 17 00:00:00 2001 From: thewh1teagle <61390950+thewh1teagle@users.noreply.github.com> Date: Sun, 8 Dec 2024 20:23:50 +0200 Subject: [PATCH 2/6] misc --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8516375..de35f8e 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Acoustic echo cancellation in Rust based on [speexdsp](https://github.com/xiph/s - 🦀 Rust and 🐍 Python support - 🔗 Easy integration with C/C++ (or any other language) via C API - 📦 Precompiled library and C header files available in the [releases](https://github.com/thewh1teagle/aec-rs/releases/latest) -- 🖥️ Support for Windows (x86/arm64), Linux (x86/arm64), macOS (x86/arm64), Android (arm64), IOS (arm64), and WASM! +- 🖥️ Support for Windows (x86/arm64), Linux (x86/arm64), macOS (x86/arm64), Android (arm64), IOS (arm64), WASM, and Riscv64! - 🖥️ Run on Raspberry PI as well # Install From d75fae403f77435c17a1e8378128d378886702f2 Mon Sep 17 00:00:00 2001 From: thewh1teagle <61390950+thewh1teagle@users.noreply.github.com> Date: Sun, 8 Dec 2024 20:26:40 +0200 Subject: [PATCH 3/6] try to fix --- crates/aec-rs-sys/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/aec-rs-sys/build.rs b/crates/aec-rs-sys/build.rs index 54ca3f6..2e3f92c 100644 --- a/crates/aec-rs-sys/build.rs +++ b/crates/aec-rs-sys/build.rs @@ -53,7 +53,7 @@ fn main() { .clang_arg(format!("-I{}", lib_dst.display())) // Explicitly set target in case we are cross-compiling. // See https://github.com/rust-lang/rust-bindgen/issues/1780 for context. - .clang_arg(format!("--target={}", clang_target)) + // .clang_arg(format!("--target={}", clang_target)) .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) .generate() .expect("Failed to generate bindings"); From 46d3b765f7ef6a1fc8d6d9a3d36ab8fcbe7fe3e4 Mon Sep 17 00:00:00 2001 From: thewh1teagle <61390950+thewh1teagle@users.noreply.github.com> Date: Sun, 8 Dec 2024 20:29:54 +0200 Subject: [PATCH 4/6] try to fix --- crates/aec-rs-sys/build.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/aec-rs-sys/build.rs b/crates/aec-rs-sys/build.rs index 2e3f92c..9d5b590 100644 --- a/crates/aec-rs-sys/build.rs +++ b/crates/aec-rs-sys/build.rs @@ -41,6 +41,10 @@ fn main() { if target.contains("android") { clang_target = "armv8-linux-androideabi".to_string(); } + if target.contains("riscv64gc-unknown-linux-gnu") { + // https://github.com/rust-lang/rust-bindgen/issues/2136 + clang_target = "riscv64-unknown-linux-gnu".to_string(); + } let mut bindings = bindgen::Builder::default().header("wrapper.h"); @@ -53,7 +57,7 @@ fn main() { .clang_arg(format!("-I{}", lib_dst.display())) // Explicitly set target in case we are cross-compiling. // See https://github.com/rust-lang/rust-bindgen/issues/1780 for context. - // .clang_arg(format!("--target={}", clang_target)) + .clang_arg(format!("--target={}", clang_target)) .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) .generate() .expect("Failed to generate bindings"); From fc4c09ec051efc3d157d58c1460c4f607dfe9de6 Mon Sep 17 00:00:00 2001 From: thewh1teagle <61390950+thewh1teagle@users.noreply.github.com> Date: Sun, 8 Dec 2024 20:31:54 +0200 Subject: [PATCH 5/6] try to fix --- .github/workflows/publish-libaec.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-libaec.yml b/.github/workflows/publish-libaec.yml index 31b9974..805f31b 100644 --- a/.github/workflows/publish-libaec.yml +++ b/.github/workflows/publish-libaec.yml @@ -41,7 +41,7 @@ jobs: target: "x86_64-unknown-linux-gnu" - platform: "ubuntu-22.04" # riscv64 - args: "--target riscv64gc-unknown-linux-gnu" + args: "--target riscv64gc-unknown-linux-gnu RUSTFLAGS='-C linker=riscv64-linux-gnu-gcc'" build-dir: "libaec-riscv64gc-unknown-linux-gnu" archive: "tar" target: "riscv64gc-unknown-linux-gnu" From 6d2d73d32b681c598d141e3ccb3dccc0c7e44b06 Mon Sep 17 00:00:00 2001 From: thewh1teagle <61390950+thewh1teagle@users.noreply.github.com> Date: Sun, 8 Dec 2024 20:34:07 +0200 Subject: [PATCH 6/6] try fix riscv --- .github/workflows/publish-libaec.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-libaec.yml b/.github/workflows/publish-libaec.yml index 805f31b..25ad784 100644 --- a/.github/workflows/publish-libaec.yml +++ b/.github/workflows/publish-libaec.yml @@ -41,7 +41,7 @@ jobs: target: "x86_64-unknown-linux-gnu" - platform: "ubuntu-22.04" # riscv64 - args: "--target riscv64gc-unknown-linux-gnu RUSTFLAGS='-C linker=riscv64-linux-gnu-gcc'" + args: "--target riscv64gc-unknown-linux-gnu" build-dir: "libaec-riscv64gc-unknown-linux-gnu" archive: "tar" target: "riscv64gc-unknown-linux-gnu" @@ -91,6 +91,7 @@ jobs: run: | sudo apt update sudo apt install gcc-riscv64-linux-gnu g++-riscv64-linux-gnu libc6-dev-riscv64-cross + echo "RUSTFLAGS=-C linker=riscv64-linux-gnu-gcc" >> $GITHUB_ENV if: matrix.target == 'riscv64gc-unknown-linux-gnu' - name: Setup Android NDK