-
-
Notifications
You must be signed in to change notification settings - Fork 177
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
[wip] cross-compile prebuilds #572
Conversation
using [`prebuildify-cross`](https://github.com/ahdinosaur/prebuildify-cross)
I was thinking maybe this would be a good spot for
Maybe we can get some input/feedback from @staltz or someone else building on |
package.json
Outdated
@@ -47,6 +48,13 @@ | |||
"coverage": "nyc report --reporter=text-lcov | coveralls", | |||
"rebuild": "node-gyp rebuild", | |||
"prebuild": "prebuildify -t 8.14.0 -t electron@3.0.0 --napi --strip", | |||
"prebuild:cross:android-arm": "prebuildify-cross --target android-arm", | |||
"prebuild:cross:android-arm64": "prebuildify-cross --target android-arm64", |
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.
@ahdinosaur So I guess these scripts is the main entry point for building and needs to be started somewhere, e.g. from .travis.yml
. And we should run one Travis job for each one of them we'd like to build for, with different values for --target
.
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.
Basically, since each of these scripts have a similar structure we could also do something like:
"scripts": {
"prebuildify-cross": "prebuildify-cross --target $TARGET"
}
And then set $TARGET
from within .travis.yml
. This makes it more generic and the package.json
can settle in shape. Instead it's up to the caller of npm run prebuildify-cross
to set the environment variable.
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.
yes! if it was easier, we could also make a single prebuild:cross
script that expects you to pass in --target ${TARGET}
, like npm run prebuild:cross -- --target linux-armv7
.
I've been trying to dig a little deeper into how For example, in the case of What happens if we ignore this and instead set e.g. It seems to me that it's being used at two places:
The first should be perfectly ok, it's just a path on the file system and this is good since it means we would create The second is slightly more complex since we need to dig further into what When running
I noticed some other usage of In closing, I also think we should do the same for the
To me it feels better to be able to reason about different arm versions. It also makes it more evident which arm versions a certain native addon supports. |
@ralphtheninja Perhaps we should check (on an actual ARM machine) that |
Yeah, also, if this is a must we can still name the output folder using This makes me confident we can pull this off. |
I have to back a little bit on my previous post. We still need to keep Gah this is annoying. |
Given the following (base) docker images for all arm variants (see list here https://github.com/dockcross/dockcross#cross-compilers):
Would then mean:
|
I was wondering about those |
That's a good question. No idea about the naming "convention" used here. It doesn't seem that consistent to me ;) |
Another option we have is to create our own consistency layer on top of this. One way to achieve this is to ignore the |
@ralphtheninja i just made up the behavior for |
some references to the preexisting naming schemes: Rust Platform Support, Debian Tuples these are all what are called "target triples" |
and while i'm sharing links, here's an impressive (and useful) project in Rust land: https://github.com/rust-embedded/cross. it supports pretty much every target triple using a separate Dockerfile for each target. |
i found another project that solved this problem: lovell/sharp#581, https://github.com/lovell/sharp/blob/db4df6f0b2f5e900d1ff06c36b50b726641178d1/lib/platform.js i like their approach, which i'll translate to: (changing
then
i think i prefer this because then we can keep |
for completeness, i'm proposing:
|
Now we're getting somewhere. Love the idea. Also, @lovell is the one that wrote the proposal on This PR contains a lot of goodies already. We should shake out the gems and use for documentation! |
@vweevers We're going to need a matrix in |
as proposed in Level/leveldown#572 (comment) also remove `--name`
okay, updated also happy solstice holidays to everyone! ☀️ 🌈 ❄️ 🌕 |
@ahdinosaur Just need to get EDIT: And |
A single job that builds all cross-builds might be faster, because they need to pull docker images (between 300 and 600MB each) that have a common base. So shared layers will only have to be downloaded once. |
Do we stick with |
this question has been on my mind as well. |
I kinda like that, because it means we're not changing the existing |
When are we going to start disagreeing with each other? This is too easy! 😁 |
Something to take into consideration: if we later want alpine/musl prebuilds (#388), we'll need another suffix. The open proposal at prebuild/node-gyp-build#9 uses the scheme Doesn't conflict with the arm version suffix, so just FYI. |
by the way, when i said "so far i've only tested well i'm happy to report that using |
I'll take a stab at a PR for What tasks are left here? Besides the travis setup, which we can do in a separate PR. |
Hello, the proposal to use Node's existing I notice the internals of sharp were mentioned, which currently converts I suspect there will be separate versions of Node targetting ARMv8 vs ARMv8.3 so the approach being discussed here is future-proof too. If you've not already seen them, and should anyone find them useful, the Docker containers used by sharp/libvips for ARM cross-compilation are at https://github.com/lovell/sharp-libvips |
@ralphtheninja Can we close this in favor of #584? |
Yep. |
hi! 😺
here is a pull request using
prebuildify-cross
to cross-compile prebuilds.reference: #360
depends on
so far i've only tested
linux-armv7
, as my internet is slow at the moment and downloading the docker images takes a while.also,
prebuildify
doesn't distinguish between versions of arm, so buildinglinux-armv6
andlinux-armv7
will both build intoprebuilds/linux-arm
. i'm not sure if building for another platform (e.g.android
) works yet.