asdf-nodejs icon indicating copy to clipboard operation
asdf-nodejs copied to clipboard

Proposal: support linux-x64-musl

Open dvic opened this issue 3 years ago • 10 comments

It would be nice if we could support the musl build (https://github.com/nodejs/unofficial-builds#builds)

dvic avatar Jan 07 '21 02:01 dvic

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

augustobmoura avatar Dec 20 '21 16:12 augustobmoura

Hi, I've tried but I'm not sure how to force asdf install to compile the musl version. Any hints?

phortx avatar Dec 27 '21 13:12 phortx

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

augustobmoura avatar Dec 27 '21 14:12 augustobmoura

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

augustobmoura avatar Dec 27 '21 15:12 augustobmoura

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.

augustobmoura avatar Feb 10 '22 00:02 augustobmoura

Chiming in to confirm @augustobmoura's instructions worked for me on Alpine 3.11.

Stratus3D avatar Jun 14 '22 22:06 Stratus3D

this ticket has been open quite awhile. is it a difficult fix?

danielb2 avatar Apr 19 '23 13:04 danielb2

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

augustobmoura avatar Apr 20 '23 00:04 augustobmoura

instead of installing broken binaries, would it not be better to refuse the install with some kind of message?

danielb2 avatar Apr 20 '23 01:04 danielb2

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

augustobmoura avatar May 20 '23 17:05 augustobmoura