wasmtime-java icon indicating copy to clipboard operation
wasmtime-java copied to clipboard

Include aarch64-apple-darwin builds of libwasmtime_jni

Open dakota-doordash opened this issue 2 years ago • 8 comments

Currently, only x86_64 darwin builds of libwasmtime_jni are included in the package. This causes issues on M1 Macs in which the library needs to be manually built for aarch64 darwin. Could aarch64 darwin builds also be included?

dakota-doordash avatar Jun 22 '22 20:06 dakota-doordash

It's not easy for now as github actions doesn't provide M1 mac as an execution environment. We might be able to cross-build a shared library for aarch64 without any tests executed, but as far as I tried the build now fails due to the compilation errors from the stage building C library for zstd-sys which is transitively dependent by wasmtime crate. (cargo build --target aarch64-apple-darwin)

So for now, there's no easy way to build a shared library for aarch64-apple-darwin on github actions.

kawamuray avatar Jun 24 '22 11:06 kawamuray

@kawamuray is there any workaround?

syedfaizanalef avatar Aug 27 '22 08:08 syedfaizanalef

@syedfaizanalef The situation remain the same. Github actions still does not support aarch64 mac, and compiling for the aarch64-apple-drawin on an intel mac fails by zstd-sys, even with latest dependency versions.

The workaround is to build this project (precisely, wasmtime-jni subproject. Just run cargo build --release) on an apple silicon mac by yourself, and use a built shared object (by -Djava.library.path) instead of those shipped with the official jar.

kawamuray avatar Sep 07 '22 03:09 kawamuray

Is it possible to use something like this to build on more architectures? https://github.com/marketplace/actions/run-on-architecture

Also, this Mozilla Gradle plugin makes it easier to build for Android: https://github.com/mozilla/rust-android-gradle

krisbitney avatar Mar 17 '23 03:03 krisbitney

Is it possible to use something like this to build on more architectures? https://github.com/marketplace/actions/run-on-architecture

Looks like an option, but it seems that we need to write entire build process as shell script, requiring some effort as in currently the ci.yml is written with leveraging a lot of actions.

kawamuray avatar Mar 17 '23 11:03 kawamuray

When i get time, i will look at it and see if i can update the build script to build to work seamlessly with arm architectures

krisbitney avatar Mar 20 '23 20:03 krisbitney

I haven't tried it yet, but this sounds promising:

https://actually.fyi/posts/zig-makes-rust-cross-compilation-just-work/

krisbitney avatar Mar 22 '23 15:03 krisbitney

I am also interested in this subject since I am using M1 for development but need to use this library for other OS and platforms.

What I have tried and found out is that we can still use ubuntu-22.04 and macos-12 to build for targets such as aarch64-unknown-linux-gnu and aarch64-apple-darwin, respectively.

The other tool I also looked at is cross.

cch0 avatar Jun 22 '23 19:06 cch0