Skip to content

Conversation

@basti1302
Copy link
Contributor

Fix for building against musl libc

This fix enables the package to be built against
musl libc instead of glibc. Musl libc is
used in the Linux Alpine distro and since the
official Node.js Docker repo
advertises its Alpine based images as "highly recommended
when final image size being as small as possible is desired", it turns
out that quite a few people run Node.js on Alpine via these images.

This change should not have any impact on systems that use the more
widespread glibc, as the updated imports should be available in all
libc variants.

This fix enables the package to be built against
[musl libc](https://www.musl-libc.org/) instead of glibc. Musl libc is
used in the Linux Alpine distro and since the
[official Node.js Docker repo](https://hub.docker.com/_/node/)
advertises its Alpine based images as "highly recommended
when final image size being as small as possible is desired", it turns
out that quite a few people run Node.js on Alpine via these images.

This change should not have any impact on systems that use the more
widespread glibc, as the updated imports should be available in all
libc variants.
@basti1302
Copy link
Contributor Author

I've used the following Dockerfiles to verify the package in Alpine and Jessie. I did not verify anything in Windows, though.

Alpine, Node 10

FROM node:10-alpine
WORKDIR /usr/src/app
COPY package*.json ./
RUN apk add --no-cache --virtual .gyp \
        build-base \
        python \
        git \
    && npm install
COPY . .
RUN npm install --global node-gyp
RUN node-gyp rebuild
CMD [ "npm", "test" ]

Jessie, Node 10.

FROM node:10
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm install --global node-gyp
RUN node-gyp rebuild
CMD [ "npm", "test" ]

Alpine, Node 8

FROM node:8.12.0-alpine
WORKDIR /usr/src/app
COPY package*.json ./
RUN apk add --no-cache --virtual .gyp \
        build-base \
        python \
        git \
    && npm install
COPY . .
RUN npm install --global node-gyp
RUN node-gyp rebuild
CMD [ "npm", "test" ]

The node-gyp build finished with gyp info ok and the tests were green for all three.

@JacobFischer
Copy link
Owner

JacobFischer commented Sep 26, 2018

Thanks! I'll double check this evening to make sure everything seems solid, and if so I'll merge this PR and update the package to 1.1.1.

@basti1302
Copy link
Contributor Author

Sounds great! Thanks.

@JacobFischer
Copy link
Owner

Yup looks good!

@JacobFischer JacobFischer merged commit 3ccf397 into JacobFischer:master Sep 27, 2018
@basti1302 basti1302 deleted the fix-build-musl-libc-alpine branch September 27, 2018 04:58
@basti1302
Copy link
Contributor Author

Thanks for merging and publishing! 🎉

basti1302 added a commit to instana/nodejs that referenced this pull request Sep 27, 2018
See JacobFischer/netlinkwrapper#6 and
JacobFischer/netlinkwrapper@813742a

This fix enables the installation of the optional dependency
netlinkwrapper (necessary for reporting uncaught exceptions)
on systems that use [musl libc](https://www.musl-libc.org/)
instead of glibc. Musl libc is used in the Linux Alpine distro and
since the [official Node.js Docker repo](https://hub.docker.com/_/node/)
advertises its Alpine based images as "highly recommended
when final image size being as small as possible is desired", it turns
out that quite a few people run Node.js on Alpine via these images.

This change should not have any impact on systems that use the more
widespread glibc, as the updated imports in netlinkwrapper should be
available in all libc variants.
basti1302 added a commit to instana/nodejs that referenced this pull request Sep 27, 2018
See JacobFischer/netlinkwrapper#6 and
JacobFischer/netlinkwrapper@813742a

This fix enables the installation of the optional dependency
netlinkwrapper (necessary for reporting uncaught exceptions)
on systems that use [musl libc](https://www.musl-libc.org/)
instead of glibc. Musl libc is used in the Linux Alpine distro and
since the [official Node.js Docker repo](https://hub.docker.com/_/node/)
advertises its Alpine based images as "highly recommended
when final image size being as small as possible is desired", it turns
out that quite a few people run Node.js on Alpine via these images.

This change should not have any impact on systems that use the more
widespread glibc, as the updated imports in netlinkwrapper should be
available in all libc variants.
basti1302 added a commit to instana/nodejs that referenced this pull request Sep 27, 2018
See JacobFischer/netlinkwrapper#6 and
JacobFischer/netlinkwrapper@813742a

This fix enables the installation of the optional dependency
netlinkwrapper (necessary for reporting uncaught exceptions)
on systems that use [musl libc](https://www.musl-libc.org/)
instead of glibc. Musl libc is used in the Linux Alpine distro and
since the [official Node.js Docker repo](https://hub.docker.com/_/node/)
advertises its Alpine based images as "highly recommended
when final image size being as small as possible is desired", it turns
out that quite a few people run Node.js on Alpine via these images.

This change should not have any impact on systems that use the more
widespread glibc, as the updated imports in netlinkwrapper should be
available in all libc variants.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants