-
Notifications
You must be signed in to change notification settings - Fork 143
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
Support for Apple M1 arm64/aarch64 chips #51
Comments
cc @moul @junaruga @aimxhaisse @lafin @QuentinPerez Hello! Has there been any progress on this? |
Sorry I do not know any progress. |
@Willena Could you try to open a pull request? |
I suspect that currently only
|
The upstream crossbuild project has added code for M1 ARM (64) support. |
The only issue is that to target arm64e ( M1 chips if I'm correct ) we still need to build the llvm-compiler from scratch (not very difficult, but requires a lot of computing resources and it is a quite long process). |
Confirmed, building the Apple Clang compiler is able to generate arm64[e] toolchains for osxcross. This is documented in the osxcross README. https://github.com/tpoechtrager/osxcross#what-is-the-goal-of-osxcross Example compilation of Apple Clang on Ubuntu: https://github.com/mcandre/apple-clang/blob/master/Dockerfile |
My use case was to build a universal2 binary on x86_64. I was able to get it working by doing the following:
I can make a PR if you want, but I don't know where that original SDK came from (dropbox?). Perhaps we can add a copy step to the Dockerfile. Also it may become necessary to do more creative tagging as mentioned in #48 as to support more diverse sets of build environments:
|
@yuzawa-san I believe the newer cmake can typically be installed via python, eg. |
I'm trying to make this work without Anyone managed to do that ? I can compile our library, and it seems to be recognized as arm64, but when i try to use it the process crash without much information. I'm probably doing something wrong. |
Turns out it was a signature problem, as M1 macs always check the signature. You need at least the adhoc signature for a binary to run. |
@gotson that all sounds quite promising, nice job figuring out the couple of extra steps! So are you able to build a binary using a docker built from your fork/commit referenced above? That ad-hoc signing, can that be done with the tools in the docker too? |
@andrewleech yes so far it works, i still need to do a couple of checks to make sure everything is fine before merging this to the master branch. We are building a dynamic library for multiple platforms, and after some digging i found out a few things:
While checking the issues for M1 mac in the osxcross repo, i stumbled upon this: tpoechtrager/osxcross#355 (comment) Given I use a fork of crossbuild following the super helpful comments of @yuzawa-san above. It seems another tool ( |
Thanks for those details! I can see from the osxcross issues some more details about sigtool:
I'm guessing I could also just skip |
Not an option for us, we ship the library in the jar, and every kb counts! Stripping saves around 100-200kb. Note that |
any update on this? |
I've been using this docker container to cross-compile some libraries for Mac OS for quite a long time. It works great !
After a quick look to the content of the container, it seems that it contains some of the things needed to build for aarch64 / Apple M1 processor.
Adding a new CROSS_TRIPLE case and setting
-arch arm64
with an arm64 compatible GCC could do the work.I don't know how difficult it would be to implement this new processor. Correct me if I'm wrong.
The text was updated successfully, but these errors were encountered: