Repository navigation
build: ship a linux-arm64 prebuild - #217
Open
crazy159-ai wants to merge 2 commits into
Open
crazy159-ai wants to merge 2 commits into
crazy159-ai wants to merge 2 commits into
Conversation
linux-arm64 was the only platform with an x64 prebuild but no arm64 counterpart. Without one, node-gyp-build falls back to compiling from source on arm64 Linux, and because the install script is `node-gyp-build || exit 0`, a failed fallback installs a package that only throws when it is required. Build it with the linux-arm64-lts image so the prebuild keeps a glibc 2.27 floor, for the same reason x64 uses centos7-devtoolset7. Co-Authored-By: Claude Code <noreply@anthropic.com>
ubuntu-latest now resolves to Ubuntu 26.04, whose Docker daemon rejects the API version prebuildify-cross pins (v1.24). `make build-addon-linux` therefore fails before it pulls an image: /v1.24/version -> non-200 on ubuntu-latest, 200 on ubuntu-24.04 The same failure happens on unmodified master, so it is unrelated to the arm64 change, but it stops this PR from being verified. Pinning matches the existing windows-2022 pin. Co-Authored-By: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
prebuilds/ships three platforms:darwin-arm64is there becausemacos-latestis an arm64 runner.linux-arm64is not, because every Linux prebuild comes from
prebuildify-cross, which onlytargets the two images in the Makefile.
On an arm64 Linux host (Graviton, Ampere, arm64 build agents)
node-gyp-buildfinds no match and falls back to
node-gyp rebuild. That works when a C++toolchain is present, which is not the case for most deployment images — the
node:*-slimandnode:*-alpineimages ship no python3, make or g++.The install script is
so a failed fallback build is swallowed.
npm installreports success and thefirst
require('secp256k1')throwsNo native build was found for platform=linux arch=arm64. (utf-8-validate, samenode-gyp-buildsetup, usesthe bare command and fails at install time instead.)
What this changes
Two lines, plus a one-line CI pin explained at the end:
mv darwin-arm64 prebuilds mv linux-x64 prebuilds + mv linux-arm64 prebuilds mv win32-x64 prebuildsprebuildify-crossturnslinux-arm64-ltsintoghcr.io/prebuild/linux-arm64-lts:2, and running the existing recipe onubuntu-latestnow emitsprebuilds/linux-arm64/secp256k1.armv8.nodealongside the x64 outputs.
node-gyp-buildresolves it because it parses thearmv8tag againstprocess.arch === 'arm64'.Why
linux-arm64-ltsand notlinux-arm64The
-ltsimage pins glibc 2.27, for the same reason the x64 build usescentos7-devtoolset7instead of a current distro. The plainlinux-arm64imageuses whatever glibc dockcross currently ships, so the binary would refuse to
load on older arm64 targets — exactly the class of problem documented in
websockets/bufferutil#150, which is why that project stopped shipping ARMbinaries altogether.
I did consider building natively on a GitHub arm64 runner instead. It avoids
cross-compilation, but
ubuntu-24.04-armis glibc 2.39 with GCC 13, so theresulting prebuild would require a newer glibc than most arm64 targets have.
Cross-compiling against an old glibc is the smaller risk.
Known limitation
Alpine arm64 is unchanged: it still compiles from source. It cannot be added
here without more work, because
prebuildify-crosstagslinux-arm64*imageswith
--tag-armvonly, solinux-arm64-ltsandlinux-arm64-muslwould bothemit
secp256k1.armv8.nodeand overwrite each other. Fixing that needs either a--tag-libc-aware arm64 image upstream or a rename step after the build. Happyto follow up separately; this PR is strictly better than the current zero arm64
prebuilds.
Test plan
make test-tapstep runs on every build job and loads theprebuild through
bindings, so a broken arm64 binary fails CI.npm install secp256k1on an arm64 Linux host should show nogypoutput.Open question
Should the install script stay
node-gyp-build || exit 0? With a prebuild inplace it matters less, but on a platform that still has no prebuild and no
toolchain, the package installs successfully and then throws at require time.
Removing
|| exit 0turns that into an install-time error. Happy to put that ina second commit if you want it.
Note on CI
ubuntu-latestnow resolves to Ubuntu 26.04, whose Docker daemon rejects theAPI version
prebuildify-crosspins (v1.24), somake build-addon-linuxfails before it pulls an image. That is unrelated to the arm64 change — it
fails identically on unmodified
master(control run)
— but it stops this PR from being verified at all.
The second commit pins the Linux job to
ubuntu-24.04(Docker 28.0.4),matching the existing
windows-2022pin. The evidence that the pinned APIversion is the cause: asking the daemon for
/v1.24/versionreturns 200 onubuntu-24.04and non-200 onubuntu-latest(probe).
Drop that commit if you would rather handle CI separately. With it, the Linux
job builds the new
prebuilds/linux-arm64and thepackagejob succeeds —which it can only do if
mv linux-arm64 prebuildsfinds the directory.🤖 Generated with Claude Code