-
Notifications
You must be signed in to change notification settings - Fork 73
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
(xcode) feat: --cross-compiling overrides arch-specific settings #78
Conversation
(view whitespace changes off btw https://github.com/nodejs/gyp-next/pull/78/files?diff=unified&w=1) |
@rvagg sorry for being a pendant, but for the parser to pick up this change for a release, you'll want to go with:
When you land 👍 |
a910a9f
to
4287a42
Compare
pointer appreciated, have amended and force pushed, thanks @bcoe |
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.
LGTM
Can we validate this doesn't break existing X-compilatiom of native add-ons as that currently works. If no one gets to it I can test it later this week. Also unclear to me how X-compilation of native add-ons works but doesn't for node itself, they both use the same gyp-next toolchain right? |
This will be great.
Yeap. But gyp-next in node only responsible for build Node.js itself. |
For cross compiling on macos? Or in general? Currently the only cross that should be supported on macos (using the xcode path) is i386. But if you're successfully cross compiling anything else on macos then that'd be interesting to hear about! Perhaps I've missed something. |
@MarshallOfSound ping. |
@MarshallOfSound friendly ping again. |
Ah sorry folks, this got drowned out in my other GH notifications.
We X-compile arm64 from x64 at the moment using the xcode path. Gave this a quick test going both arm64 from x64 and arm64 via Rosetta on an M1 and it doesn't look like it messes with that so LGTM 👍 |
Thanks for the test :) |
TL;DR this commit broke compilation of nodejs-mobile for iOS from an x64 macBook. See PR nodejs-mobile/nodejs-mobile#9 (I'm not sure if it's good practice to comment on old PRs, so feel free to tell me to move this discussion elsewhere.) I maintain nodejs-mobile lately, and I'm updating our fork from Node 12.x to Node 16.x. Since we're compiling node.js for iOS, we want the Maybe a solution would be to patch this gyp-next script to detect whether we're running in arm64 darwin (such checks are common throughout the codebase, I've noticed) and then use the new logic. Else, use the old logic. What do you think? |
Continuing from nodejs/build#2474 (comment)
GYP_CROSSCOMPILE isn't used in the Xcode path at all, so this shouldn't conflict with anything afaik. This feels like a bit of a hack but elegance is beyond me for this. The problem we have is that
-arch X
is provided to all compile commands viaCFLAGS_Release
and friends, regardless of host or target, and you can't override it by any other means, even if you can sneak in extra args viaCC.target
,CC.host
and friends.I think this wouldn't be a problem if we didn't need the built-time tooling to be runnable on the host arch. So even though there's logic in there for "iphone" etc., those assume a single compile target, not the intermediate host compile for build-time tooling. I think. But maybe you folks can have a bit of a look to see if there's a more elegant way or something I'm overlooking here?