graphprotocol / graph-node

Graph Node indexes data from blockchains such as Ethereum and serves it over GraphQL
https://thegraph.com
Apache License 2.0
2.91k stars 968 forks source link

Building graph node docker image doesn't work for M1 mac #3154

Open FredCoen opened 2 years ago

FredCoen commented 2 years ago

Building graph node docker image doesn't work for M1 mac

following error happens when running ./docker/build.sh

->>>

7 474.5 Compiling graph-node v0.25.0 (/graph-node/node)

7 559.8 error: could not compile graph-node

7 559.8

7 559.8 Caused by:

7 559.9 process didn't exit successfully: rustc --crate-name graph_node --edition=2018 node/src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no -C metadata=4e9b8118d2750228 -C extra-filename=-4e9b8118d2750228 --out-dir /graph-node/target/release/deps -L dependency=/graph-node/target/release/deps --extern clap=/graph-node/target/release/deps/libclap-ee6cce6d559b4c61.rlib --extern crossbeam_channel=/graph-node/target/release/deps/libcrossbeam_channel-1b48e305a1a9eb4b.rlib --extern diesel=/graph-node/target/release/deps/libdiesel-6afe8e7ec82e6470.rlib --extern env_logger=/graph-node/target/release/deps/libenv_logger-a503f343346d0fb6.rlib --extern fail=/graph-node/target/release/deps/libfail-150bccba1cba043b.rlib --extern futures=/graph-node/target/release/deps/libfutures-b07d29f0ca175c39.rlib --extern git_testament=/graph-node/target/release/deps/libgit_testament-a479a7f87bfb7d9d.rlib --extern graph=/graph-node/target/release/deps/libgraph-ac99ab4e32ea7be0.rlib --extern graph_chain_ethereum=/graph-node/target/release/deps/libgraph_chain_ethereum-846a583feaeb0323.rlib --extern graph_chain_near=/graph-node/target/release/deps/libgraph_chain_near-4de055cc29e35fbd.rlib --extern graph_core=/graph-node/target/release/deps/libgraph_core-f9c5ff8262f9a543.rlib --extern graph_graphql=/graph-node/target/release/deps/libgraph_graphql-98367b30998e9502.rlib --extern graph_node=/graph-node/target/release/deps/libgraph_node-755516aabcdf1a14.rlib --extern graph_runtime_wasm=/graph-node/target/release/deps/libgraph_runtime_wasm-162b82768a225076.rlib --extern graph_server_http=/graph-node/target/release/deps/libgraph_server_http-3859eb0424bb1809.rlib --extern graph_server_index_node=/graph-node/target/release/deps/libgraph_server_index_node-212de468ae3a221c.rlib --extern graph_server_json_rpc=/graph-node/target/release/deps/libgraph_server_json_rpc-b37ffa25fb6ff1d8.rlib --extern graph_server_metrics=/graph-node/target/release/deps/libgraph_server_metrics-d8a749952ed0b86f.rlib --extern graph_server_websocket=/graph-node/target/release/deps/libgraph_server_websocket-bc65291cd7b9ea31.rlib --extern graph_store_postgres=/graph-node/target/release/deps/libgraph_store_postgres-04f8db93b6a8d1a7.rlib --extern graphql_parser=/graph-node/target/release/deps/libgraphql_parser-d1c681ff1c9f7964.rlib --extern http=/graph-node/target/release/deps/libhttp-99684ef8448dde00.rlib --extern lazy_static=/graph-node/target/release/deps/liblazy_static-59e96dfc09c05e14.rlib --extern regex=/graph-node/target/release/deps/libregex-09fd61af53b2d653.rlib --extern serde=/graph-node/target/release/deps/libserde-214f726c314a2c6e.rlib --extern serde_regex=/graph-node/target/release/deps/libserde_regex-44e709d0c9b474bb.rlib --extern shellexpand=/graph-node/target/release/deps/libshellexpand-63e4ed4db6a39032.rlib --extern structopt=/graph-node/target/release/deps/libstructopt-ebb5225c518d1e4c.rlib --extern toml=/graph-node/target/release/deps/libtoml-4b9239c2004da336.rlib --extern url=/graph-node/target/release/deps/liburl-0f4c1957fe5d9123.rlib -g -L native=/usr/lib/aarch64-linux-gnu -L native=/graph-node/target/release/build/ring-b22b706ce9f8703e/out -L native=/graph-node/target/release/build/secp256k1-sys-06502c88ced4dbcf/out -L native=/graph-node/target/release/build/psm-26904df68c551afc/out -L native=/graph-node/target/release/build/zstd-sys-7249b498826fe117/out -L native=/graph-node/target/release/build/wasmtime-fiber-02613627f3ebdc69/out -L native=/graph-node/target/release/build/wasmtime-runtime-92398a24d097aaca/out (signal: 9, SIGKILL: kill)

