nodejs / unofficial-builds

Unofficial binaries for Node.js
https://unofficial-builds.nodejs.org
247 stars 52 forks source link

Added arm64-musl build #105

Closed alex closed 8 months ago

alex commented 8 months ago

I'm not especially confident this will work -- I didn't see obvious instructions for how to test this build locally (apologies if I missed them!).

rvagg commented 8 months ago

Hi @alex, would you mind taking a look at https://github.com/nodejs/unofficial-builds/pull/108 and rebasing on that branch and then trying to run this locally to see if you can get the binary that you want. Ideally this should be run from a Linux x64 machine because that's how we deploy it, but that shouldn't be strictly necessary I think.

alex commented 8 months ago

I almost left a comment asking if there were instructions on running it locally. Then I read your PR :-) Thanks! Will rebase + test with that, probably not until Friday though. Cheers!

alex commented 8 months ago

Well, I've now got the docker image building, however in attempting to run the full local build it seems to be hanging while downloading the gpg keys for the source tarball:

ubuntu@ip-172-26-14-252:~/node-unofficial-builds$ ./bin/local_build.sh -r arm64-musl -v v21.0.0
[...]
Downloading source tarball...
+ set -e
+ release_urlbase=https://unofficial-builds.nodejs.org/download/release/
+ disttype=release
+ customtag=
+ datestring=
+ commit=
+ fullversion=v21.0.0
+ source_url=https://nodejs.org/download/release/v21.0.0/node-v21.0.0.tar.xz
+ config_flags=
+ cd /home/node
++ curl -sL https://raw.githubusercontent.com/nodejs/docker-node/HEAD/keys/node.keys
+ gpg_keys='4ED778F539E3634C779C87C6D7062848A1AB005C
141F07595B7B3FFE74309A937405533BE57C7D57
74F12602B6F1C4E913FAA37AD3A89613643B6201
DD792F5973C6DE52C432CBDAC77ABFA00DDBF2B7
61FC681DFB92A079F1685E77973F295594EC4689
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8
890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4
C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C
108F52B48DB57BB0CC439B2997B01419BD92F80A
A363A499291CBBC940DD62E41F10027AF002F8B0'
+ for key in ${gpg_keys}
+ gpg --list-keys 4ED778F539E3634C779C87C6D7062848A1AB005C
alex commented 8 months ago

I think the issue is that https://github.com/nodejs/unofficial-builds/blob/main/recipes/fetch-source/Dockerfile#L17 sets up a bunch of stuff with a uid of root (including maybe a lock file), and then https://github.com/nodejs/unofficial-builds/blob/main/recipes/fetch-source/run.sh#L19 tries to modify it as uid=1000, and is unable to and thus hangs. (It may be hanging while trying to grab the lock)

Do we need to download the gpg keys twice, or is it enough that maybe we could just download them in the dockerfile and not in the run.sh?

alex commented 8 months ago

Submitted https://github.com/nodejs/unofficial-builds/pull/109 to deal with that.

alex commented 8 months ago

having bypassed that, I'm now seeing other permission errors, specifically running run.sh:

Building arm64-musl recipe...
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/home/node/run.sh": permission denied: unknown.

Is there anything required to run this? I'm taking a very vanilla ubuntu 22.04 with docker and git and not much else and hitting these.

nschonni commented 8 months ago

One guess is that it's missing the commit-bit, which can be fixed with git update-index --chmod=+x recipes/arm64-musl/run.sh

alex commented 8 months ago

😱. Thank you! Not sure how I missed that.

alex commented 8 months ago

Got as far as:

../deps/openssl/openssl/crypto/arm_arch.h:55:6: error: "unsupported ARM architecture"
#    error "unsupported ARM architecture"

going to put this down for a day, clear to my head.

rvagg commented 8 months ago

btw, what are the target distros for this build? I suppose Alpine is doing arm64 builds these days, are there other popular musl arm64 targets?

alex commented 8 months ago

I'm principally interested in alpine, due to its popularity. I believe Void Linux also uses musl and supports arm64.

This is getting closer, but I'm now hitting issues with the cross-compiler being a too-old version of g++.

alex commented 8 months ago

I've hit some obstacles I've been unable to resolve in terms of getting a clean cross-compiling compiler. I'm not going to have time for this for a while, so I'm going to close for now. Perhaps someone else will succeed where I ran out of time :-(