-
Notifications
You must be signed in to change notification settings - Fork 12
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
Try to make a build that works for M1 Macs #9
Conversation
the https://developer.apple.com/documentation/xcode/building_a_universal_macos_binary#3618377 |
.github/workflows/release.yml
Outdated
@@ -58,6 +58,13 @@ jobs: | |||
|
|||
- run: nimble build -d:danger -d:release --opt:speed -Y | |||
|
|||
- run: | | |||
mv native_main.py native_main-x86.py | |||
nimble build -d:danger -d:release --opt:speed -Y --cpu:arm64 -o:native_main-arm64.py |
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.
the -o:
option doesn't seem to be able to override the project.
|
M1 support in nim is recent, see nim-lang/Nim#16211 |
Thanks for the heads up. I'd be happy to volunteer Tridactyl users as guinea pigs but:
So I think it is safe to say we have approximately zero M1 users. On the other hand shipping a totally broken M1 binary would be a good way of testing that theory ; ) Thanks for your work on Nim, by the way. It's been a pleasure to write in. |
Nim 1.4.8 has already added supports for M1 Macs. |
Thanks for the heads up! I think we just need to check the output filenames, the install scripts and maybe bump the version of Nim used in the runners, then it should just work. |
Wondering if there is any progress here? You have at least 1 M1 user 😉 |
I'll try to remember to do what I said I would in the comment above and then should have some binaries for you to test If I forget please poke me :) |
Would be happy to be a guinea pig for this :) tridactyl/tridactyl#4298 (comment) |
Weekly reminder to merge this :) |
Need to investigate further when I get a chance, for some reason |
nim-lang/Nim#21142 includes fixes for "ucpu fix-up for arm64 value on macos m1" Would it help? You can try it with https://github.com/nim-lang/nightlies/releases/tag/latest-devel |
Thanks for the suggestion. It doesn't seem to have made a difference :( |
Sorry, probably you need to follow https://summarity.com/nim-2-m1 task release_clang, "Build a production release (macOS)":
--verbose
--forceBuild:on
--cc:clang
--define:release
--deepcopy:on
--cpu:arm64
--passC:"-flto -target arm64-apple-macos11"
--passL:"-flto -target arm64-apple-macos11"
--hints:off
--outdir:"."
setCommand "c", "hello.nim"
|
Thanks! That seems like a pain to debug without access to a MacOS machine - with each change I have to push the code and then wait ~10 minutes for the CI to pass/fail. If someone could get it working locally first that would be a great help (or post me an M1/M2 machine ;) ) |
Steps to reproduce for anyone who wants to help on an x86 macOS machine: # clone the repo
nimble build -d:danger -d:release --opt:speed -Y # make an x86 binary
mv native_main native_main-x86
nimble build -d:danger -d:release --opt:speed -Y --cpu:arm64 # this is the line that needs fixing - it still makes an x86 binary
mv native_main native_main-arm64
lipo -create -output native_main native_main-x86 native_main-arm64 # this line errors because it realises both binaries are x86 |
246d0a4
to
109f06e
Compare
We're telling |
Hi, I tried to run My M1 machine OS is macOS 13.4 and Intel one is macOS 12.6.6. Nim versions on them are same, 1.6.12, installed by Homebrew. Here is the Intel Mac Nim version output
First, as far as I tested the command below,
it built a machine's native architecture binary. It means that it made x86_64 binary on Intel Mac while it made arm64 binary on M1 Mac Next, I tested the command
but As To build x86_64 binary
To build arm64 binary
To run these commands in a terminal, When a binary was made, its architecture could be checked like
The universal binary could be made like
I tested the built universal binary on both M1 and Intel Mac and confirmed it worked properly Hope this will help at making an auto build with GitHub |
That seems to work! @tatsushid could you check that the built binary works? https://github.com/tridactyl/native_messenger/suites/13576524430/artifacts/747719133 Thanks so much for your help :) |
I tested it but it seems to only include x86_64 binary. Here is the result
From the action log, this seems to be caused by the line 58 in |
Sorry, that was a silly bug, @tatsushid I think the latest artifact - https://github.com/tridactyl/native_messenger/suites/13659414315/artifacts/754327926 - should be a real universal binary. Promisingly, it's twice the size of the other ones :) Could you check for me? Thanks again for all your help with this. |
Hi, I downloaded the file and tested it. Yes, it worked! Thank you for all the fixes! Here is the my terminal output
|
Many thanks to all who helped - timotheecour, ringabout, tatsushid :)
@tatsushid could you check the release build too, just in case? https://github.com/tridactyl/native_messenger/releases/download/0.4.0/native_main-macOS The file size is much smaller. Probably due to the lack of debug symbols but it's still worth checking... |
Hi, I tested the release build on M1 Mac by running
Then I ran
so the latest binary looks working I also checked the checksums of the automatically downloaded file and your link one. Both checksums were same so everything should be OK |
Forgot to post the binary detail
It is a proper universal binary |
Marvellous, thank you so much! |
Let's see if this compiles.
Then we'll need to find a guinea pig.
Fixes #2.