-
Notifications
You must be signed in to change notification settings - Fork 102
Support for aarch64-linux-android #419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Leojangh <[email protected]>
|
Hi! Thanks for your contribution. Unfortunately we don't accept PR for platforms that do not add support for also generating the bindings and test compiling in CI. This is to ensure we are able to keep the platform supported in the future. If you can make that improvement than I can consider to merge this PR. |
OK I'm going to improve it. |
|
An example of building Android using GitHub Actions (I have tried almost fifty times): name: Build
permissions:
contents: read
on:
push:
branch:
- master
env:
CARGO_TERM_COLOR: always
jobs:
build-android:
name: Build android
runs-on: ubuntu-latest
steps:
- name: Check rust version
run: rustup --version
- name: Checkout
uses: actions/checkout@v4
- name: Build arm64
run: |
rustup target add aarch64-linux-android
export CC_aarch64_linux_android=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang
export CXX_aarch64_linux_android=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang++
export AR_aarch64_linux_android=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=$CC_aarch64_linux_android
export CLANG_PATH=$CC_aarch64_linux_android
cargo build --target aarch64-linux-android --release -vv
env:
RUST_BACKTRACE: full
- name: Build arm32
run: |
rustup target add armv7-linux-androideabi
export CC_armv7_linux_androideabi=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi30-clang
export CXX_armv7_linux_androideabi=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi30-clang++
export AR_armv7_linux_androideabi=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=$CC_armv7_linux_androideabi
export CLANG_PATH=$CC_armv7_linux_androideabi
cargo build --target armv7-linux-androideabi --release -vv
env:
RUST_BACKTRACE: full
- name: Build x86_64
run: |
rustup target add x86_64-linux-android
export CC_x86_64_linux_android=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android30-clang
export CXX_x86_64_linux_android=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android30-clang++
export AR_x86_64_linux_android=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
export CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=$CC_x86_64_linux_android
export CLANG_PATH=$CC_x86_64_linux_android
cargo build --target x86_64-linux-android --release -vv
env:
RUST_BACKTRACE: full
- name: Build x86_32
run: |
rustup target add i686-linux-android
export CC_i686_linux_android=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android30-clang
export CXX_i686_linux_android=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android30-clang++
export AR_i686_linux_android=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
export CARGO_TARGET_I686_LINUX_ANDROID_LINKER=$CC_i686_linux_android
export CLANG_PATH=$CC_i686_linux_android
cargo build --target i686-linux-android --release -vv
env:
RUST_BACKTRACE: full
[package]
name = "example-rquickjs-android"
version = "0.1.0"
edition = "2024"
[dependencies]
rquickjs = { version = "~0.9", features = ["bindgen"] }
fn main() -> rquickjs::Result<()> {
let runtime = rquickjs::Runtime::new()?;
let context = rquickjs::Context::full(&runtime)?;
let string = context.with(|ctx| ctx.eval::<String, _>("'Hello, World!'"))?;
println!("{string}");
Ok(())
} |
|
For what is worth, this works fine for me. |
| _ => panic!("Unsupported platform"), | ||
| }; | ||
| let is_windows = env::consts::OS == "windows"; | ||
| let clang = format!("{ndk}\\toolchains\\llvm\\prebuilt\\{host_tag}\\bin\\aarch64-linux-android{min_sdk}-clang") + if is_windows { ".cmd" } else { "" }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fails on linux due to path separators
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try the ci.yml I wrote above. It doesn't need this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a custom build process with macroquad, but thanks for info, I will try replicating it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For anyone finding this through search: the way to make rquickjs work with macroquad android target is to modify the cargo-quad-apk like this:
Hi ! This change makes aarch64-linux-android available! Now it can run on Android.