Docker.Official.Image icon indicating copy to clipboard operation
Docker.Official.Image copied to clipboard

It doesn't build on arm64 architecture due to Node.js Fibers package

Open shawnguo2 opened this issue 6 years ago • 2 comments

Hi,

I'm trying to do an arm64 native build of rocket.chat docker image. The problem I'm facing is that there is a prebuilt Fibers package for x64, but it has to be built from source on arm64. However, the build fails with -slim node image from which some tools like python are missing.

  • x64 architecture

[email protected] install /app/bundle/programs/server/node_modules/fibers node build.js || nodejs build.js linux-x64-57 exists; testing Binary is fine; exiting

  • arm64 architecture

[email protected] install /app/bundle/programs/server/node_modules/fibers node build.js || nodejs build.js gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable. gyp ERR! stack at PythonFinder.failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:483:19) gyp ERR! stack at PythonFinder. (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:397:16) gyp ERR! stack at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:16) gyp ERR! stack at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29) gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16 gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5 gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21) gyp ERR! System Linux 4.17.0-rc4-00005-g8f0d93ff4870 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release" gyp ERR! cwd /app/bundle/programs/server/node_modules/fibers gyp ERR! node -v v8.9.4 gyp ERR! node-gyp -v v3.6.2 gyp ERR! not ok node-gyp exited with code: 1 Please make sure you are using a supported platform and node version. If you would like to compile fibers on this machine please make sure you have setup your build environment-- Windows + OS X instructions here: https://github.com/nodejs/node-gyp Ubuntu users please run: sudo apt-get install g++ build-essential Alpine users please run: sudo apk add python make g++

It can be successfully built with changing base image from node:8.9-slim to node:8.9 in Dockerfile.

[email protected] install /app/bundle/programs/server/node_modules/fibers node build.js || nodejs build.js make: Entering directory '/app/bundle/programs/server/node_modules/fibers/build' CXX(target) Release/obj.target/fibers/src/fibers.o CXX(target) Release/obj.target/fibers/src/coroutine.o CC(target) Release/obj.target/fibers/src/libcoro/coro.o SOLINK_MODULE(target) Release/obj.target/fibers.node COPY Release/fibers.node make: Leaving directory '/app/bundle/programs/server/node_modules/fibers/build' Installed in /app/bundle/programs/server/node_modules/fibers/bin/linux-arm64-57/fibers.node

But is it the correct fix? Thanks.

Shawn

shawnguo2 avatar Jun 03 '18 14:06 shawnguo2

I'm not the image maintainer here, but IMO it'd be better to figure out what packages are necessary and install just those -- the difference between node:8.11-slim and node:8.11 is pretty significant:

$ docker images 'node:8.11*'
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
node                8.11-slim           1d5555ef5229        3 weeks ago         182MB
node                8.11                ed145ef978c4        3 weeks ago         673MB

I imagine the necessary build dependencies could probably even be added and subsequently removed in the same RUN line to save even more space on the arm64v8 build (to ensure it's got rough size parity with amd64). I think the hard part is going to be determining which architectures we need to install the build dependencies on, but perhaps that'd be fine to be a hard-coded list for now?

tianon avatar Aug 13 '18 19:08 tianon

https://github.com/RocketChat/Docker.Official.Image/pull/60

lag-linaro avatar Aug 13 '19 09:08 lag-linaro