nodejs / unofficial-builds

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

Add arm64-glibc-217 recipe #83

Closed watson closed 6 months ago

watson commented 1 year ago

Create a copy of the x64-glibc-217 recipe (introduced in PR #69) targeting arm64 instead of x64.

I tried to build the Docker image on a ARM CPU running on GCP and it compiled without any issues, so as far as I can see this should work

rvagg commented 1 year ago

have you been able to (roughly) test this in some form to verify that it ~builds?

watson commented 1 year ago

@rvagg as I also just added to the PR description, I tried to build the Docker image on a ARM CPU running on GCP and it compiled without any issues, so as far as I can see this should work. I also ran the resulting node binary and entered the REPL. So the initial testing was ok.

Obviously I've not been able to test on the hardware that the Node.js build group uses, so I'm not sure if my usage of arm64 as the architecture is going to work for that setup. But I think it should. If you like I can do some more testing of the resulting binary, or if you're comfortable that as long as it's able to run the REPL then we can just say that's ok?

watson commented 1 year ago

Btw, when building Node.js, I'm getting the warning switch ‘-msign-return-address=all’ is no longer supported, which has also been reported here: https://github.com/nodejs/build/issues/3319

As far as I understand, this is a general "issue" that also affects the official builds, and hence shouldn't be something to worry about for this specific PR

rvagg commented 1 year ago

Since we're building this on an x64 machine, I suspect we might need some arm64 arch libraries in the toolchain dependencies for this? I imagine those come automatically if you're running arm native. Unfortunately someone's going to have to try and either deploy this, test and be prepared to roll it back, or confirm on an x64 machine that it work as is.

watson commented 1 year ago

Ah ok, I actually thought that it was running on ARM hardware based on what I saw in the nodejs/build repo. But I guess it's different for the unofficial builds of course. I'm pretty sure this PR will not compile on x64 hardware as it is right now. But it should be possible to update it to cross compile - however that will increase the compile time quite significantly I assume. But I guess you have the same issue for the other non x64/x84 recipes in this repo.

I'll see what I can do to update this PR accordingly.

csuich2 commented 1 year ago

We've got an internal repo based on the x64-glibc-217 recipe and I attempted to add arm64 support in a similar fashion as this PR. The changes are nearly identical but when attempting to build on our x64 GHA workers we get:

   CC(target) /home/node/node-v18.0.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/core_algorithm.o
In file included from ../deps/openssl/openssl/crypto/armcap.c:21:
../deps/openssl/openssl/crypto/arm_arch.h:55:6: error: #error "unsupported ARM architecture"
 #    error "unsupported ARM architecture"
      ^~~~~
make[2]: *** [/home/node/node-v18.0.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/armcap.o] Error 1

Just as @rvagg suspected it seems like some additional libs are needed to build on x64. I tried adding gcc-arm-linux-gnu gcc-c++-arm-linux-gnu to the list of yum installed packages to no avail.

theofficialgman commented 1 year ago

this PR doesn't work in the slightest. you don't even set the cross compilers see https://github.com/nodejs/unofficial-builds/pull/91 for a working recipe for building arm64/armhf bionic

please close this PR