-
Notifications
You must be signed in to change notification settings - Fork 17
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 fat binary for arm64 and x86_64 on MacOS in build.sbt #12
Conversation
Rather than providing platform specific binaries, we can just make a fat binary with x86_64 and arm64. This is done by separately compiling the library for both architectures on osx into the target directory and then combining them using the lipo tool into a fat binary in the resource directory. Using a fat binary simplifies the logic for loading the native library. In the future we could easily ship separate versions of the x86 and arm64 binaries. To do this, we would get rid of the buildDarwin task and have buildDarwinX86_64 and buildDarwinArm64 write directly into an appropriate resource directory.
By refactoring the the build slightly, we can use automatic Def.taskIf and avoid lint warnings that occurred due to the definition of keys that were only used in the dynamic task implementation.
We need a new osx image on appveyor that xcode 12 support to build the apple fat binary in ci. Github actions has such an image, but I'm not sure that we have an sbt version that would work on that image yet.
Hi @eatkins and @eed3si9n, I'm trying to make mill work with Apple's arm64 and we have a dependency on this lib.
I was wondering if by any chance you had any hints? Are we supposed to change our usage of the lib to take advantage of this change? |
I don't think there's JNA for ARM Macs. |
There is a JNI implementation that targets arm64 on osx but you have to change your code to optionally use it. JNI isn't supported on all platforms so you will probably have to handle the logic for platform detection yourself.
|
Are you talking about the ipcsocket/src/main/java/org/scalasbt/ipcsocket/UnixDomainServerSocket.java Lines 86 to 87 in d5e67af
|
Ah I see, you mean I need to pass JNI
It's like if the |
You also need to set the JNI parameter when constructing the |
This PR reworks #11 so that we build a fat binary for osx that includes both arm64 and x86_64 code. It also adds the logic to the build.sbt to build the multi-arch version so that we can easily create new binaries in the future.