7 559.9 warning: build failed, waiting for other jobs to finish...

7 561.9 error: failed to compile graph-node v0.25.0 (/graph-node/node), intermediate artifacts can be found at /graph-node/target

7 561.9

7 561.9 Caused by:

7 561.9 build failed

azf20 commented 2 years ago

thanks @FredCoen - @otaviopace I know you have been building graph-node with M1, do you see what might not be working?

hopeyen commented 2 years ago

I have graph-node installed on M1 but don't recall this error. What's your node and rust version?

dotansimha commented 2 years ago

I have graph-node installed on M1 but don't recall this error. What's your node and rust version?

Same here👍

FredCoen commented 2 years ago

node -> v16.0.0

rust -> rustc 1.57.0

Should I change those?

saihaj commented 2 years ago

Can confirm this is an issue on

sysctl -a | grep machdep.cpu.brand_string && node --version && rustc --version && docker --version
machdep.cpu.brand_string: Apple M1
v16.13.1
rustc 1.57.0 (f1edd0429 2021-11-29)
Docker version 20.10.11, build dea9396
alfredolopez80 commented 2 years ago

me too confirm this error in the complie process

jguthrie7 commented 2 years ago

I ran into the same issue building on M1 (slightly different error)

#5 456.9    Compiling graph-node v0.25.0 (/graph-node/node)
#5 537.7 error: could not compile `graph-node`
#5 537.7
#5 537.7 Caused by:
#5 537.7   process didn't exit successfully: `rustc --crate-name graphman --edition=2018 node/src/bin/manager.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no -C metadata=1872d25bd0f5c29b -C extra-filename=-1872d25bd0f5c29b --out-dir /graph-node/target/release/deps -L dependency=/graph-node/target/release/deps --extern clap=/graph-node/target/release/deps/libclap-e4dc6deafd0ef237.rlib --extern crossbeam_channel=/graph-node/target/release/deps/libcrossbeam_channel-a7a70bbd875df48d.rlib --extern diesel=/graph-node/target/release/deps/libdiesel-7424e800be6e7103.rlib --extern env_logger=/graph-node/target/release/deps/libenv_logger-f67d90a0ddc4c7e8.rlib --extern fail=/graph-node/target/release/deps/libfail-5c43da55c6b81e9f.rlib --extern futures=/graph-node/target/release/deps/libfutures-1c039c7c18fdd20e.rlib --extern git_testament=/graph-node/target/release/deps/libgit_testament-49f8d9aaf7833325.rlib --extern graph=/graph-node/target/release/deps/libgraph-243555a28e482425.rlib --extern graph_chain_ethereum=/graph-node/target/release/deps/libgraph_chain_ethereum-7768905e2b783d4a.rlib --extern graph_chain_near=/graph-node/target/release/deps/libgraph_chain_near-eb6fa6c42615fd0e.rlib --extern graph_core=/graph-node/target/release/deps/libgraph_core-5c05450086c4f3b7.rlib --extern graph_graphql=/graph-node/target/release/deps/libgraph_graphql-a8908a07fc108e36.rlib --extern graph_node=/graph-node/target/release/deps/libgraph_node-339db3e19a45c6f4.rlib --extern graph_runtime_wasm=/graph-node/target/release/deps/libgraph_runtime_wasm-5fdecf4d6dbcb3bd.rlib --extern graph_server_http=/graph-node/target/release/deps/libgraph_server_http-43fa52365afa3f6d.rlib --extern graph_server_index_node=/graph-node/target/release/deps/libgraph_server_index_node-503401a5da70ed59.rlib --extern graph_server_json_rpc=/graph-node/target/release/deps/libgraph_server_json_rpc-7ad8a7223542e482.rlib --extern graph_server_metrics=/graph-node/target/release/deps/libgraph_server_metrics-3e25a34deaf1caf2.rlib --extern graph_server_websocket=/graph-node/target/release/deps/libgraph_server_websocket-50a376f1e8904c77.rlib --extern graph_store_postgres=/graph-node/target/release/deps/libgraph_store_postgres-16cfd438f63e7f63.rlib --extern graphql_parser=/graph-node/target/release/deps/libgraphql_parser-4d7aa5257316105f.rlib --extern http=/graph-node/target/release/deps/libhttp-05ec3bb761857bec.rlib --extern lazy_static=/graph-node/target/release/deps/liblazy_static-b566516cf20344d3.rlib --extern prometheus=/graph-node/target/release/deps/libprometheus-77ce4f865e1cb44a.rlib --extern regex=/graph-node/target/release/deps/libregex-8de60c0e7766d74a.rlib --extern serde=/graph-node/target/release/deps/libserde-53c2c9b810127076.rlib --extern serde_regex=/graph-node/target/release/deps/libserde_regex-4b7aad9564b6bba8.rlib --extern shellexpand=/graph-node/target/release/deps/libshellexpand-275ad1d0595b31de.rlib --extern structopt=/graph-node/target/release/deps/libstructopt-77339b2f4c54302f.rlib --extern toml=/graph-node/target/release/deps/libtoml-5b2626009041909d.rlib --extern url=/graph-node/target/release/deps/liburl-a93f4bf6d8924980.rlib -g -L native=/usr/lib/aarch64-linux-gnu -L native=/graph-node/target/release/build/ring-0b24982ae9db463d/out -L native=/graph-node/target/release/build/secp256k1-sys-8f4643c6be36b5b4/out -L native=/graph-node/target/release/build/psm-48fd5d9e900cf5c4/out -L native=/graph-node/target/release/build/zstd-sys-4e70e89f864f1f8e/out -L native=/graph-node/target/release/build/wasmtime-fiber-536bf109b18e40ff/out -L native=/graph-node/target/release/build/wasmtime-runtime-5a5a3c45276e7d4f/out` (signal: 9, SIGKILL: kill)
leoyvens commented 2 years ago

Are you making sure docker has permission to use all the available RAM? Rust compilation can take a lot of memory.

jguthrie7 commented 2 years ago

Are you making sure docker has permission to use all the available RAM? Rust compilation can take a lot of memory.

This actually solved the problem. I bumped the memory allocation of docker from the default 2GB to 13 (not sure how much was actually necessary and the build step completed successfully.

Perhaps there should be a note in the docs about this.

Thank you for your help

paymog commented 2 years ago

I gave my docker client 32gbs of RAM through the Docker for Desktop mac app and still ran out of space.

I had to launch an EC2 instance with 32 GBs of RAM to build this.

mshakeg commented 1 year ago

I'm running the graph-node image 0.29.0 on an M1 Pro 16GB and it starts fine but after some time it just randomly crashes docker. Docker is set to 8GB RAM.

I might have to do this

izzetemredemir commented 1 year ago

Same problem