Open dvic opened 3 years ago
It should work on master right now, at least theoretically, as we are using node-build
and it supports building from source. If that doesn't work please let me know and we re-open this issue
Hi, I've tried but I'm not sure how to force asdf install
to compile the musl version. Any hints?
Just installing nodejs on a distribution based on musl should work by default. Node.js already detects musl as the libc and make the correct assumptions (alpine Dockerfile for reference).
Cross-compiling from another libc on the other hand should be a bit tricky, I think the best chance is the official building docs for nodejs and the official issue tracker. You can pass building options for both configure
and make
by using node-build
options
Actually, I see the problem, node-build
is not detecting that musl dists have different binaries from glibc and is not building from source by default, is just downloading glibc binaries instead. I will try to debug it and fix it upstream
FYI: I just merged #284, which adds an option to force compilation. You can just run ASDF_NODEJS_FORCE_COMPILE=1 asdf install nodejs latest
and it will force a compilation.
I tested on an alpine container, and it works. Just be sure to install all nodejs building dependencies. Aside from what is listed on the official docs, I also needed to install the packages openssl
and linux-headers
when using the latest alpine distribution
I still gonna work on a patch upstream for supporting pre-compiled binaries, the problem was a bit more difficult than I antecipated.
Chiming in to confirm @augustobmoura's instructions worked for me on Alpine 3.11.
this ticket has been open quite awhile. is it a difficult fix?
NodeJS doesn't provide official pre-compiled binaries for alpine-musl as of yet. They do have an unofficial branch that have the binaries, but, unfortunately, it still not supported on node-build (the engine we use for installing the versions).
The only way to do it right now is by compiling from source inside the musl container/system as per https://github.com/asdf-vm/asdf-nodejs/issues/190#issuecomment-1034334159
instead of installing broken binaries, would it not be better to refuse the install with some kind of message?
instead of installing broken binaries, would it not be better to refuse the install with some kind of message?
As a maintainer with very limited time, I am prioritizing the most recurrent issues. We will get to musl pre-compiled binaries eventually. We are also open to contributions, if you think a warning would help, we would appreciate a new PR
It would be nice if we could support the
musl
build (https://github.com/nodejs/unofficial-builds#builds)