Skip to content
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

Build shared library for Apple Silicon #51

Merged
merged 12 commits into from
Aug 4, 2023
Merged

Build shared library for Apple Silicon #51

merged 12 commits into from
Aug 4, 2023

Conversation

rob-odwyer
Copy link
Contributor

@rob-odwyer rob-odwyer commented Aug 2, 2023

This adds support for an aarch64 build of the shared library, and updates the NativeLibraryLoader to load it on macOS when the os.arch system property is aarch64.

Although it's pretty straightforward to build for this architecture, running the tests is a lot more complex so I've disabled them when cross-compiling for now. It looks like bytecodealliance/wasmtime uses qemu to solve this problem for some architectures, but it's not as simple as just setting a target.

build.gradle Outdated Show resolved Hide resolved
@kawamuray kawamuray self-requested a review August 3, 2023 13:25
Copy link
Owner

@kawamuray kawamuray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Left some comments.

Apple sillicon support has been strongly demanded so this would be appreciated by many :) #36

Btw I'm wondering if this issue has been fixed: #36 (comment)
Apparently it did? as in this PR already passing CI.

build.gradle Outdated Show resolved Hide resolved
.github/workflows/ci.yml Show resolved Hide resolved
@rob-odwyer
Copy link
Contributor Author

rob-odwyer commented Aug 3, 2023

Updated the build.gradle and the loading logic to use the following paths (grabbed these from a tagged build on the fork to confirm):

$ file jni-libs/*
jni-libs/libwasmtime_jni_0.17.0_linux_x86_64.so:     ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=fe48cb0c3ace952c7619e0e498399475cf0ddd98, with debug_info, not stripped
jni-libs/libwasmtime_jni_0.17.0_macos_aarch64.dylib: Mach-O 64-bit dynamically linked shared library arm64
jni-libs/libwasmtime_jni_0.17.0_macos_x86_64.dylib:  Mach-O 64-bit dynamically linked shared library x86_64
jni-libs/wasmtime_jni_0.17.0_windows_x86_64.dll:     PE32+ executable (DLL) (GUI) x86-64, for MS Windows

On #36 - I think my timing was just lucky! I didn't run into any cross-compilation issues, so it must have been fixed upstream.

Copy link
Owner

@kawamuray kawamuray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@kawamuray kawamuray merged commit d662872 into kawamuray:master Aug 4, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants