Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install on Apple M1 arm64 running Linux on Docker #22

Open
jkomyno opened this issue Jan 2, 2022 · 8 comments
Open

Cannot install on Apple M1 arm64 running Linux on Docker #22

jkomyno opened this issue Jan 2, 2022 · 8 comments

Comments

@jkomyno
Copy link
Contributor

jkomyno commented Jan 2, 2022

Host Machine Specification

I'm using the latest MacBook Pro 2021, with Apple M1 as CPU, which has anarm64 architecture.

Result of uname -a:
Darwin 192.168.1.77 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:01 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T6000 arm64

Docker Container Specification

I'm running Docker v20.10.10, and in particular I'm using the node:16.13.1-alpine image.

Issue

Trying to install protoc-gen-grpc with the following Dockerfile fails:

ARG NODE_VERSION=16.13.1
FROM node:${NODE_VERSION}-alpine

RUN npm install request -g
RUN npm config set unsafe-perm true

# this fails
RUN npm install protoc-gen-grpc -g

Error:

 > RUN npm install protoc-gen-grpc -g:
#29 9.286 npm ERR! code 1
#29 9.286 npm ERR! path /usr/local/lib/node_modules/protoc-gen-grpc
#29 9.287 npm ERR! command failed
#29 9.287 npm ERR! command sh -c ./node_modules/.bin/node-pre-gyp install
#29 9.287 npm ERR! response status 404 Not Found on https://node-precompiled-binaries.grpc.io/grpc-tools/v1.11.1/linux-arm64.tar.gz
#29 9.287 npm ERR! node-pre-gyp info it worked if it ends with ok
#29 9.287 npm ERR! node-pre-gyp info using [email protected]
#29 9.287 npm ERR! node-pre-gyp info using [email protected] | linux | arm64
#29 9.287 npm ERR! node-pre-gyp info check checked for "/usr/local/lib/node_modules/protoc-gen-grpc/bin/grpc_tools.node" (not found)
#29 9.287 npm ERR! node-pre-gyp http GET https://node-precompiled-binaries.grpc.io/grpc-tools/v1.11.1/linux-arm64.tar.gz
#29 9.287 npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://node-precompiled-binaries.grpc.io/grpc-tools/v1.11.1/linux-arm64.tar.gz 
#29 9.287 npm ERR! node-pre-gyp ERR! install error 
#29 9.287 npm ERR! node-pre-gyp ERR! stack Error: response status 404 Not Found on https://node-precompiled-binaries.grpc.io/grpc-tools/v1.11.1/linux-arm64.tar.gz
#29 9.287 npm ERR! node-pre-gyp ERR! stack     at /usr/local/lib/node_modules/protoc-gen-grpc/node_modules/@mapbox/node-pre-gyp/lib/install.js:67:15
#29 9.287 npm ERR! node-pre-gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:96:5)
#29 9.287 npm ERR! node-pre-gyp ERR! System Linux 5.10.47-linuxkit
#29 9.287 npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/protoc-gen-grpc/node_modules/.bin/node-pre-gyp" "install"
#29 9.287 npm ERR! node-pre-gyp ERR! cwd /usr/local/lib/node_modules/protoc-gen-grpc
#29 9.287 npm ERR! node-pre-gyp ERR! node -v v16.13.1
#29 9.287 npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.5
#29 9.287 npm ERR! node-pre-gyp ERR! not ok
#29 9.293 
#29 9.293 npm ERR! A complete log of this run can be found in:
#29 9.293 npm ERR!     /root/.npm/_logs/2022-01-02T20_25_47_915Z-debug.log

I get errors even if I try building the library from source.
Here is the updated Dockerfile:

ARG NODE_VERSION=16.13.1
FROM node:${NODE_VERSION}-alpine

RUN npm install request -g
RUN npm config set unsafe-perm true

RUN apk add --no-cache python3 make g++

# this fails
RUN npm install --build-from-source protoc-gen-grpc -g

which yields the following error:

 > RUN npm install --build-from-source protoc-gen-grpc -g:
