-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add prebuilds for ARM64 Macs #2354
Add prebuilds for ARM64 Macs #2354
Conversation
c255f18
to
ac3db9a
Compare
I've temporarily removed the Linux and Windows builds from the workflow in order to reduce the Actions usage on my personal account while testing. The current status here is that I'm hitting an error about |
Hi @jamesbvaughan , it looks like you are building canvas sources that have migrated from EDIT: I submitted a PR for your branch that I think may help jamesbvaughan#1 |
2fc9d9b
to
886d26b
Compare
Alright, thanks to @adamcin's help, I think this is ready for a real review! Let me know if you'd like me to clean up the git history at all. |
Thanks for submitting this! Two notes:
|
Thanks @zbjornson. I'll hold off on further work here for now. |
Is there any update in having arm64 pre-build binaries? |
@rafaelmaiolla, in my opinion still boils down to bundling the generated native module with the native dependencies. You may have a look to issue #2036 which has a bit more info on why providing pre-built binaries is difficult. Edit: I just saw that executing/loading my bundled version let to a Follow up: With regard to #2036 this is indeed a signing problem. Signing all generated/patched binaries ( |
If singing is working then would the next step be for OP to add signing to their PR? I'm sorry if I sound impatient, but a prebuilt binary could remove around 50s on our GitHub actions which is why I'm eager for there to be a prebuilt binary. |
886d26b
to
c41b736
Compare
I've rebased these changes on the prebuilds branch and removed some unnecessary changes. If the code signing truly is all that's left, then I think we're close!
@mn4367 Thanks for trying that out! Do you have any public code demonstrating the use of that code signing tool in a context like this? I haven't dealt with Apple's code signing before and if you have an example, it could save me a lot of time. |
Same here :-(. Everything I did was to run After that I'm able to run all tests successfully but I've no idea if If it doesn't work directly after unpacking you could try calling |
@mn4367 Thanks for all that. I've downloaded and unpacked your tarball and To be honest, I'm wading in unfamiliar territory here and I'm curious for @zbjornson's input on code signing. The tests pass in the |
@jamesbvaughan, I did another quick test: I created a Node.js SEA, signed it with My application:
Node.js executable:
So the only difference is that with So there are basically two questions:
If the answer to both questions is no, then If I find the time, I'll create a test repository with a pre-built, standalone Edit, PS: |
I found something interesting in the |
I had a bit of time to work on this today and found that the creator of I've added that action to the workflow in this PR and it seems to be signing successfully. @zbjornson Let me know if there's anything else I'm missing here. |
@zbjornson Is there anything blocking the release of this PR? |
Would like to know too. Just to add to the urgency, appflow will deprecated the old Mac builders and will switch to Silicon runners only at 1st of October 24. With e.g. jsdom relying on this module (which is a direct dependency of jest, isomorphic-dompurify, ...)) lots of builds will fail without this binding. What needs to be done to get this across the fnishline? |
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.
Sorry for the silence. This looks straightforward. I don't have a mac to test on, but I'm happy to merge this, make the prebuild for 3.0-rc2 and make sure it works for folks.
One tiny question...
.github/workflows/prebuild.yaml
Outdated
@@ -169,14 +174,19 @@ jobs: | |||
npm install --ignore-scripts | |||
. prebuild/macOS/preinstall.sh | |||
cp prebuild/macOS/binding.gyp binding.gyp | |||
node-gyp rebuild -j 2 | |||
node-gyp rebuild -j 2 --arch=${{ matrix.os.arch }} |
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.
node-gyp defaults to process.arch
. Is this change needed?
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.
Good question - I'm not experienced with node-gyp
and I think I copied this from someplace else without testing it without that option. I'll try it out without it today.
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.
Alright I've pushed a commit that removes that flag, and as far as I can tell, this step of the build process is completing as intended: https://github.com/jamesbvaughan/node-canvas/actions/runs/11115619922/job/30884399250#step:4:178
I should point out though that I'm wading in unfamiliar territory for me when it comes to node-gyp
and macos binary signing, so I'd really appreciate if someone with more experience with those could help verify that everything looks correct here.
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.
Alright I've pushed a commit that removes that flag, and as far as I can tell, this step of the build process is completing as intended: https://github.com/jamesbvaughan/node-canvas/actions/runs/11115619922/job/30884399250#step:4:178
I should point out though that I'm wading in unfamiliar territory for me when it comes to node-gyp
and macos binary signing, so I'd really appreciate if someone with more experience with those could help verify that everything looks correct here.
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.
Thank you! I finally have Apple Silicon so I'll give this a whirl and make any changes needed.
changes to get macos prebuild to pass on arm64 local machine Add packages to the uninstall list Restore changes in prebuild.yaml Restore changes to tarball.sh Set a temporary canvas_tag Revert temporary canvas tag Update runners Remove unnecessary changes Add a code signing step Remove explicit `--arch` argument
7c36b66
to
b0c9060
Compare
Squashed because the squashed commit doesn't have conflicts |
I haven't been able to get the ARM version to load without a @mn4367 that seems to be different from your findings, though. Do you have any other ideas why this is happening?
|
Okay, the ARM builds are working. Anyone still following this can try npm install canvas@next
|
Hi @chearon, sorry for the late reply. If the native Apple
Anyway, glad to hear that you could solve the problem! PS:
I don't think that something is messed up. With Apple Silicon, the signature is now simply an absolute requirement. |
Thanks so much for the merge, I've been eagerly waiting for this ❤️ So I do have canvas set to next but I'm still getting:
When trying to build in a github action. Am I doing anything wrong? Edit: I forgot to re-run and commit the lockfile with the latest changes 🤦🏻 |
Did you |
https://github.com/Primajin/pass-a-way/actions/runs/12260791189/job/34206257857?pr=204 |
It doesn't look like your |
True, I completely forgot to rerun it recently. Thanks I'll let you know if that fixes it 👍🏻 |
Looks like x-mas came early this year! 🎄 🎁🎁🎁 Works like a charm now, thank you so much! |
This is an updated attempt at #2245, making use of GitHub's new Apple Silicon runners.
With many Mac-based developers transitioning to Apple Silicon, this addition will have a significant impact on their cumulative
yarn/npm install
time.