#30 17.06 npm ERR! code 1
#30 17.06 npm ERR! path /usr/local/lib/node_modules/protoc-gen-grpc
#30 17.06 npm ERR! command failed
#30 17.06 npm ERR! command sh -c ./node_modules/.bin/node-pre-gyp install
#30 17.06 npm ERR! Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --module=/usr/local/lib/node_modules/protoc-gen-grpc/bin/grpc_tools.node --module_name=grpc_tools --module_path=/usr/local/lib/node_modules/protoc-gen-grpc/bin --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
#30 17.06 npm ERR! node-pre-gyp info it worked if it ends with ok
#30 17.06 npm ERR! node-pre-gyp info using [email protected]
#30 17.06 npm ERR! node-pre-gyp info using [email protected] | linux | arm64
#30 17.06 npm ERR! node-pre-gyp info build requesting source compile
#30 17.06 npm ERR! gyp info it worked if it ends with ok
#30 17.06 npm ERR! gyp info using [email protected]
#30 17.06 npm ERR! gyp info using [email protected] | linux | arm64
#30 17.06 npm ERR! gyp info ok 
#30 17.06 npm ERR! gyp info it worked if it ends with ok
#30 17.06 npm ERR! gyp info using [email protected]
#30 17.06 npm ERR! gyp info using [email protected] | linux | arm64
#30 17.06 npm ERR! gyp info find Python using Python version 3.9.5 found at "/usr/bin/python3"
#30 17.06 npm ERR! gyp http GET https://nodejs.org/download/release/v16.13.1/node-v16.13.1-headers.tar.gz
#30 17.06 npm ERR! gyp http 200 https://nodejs.org/download/release/v16.13.1/node-v16.13.1-headers.tar.gz
#30 17.06 npm ERR! gyp http GET https://nodejs.org/download/release/v16.13.1/SHASUMS256.txt
#30 17.06 npm ERR! gyp http 200 https://nodejs.org/download/release/v16.13.1/SHASUMS256.txt
#30 17.06 npm ERR! gyp info spawn /usr/bin/python3
#30 17.06 npm ERR! gyp info spawn args [
#30 17.06 npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
#30 17.06 npm ERR! gyp info spawn args   'binding.gyp',
#30 17.06 npm ERR! gyp info spawn args   '-f',
#30 17.06 npm ERR! gyp info spawn args   'make',
#30 17.06 npm ERR! gyp info spawn args   '-I',
#30 17.06 npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/protoc-gen-grpc/build/config.gypi',
#30 17.06 npm ERR! gyp info spawn args   '-I',
#30 17.06 npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
#30 17.06 npm ERR! gyp info spawn args   '-I',
#30 17.06 npm ERR! gyp info spawn args   '/root/.cache/node-gyp/16.13.1/include/node/common.gypi',
#30 17.06 npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
#30 17.06 npm ERR! gyp info spawn args   '-Dvisibility=default',
#30 17.06 npm ERR! gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/16.13.1',
#30 17.06 npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
#30 17.06 npm ERR! gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/16.13.1/<(target_arch)/node.lib',
#30 17.06 npm ERR! gyp info spawn args   '-Dmodule_root_dir=/usr/local/lib/node_modules/protoc-gen-grpc',
#30 17.06 npm ERR! gyp info spawn args   '-Dnode_engine=v8',
#30 17.06 npm ERR! gyp info spawn args   '--depth=.',
#30 17.06 npm ERR! gyp info spawn args   '--no-parallel',
#30 17.06 npm ERR! gyp info spawn args   '--generator-output',
#30 17.06 npm ERR! gyp info spawn args   'build',
#30 17.06 npm ERR! gyp info spawn args   '-Goutput_dir=.'
#30 17.06 npm ERR! gyp info spawn args ]
#30 17.06 npm ERR! gyp: binding.gyp not found (cwd: /usr/local/lib/node_modules/protoc-gen-grpc) while trying to load binding.gyp
#30 17.06 npm ERR! gyp ERR! configure error 
#30 17.06 npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
#30 17.06 npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:261:16)
#30 17.06 npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
#30 17.06 npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
#30 17.06 npm ERR! gyp ERR! System Linux 5.10.47-linuxkit
#30 17.06 npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--module=/usr/local/lib/node_modules/protoc-gen-grpc/bin/grpc_tools.node" "--module_name=grpc_tools" "--module_path=/usr/local/lib/node_modules/protoc-gen-grpc/bin" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v93"
#30 17.06 npm ERR! gyp ERR! cwd /usr/local/lib/node_modules/protoc-gen-grpc
#30 17.06 npm ERR! gyp ERR! node -v v16.13.1
#30 17.06 npm ERR! gyp ERR! node-gyp -v v8.3.0
#30 17.06 npm ERR! gyp ERR! not ok 
#30 17.06 npm ERR! node-pre-gyp ERR! build error 
#30 17.06 npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --module=/usr/local/lib/node_modules/protoc-gen-grpc/bin/grpc_tools.node --module_name=grpc_tools --module_path=/usr/local/lib/node_modules/protoc-gen-grpc/bin --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
#30 17.06 npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/protoc-gen-grpc/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
#30 17.06 npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
#30 17.06 npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
#30 17.06 npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
#30 17.06 npm ERR! node-pre-gyp ERR! System Linux 5.10.47-linuxkit
#30 17.06 npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/protoc-gen-grpc/node_modules/.bin/node-pre-gyp" "install"
#30 17.06 npm ERR! node-pre-gyp ERR! cwd /usr/local/lib/node_modules/protoc-gen-grpc
#30 17.06 npm ERR! node-pre-gyp ERR! node -v v16.13.1
#30 17.06 npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.5
#30 17.06 npm ERR! node-pre-gyp ERR! not ok
#30 17.07 
#30 17.07 npm ERR! A complete log of this run can be found in:
#30 17.07 npm ERR!     /root/.npm/_logs/2022-01-02T20_34_46_825Z-debug.log
@jkomyno
Copy link
Contributor Author

jkomyno commented Jan 2, 2022

I believe this is the root issue: grpc/grpc-node#1405

@stultuss
Copy link
Owner

Thanks a lot!Let me have a look.

@jkomyno
Copy link
Contributor Author

jkomyno commented Jan 24, 2022

Hi @stultuss, is there any chance you've found a viable solution / workaround?

@stultuss
Copy link
Owner

Sorry, I'm a little busy this month.

I think we need to follow this list until grpc-tools update https://node-precompiled-binaries.grpc.io/

@stultuss
Copy link
Owner

@stultuss
Copy link
Owner

stultuss commented Apr 6, 2022

npm_config_target_arch=x64 npm i grpc-tools

This works

@loudmouth
Copy link

@stultuss grpc-node now has pre-compiled ARM binaries as of grpc-tool version 1.11.3. though I do not see it at https://node-precompiled-binaries.grpc.io/ yet

Does these changes to the grpc-node repo and grpc-tools package help in anyway?

@loudmouth
Copy link

Just a quick comment, using npm_config_target_arch=x64 won't work in build environments such as Bazel so now that grpc-tools has published binaries, really hoping the dependencies can be updated here.

I attempted to bump grpc-tools in hopes of making a merge request here but didn't have luck. I'm assuming those who have maintained the project would have a better understanding of what needs to be done.

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

No branches or pull requests

3 participants