coral-xyz / anchor

⚓ Solana Sealevel Framework
https://anchor-lang.com
Apache License 2.0
3.61k stars 1.32k forks source link

Unable to install anchor-cli on Ubuntu 20.04 ARM64 #1843

Closed causevic closed 2 years ago

causevic commented 2 years ago

Here's the error log:

parallels@ubuntu-linux-20-04-desktop:~$ cargo install --git https://github.com/project-serum/anchor anchor-cli --locked
    Updating git repository `https://github.com/project-serum/anchor`
  Installing anchor-cli v0.24.2 (https://github.com/project-serum/anchor#282c3946)
    Updating crates.io index
warning: package `crossbeam-channel v0.5.3` in Cargo.lock is yanked in registry `crates-io`, consider running without --locked
warning: package `ed25519 v1.4.0` in Cargo.lock is yanked in registry `crates-io`, consider running without --locked
   Compiling libc v0.2.120
   Compiling proc-macro2 v1.0.36
   Compiling syn v1.0.88
   Compiling unicode-xid v0.2.2
   Compiling version_check v0.9.4
   Compiling cfg-if v1.0.0
   Compiling serde_derive v1.0.136
   Compiling serde v1.0.136
   Compiling typenum v1.15.0
   Compiling autocfg v1.1.0
   Compiling memchr v2.4.1
   Compiling semver v1.0.6
   Compiling once_cell v1.10.0
   Compiling log v0.4.14
   Compiling lazy_static v1.4.0
   Compiling subtle v2.4.1
   Compiling serde_json v1.0.79
   Compiling crunchy v0.2.2
   Compiling block-padding v0.2.1
   Compiling ppv-lite86 v0.2.16
   Compiling getrandom v0.1.16
   Compiling opaque-debug v0.3.0
   Compiling regex-syntax v0.6.25
   Compiling bitflags v1.3.2
   Compiling itoa v1.0.1
   Compiling wasm-bindgen-shared v0.2.79
   Compiling scopeguard v1.1.0
   Compiling fnv v1.0.7
   Compiling bumpalo v3.9.1
   Compiling termcolor v1.1.3
   Compiling feature-probe v0.1.1
   Compiling byteorder v1.4.3
   Compiling rustversion v1.0.6
   Compiling either v1.6.1
   Compiling base64 v0.13.0
   Compiling humantime v2.1.0
   Compiling percent-encoding v2.1.0
   Compiling ryu v1.0.9
   Compiling wasm-bindgen v0.2.79
   Compiling bs58 v0.4.0
   Compiling arrayref v0.3.6
   Compiling pkg-config v0.3.24
   Compiling arrayvec v0.7.2
   Compiling base64 v0.12.3
   Compiling keccak v0.1.0
   Compiling constant_time_eq v0.1.5
   Compiling adler v1.0.2
   Compiling failure_derive v0.1.8
   Compiling gimli v0.26.1
   Compiling pin-project-lite v0.2.8
   Compiling smallvec v1.8.0
   Compiling rustc-demangle v0.1.21
   Compiling signature v1.5.0
   Compiling futures-core v0.3.21
   Compiling bytes v1.1.0
   Compiling parking_lot_core v0.9.1
   Compiling futures-task v0.3.21
   Compiling futures-sink v0.3.21
   Compiling futures-channel v0.3.21
   Compiling assert_matches v1.5.0
   Compiling anyhow v1.0.56
   Compiling futures-util v0.3.21
   Compiling spin v0.5.2
   Compiling slab v0.4.5
   Compiling tinyvec_macros v0.1.0
   Compiling futures-io v0.3.21
   Compiling pin-utils v0.1.0
   Compiling untrusted v0.7.1
   Compiling matches v0.1.9
   Compiling httparse v1.6.0
   Compiling foreign-types-shared v0.1.1
   Compiling unicode-bidi v0.3.7
   Compiling crossbeam-utils v0.8.8
   Compiling rustls v0.20.4
   Compiling openssl v0.10.38
   Compiling native-tls v0.2.8
   Compiling try-lock v0.2.3
   Compiling openssl-probe v0.1.5
   Compiling tower-service v0.3.1
   Compiling httpdate v1.0.2
   Compiling rayon-core v1.9.1
   Compiling encoding_rs v0.8.30
   Compiling unicode-segmentation v1.9.0
   Compiling yansi v0.5.0
   Compiling mime v0.3.16
   Compiling ipnet v2.4.0
   Compiling bs58 v0.3.1
   Compiling unicode-width v0.1.9
   Compiling proc-macro2 v0.4.30
   Compiling unicode-xid v0.1.0
   Compiling fastrand v1.7.0
   Compiling remove_dir_all v0.5.0
   Compiling syn v0.15.44
   Compiling zstd-safe v4.1.3+zstd.1.5.1
   Compiling parking_lot_core v0.8.5
   Compiling crc32fast v1.3.2
   Compiling same-file v1.0.6
   Compiling vec_map v0.8.2
   Compiling solana-perf v1.9.13
   Compiling linked-hash-map v0.5.4
   Compiling strsim v0.8.0
   Compiling ansi_term v0.12.1
   Compiling fs_extra v1.2.0
   Compiling stable_deref_trait v1.2.0
   Compiling aliasable v0.1.3
   Compiling rustc-hash v1.1.0
   Compiling base32 v0.4.0
   Compiling symlink v0.1.0
   Compiling index_list v0.2.7
   Compiling number_prefix v0.4.0
   Compiling utf-8 v0.7.6
   Compiling heck v0.4.0
   Compiling strsim v0.10.0
   Compiling textwrap v0.15.0
   Compiling pathdiff v0.2.1
   Compiling libloading v0.7.3
   Compiling instant v0.1.12
   Compiling generic-array v0.14.5
   Compiling ahash v0.7.6
   Compiling unicase v2.6.0
   Compiling proc-macro2-diagnostics v0.9.1
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling num-traits v0.2.14
   Compiling miniz_oxide v0.4.4
   Compiling num-integer v0.1.44
   Compiling indexmap v1.8.0
   Compiling memoffset v0.6.5
   Compiling crossbeam-epoch v0.9.8
   Compiling rayon v1.5.1
   Compiling tracing-core v0.1.23
   Compiling lock_api v0.4.6
   Compiling uriparse v0.6.3
   Compiling bv v0.11.1
   Compiling itertools v0.10.3
   Compiling rustls-pemfile v0.3.0
   Compiling qstring v0.7.2
   Compiling addr2line v0.17.0
   Compiling ed25519 v1.4.0
   Compiling http v0.2.6
   Compiling tinyvec v1.5.1
   Compiling form_urlencoded v1.0.1
   Compiling foreign-types v0.3.2
   Compiling heck v0.3.3
   Compiling textwrap v0.11.0
   Compiling walkdir v2.3.2
   Compiling yaml-rust v0.4.5
   Compiling tracing v0.1.32
   Compiling http-body v0.4.4
   Compiling unicode-normalization v0.1.19
   Compiling dir-diff v0.3.2
   Compiling getrandom v0.2.5
   Compiling cpufeatures v0.2.1
   Compiling atty v0.2.14
   Compiling memmap2 v0.5.3
   Compiling num_cpus v1.13.1
   Compiling time v0.1.44
   Compiling socket2 v0.4.4
   Compiling signal-hook-registry v1.4.0
   Compiling gethostname v0.2.3
   Compiling tempfile v3.3.0
   Compiling terminal_size v0.1.17
   Compiling dirs-sys-next v0.1.2
   Compiling errno v0.2.8
   Compiling filetime v0.2.15
   Compiling xattr v0.2.2
   Compiling rpassword v5.0.1
   Compiling dirs-sys v0.3.6
   Compiling quote v1.0.15
   Compiling jobserver v0.1.24
   Compiling aho-corasick v0.7.18
   Compiling object v0.27.1
   Compiling os_str_bytes v6.0.0
   Compiling rustc_version v0.4.0
   Compiling mio v0.8.1
   Compiling want v0.3.0
   Compiling idna v0.2.3
   Compiling crossbeam-channel v0.5.3
   Compiling quote v0.6.13
   Compiling rand_core v0.6.3
   Compiling rand_core v0.5.1
   Compiling clap v2.34.0
   Compiling solana-rayon-threadlimit v1.9.13
   Compiling parking_lot v0.12.0
   Compiling dirs-next v2.0.0
   Compiling parking_lot v0.11.2
   Compiling tar v0.4.38
   Compiling dirs v3.0.2
   Compiling cc v1.0.73
   Compiling mime_guess v2.0.4
   Compiling flate2 v1.0.22
   Compiling nix v0.23.1
   Compiling regex v1.5.5
   Compiling solana-frozen-abi-macro v1.9.13
   Compiling solana-frozen-abi v1.9.13
   Compiling solana-program v1.9.13
   Compiling solana-sdk v1.9.13
   Compiling solana-program-runtime v1.9.13
   Compiling solana-vote-program v1.9.13
   Compiling solana-bloom v1.9.13
   Compiling solana-address-lookup-table-program v1.9.13
   Compiling solana-stake-program v1.9.13
   Compiling solana-version v1.9.13
   Compiling solana-runtime v1.9.13
   Compiling url v2.2.2
   Compiling hashbrown v0.11.2
   Compiling rand_chacha v0.2.2
   Compiling rand_chacha v0.3.1
   Compiling shellexpand v2.1.0
   Compiling synstructure v0.12.6
   Compiling wasm-bindgen-backend v0.2.79
   Compiling borsh-derive-internal v0.9.3
   Compiling borsh-schema-derive-internal v0.9.3
   Compiling blake3 v1.3.1
   Compiling backtrace v0.3.64
   Compiling ring v0.16.20
   Compiling openssl-sys v0.9.72
   Compiling zstd-sys v1.6.2+zstd.1.5.1
   Compiling bzip2-sys v0.1.11+1.0.8
   Compiling hidapi v1.3.4
   Compiling thiserror-impl v1.0.30
   Compiling bytemuck_derive v1.0.1
   Compiling num-derive v0.3.3
   Compiling solana-sdk-macro v1.9.13
   Compiling tokio-macros v1.7.0
   Compiling futures-macro v0.3.21
   Compiling crossbeam-deque v0.8.1
   Compiling env_logger v0.9.0
   Compiling console v0.15.0
   Compiling Inflector v0.11.4
   Compiling rand v0.7.3
   Compiling dlopen_derive v0.1.4
   Compiling rand v0.8.5
   Compiling zeroize_derive v1.3.2
   Compiling wasm-bindgen-macro-support v0.2.79
   Compiling clap_derive v3.1.4
   Compiling thiserror v1.0.30
   Compiling bytemuck v1.8.0
   Compiling tokio v1.17.0
   Compiling solana-logger v1.9.13
   Compiling indicatif v0.16.2
   Compiling ouroboros_macro v0.13.0
   Compiling dlopen v0.1.8
   Compiling portpicker v0.1.1
   Compiling zeroize v1.5.3
   Compiling wasm-bindgen-macro v0.2.79
   Compiling clap v3.1.6
   Compiling caps v0.5.3
   Compiling bincode v1.3.3
   Compiling serde_bytes v0.11.5
   Compiling chrono v0.4.19
   Compiling serde_urlencoded v0.7.1
   Compiling serde_yaml v0.8.23
   Compiling toml v0.5.8
   Compiling tokio-util v0.6.9
   Compiling futures-executor v0.3.21
   Compiling ouroboros v0.13.0
   Compiling dialoguer v0.9.0
   Compiling failure v0.1.8
   Compiling webpki v0.22.0
   Compiling sct v0.7.0
   Compiling bzip2 v0.4.3
   Compiling digest v0.9.0
   Compiling block-buffer v0.9.0
   Compiling crypto-mac v0.8.0
   Compiling block-buffer v0.10.2
   Compiling crypto-common v0.1.3
   Compiling crypto-mac v0.9.1
   Compiling crypto-mac v0.11.1
   Compiling solana-cli-config v1.9.13
   Compiling cargo_toml v0.9.2
   Compiling proc-macro-crate v0.1.5
   Compiling proc-macro-crate v1.1.3
   Compiling h2 v0.3.12
   Compiling futures v0.3.21
   Compiling dashmap v4.0.2
   Compiling derivation-path v0.1.3
   Compiling webpki-roots v0.22.2
   Compiling curve25519-dalek v3.2.0
   Compiling libsecp256k1-core v0.2.2
   Compiling sha2 v0.9.9
   Compiling sha3 v0.9.1
   Compiling sha-1 v0.9.8
   Compiling hmac v0.8.1
   Compiling pbkdf2 v0.4.0
   Compiling digest v0.10.3
   Compiling hmac v0.9.0
   Compiling pbkdf2 v0.9.0
   Compiling hmac v0.11.0
   Compiling borsh-derive v0.9.3
   Compiling num_enum_derive v0.5.7
   Compiling hyper v0.14.17
   Compiling jsonrpc-core v18.0.0
   Compiling tokio-native-tls v0.3.0
   Compiling tokio-rustls v0.23.2
   Compiling ed25519-dalek v1.0.1
   Compiling anchor-syn v0.24.2 (/home/parallels/.cargo/git/checkouts/anchor-bf03d42499b9267c/282c394/lang/syn)
   Compiling tungstenite v0.16.0
   Compiling hmac-drbg v0.3.0
   Compiling tiny-bip39 v0.8.2
   Compiling libsecp256k1-gen-ecmult v0.2.1
   Compiling libsecp256k1-gen-genmult v0.2.1
   Compiling borsh v0.9.3
   Compiling num_enum v0.5.7
   Compiling ed25519-dalek-bip32 v0.1.1
   Compiling hyper-tls v0.5.0
   Compiling hyper-rustls v0.23.0
   Compiling anchor-attribute-event v0.24.2 (/home/parallels/.cargo/git/checkouts/anchor-bf03d42499b9267c/282c394/lang/attribute/event)
   Compiling anchor-attribute-constant v0.24.2 (/home/parallels/.cargo/git/checkouts/anchor-bf03d42499b9267c/282c394/lang/attribute/constant)
   Compiling anchor-attribute-state v0.24.2 (/home/parallels/.cargo/git/checkouts/anchor-bf03d42499b9267c/282c394/lang/attribute/state)
   Compiling anchor-derive-accounts v0.24.2 (/home/parallels/.cargo/git/checkouts/anchor-bf03d42499b9267c/282c394/lang/derive/accounts)
   Compiling anchor-attribute-program v0.24.2 (/home/parallels/.cargo/git/checkouts/anchor-bf03d42499b9267c/282c394/lang/attribute/program)
   Compiling anchor-attribute-error v0.24.2 (/home/parallels/.cargo/git/checkouts/anchor-bf03d42499b9267c/282c394/lang/attribute/error)
   Compiling anchor-attribute-account v0.24.2 (/home/parallels/.cargo/git/checkouts/anchor-bf03d42499b9267c/282c394/lang/attribute/account)
   Compiling anchor-attribute-interface v0.24.2 (/home/parallels/.cargo/git/checkouts/anchor-bf03d42499b9267c/282c394/lang/attribute/interface)
   Compiling anchor-attribute-access-control v0.24.2 (/home/parallels/.cargo/git/checkouts/anchor-bf03d42499b9267c/282c394/lang/attribute/access-control)
   Compiling libsecp256k1 v0.6.0
   Compiling reqwest v0.11.10
   Compiling spl-token v3.2.0
   Compiling spl-memo v3.0.1
   Compiling anchor-lang v0.24.2 (/home/parallels/.cargo/git/checkouts/anchor-bf03d42499b9267c/282c394/lang)
   Compiling spl-associated-token-account v1.0.3
   Compiling solana-measure v1.9.13
   Compiling solana-metrics v1.9.13
   Compiling solana-remote-wallet v1.9.13
   Compiling solana-bucket-map v1.9.13
   Compiling solana-net-utils v1.9.13
   Compiling solana-config-program v1.9.13
   Compiling solana-compute-budget-program v1.9.13
   Compiling solana-clap-utils v1.9.13
   Compiling solana-faucet v1.9.13
   Compiling zstd v0.9.2+zstd.1.5.1
   Compiling solana-account-decoder v1.9.13
   Compiling solana-transaction-status v1.9.13
   Compiling solana-client v1.9.13
   Compiling anchor-client v0.24.2 (/home/parallels/.cargo/git/checkouts/anchor-bf03d42499b9267c/282c394/client)
   Compiling anchor-cli v0.24.2 (/home/parallels/.cargo/git/checkouts/anchor-bf03d42499b9267c/282c394/cli)
error: failed to compile `anchor-cli v0.24.2 (https://github.com/project-serum/anchor#282c3946)`, intermediate artifacts can be found at `/tmp/cargo-installaegHGd`

Caused by:
  could not compile `anchor-cli`

Caused by:
  process didn't exit successfully: `rustc --crate-name anchor --edition=2021 cli/src/bin/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C opt-level=3 -C lto -C codegen-units=1 --cfg 'feature="default"' -C metadata=4a680f04c7ba9deb -C extra-filename=-4a680f04c7ba9deb --out-dir /tmp/cargo-installaegHGd/release/deps -L dependency=/tmp/cargo-installaegHGd/release/deps --extern anchor_cli=/tmp/cargo-installaegHGd/release/deps/libanchor_cli-f10211ade7d1dd40.rlib --extern anchor_client=/tmp/cargo-installaegHGd/release/deps/libanchor_client-f87b5660a3d30345.rlib --extern anchor_lang=/tmp/cargo-installaegHGd/release/deps/libanchor_lang-2ce0fef139df26a5.rlib --extern anchor_syn=/tmp/cargo-installaegHGd/release/deps/libanchor_syn-33309e87abf355dc.rlib --extern anyhow=/tmp/cargo-installaegHGd/release/deps/libanyhow-44ee83e0c270c191.rlib --extern cargo_toml=/tmp/cargo-installaegHGd/release/deps/libcargo_toml-f74efafa4981764d.rlib --extern chrono=/tmp/cargo-installaegHGd/release/deps/libchrono-6b5baf4a1160359b.rlib --extern clap=/tmp/cargo-installaegHGd/release/deps/libclap-4678779e3a373477.rlib --extern dirs=/tmp/cargo-installaegHGd/release/deps/libdirs-84c8277e6d4453d2.rlib --extern flate2=/tmp/cargo-installaegHGd/release/deps/libflate2-1a1b7d53ed124e20.rlib --extern heck=/tmp/cargo-installaegHGd/release/deps/libheck-c5776244f676a37a.rlib --extern pathdiff=/tmp/cargo-installaegHGd/release/deps/libpathdiff-49768c35fc699b58.rlib --extern portpicker=/tmp/cargo-installaegHGd/release/deps/libportpicker-84005f33af98804a.rlib --extern rand=/tmp/cargo-installaegHGd/release/deps/librand-ac2e9bc021235f4f.rlib --extern reqwest=/tmp/cargo-installaegHGd/release/deps/libreqwest-69f3bff1d3f27f6b.rlib --extern semver=/tmp/cargo-installaegHGd/release/deps/libsemver-ac85266bc6f92107.rlib --extern serde=/tmp/cargo-installaegHGd/release/deps/libserde-3f000e52c5636cfc.rlib --extern serde_json=/tmp/cargo-installaegHGd/release/deps/libserde_json-f51eff2d372b18ff.rlib --extern shellexpand=/tmp/cargo-installaegHGd/release/deps/libshellexpand-3ceee7bfdd4bf3f6.rlib --extern solana_cli_config=/tmp/cargo-installaegHGd/release/deps/libsolana_cli_config-e85b18c31391172c.rlib --extern solana_client=/tmp/cargo-installaegHGd/release/deps/libsolana_client-14b689ca77d0e876.rlib --extern solana_faucet=/tmp/cargo-installaegHGd/release/deps/libsolana_faucet-ba47e87304167fdc.rlib --extern solana_program=/tmp/cargo-installaegHGd/release/deps/libsolana_program-64eb9f80249bae3b.rlib --extern solana_sdk=/tmp/cargo-installaegHGd/release/deps/libsolana_sdk-a5274925fb73d4d2.rlib --extern syn=/tmp/cargo-installaegHGd/release/deps/libsyn-fe8b54a56ba50976.rlib --extern tar=/tmp/cargo-installaegHGd/release/deps/libtar-db62643a99aa111a.rlib --extern tokio=/tmp/cargo-installaegHGd/release/deps/libtokio-b8edd4baad9c4cb2.rlib --extern toml=/tmp/cargo-installaegHGd/release/deps/libtoml-b3ae6805134e6bc3.rlib --extern walkdir=/tmp/cargo-installaegHGd/release/deps/libwalkdir-3a07c1d6112296ca.rlib -L native=/tmp/cargo-installaegHGd/release/build/blake3-d2e5ef44aa53a5e4/out -L native=/tmp/cargo-installaegHGd/release/build/ring-21e2f2c27f03d048/out -L native=/tmp/cargo-installaegHGd/release/build/zstd-sys-44d3b9c52eef8b19/out -L native=/lib/aarch64-linux-gnu -L native=/tmp/cargo-installaegHGd/release/build/hidapi-7ca122ca75c788c6/out -L native=/tmp/cargo-installaegHGd/release/build/bzip2-sys-b3b3ad2ef39422cb/out/lib` (signal: 9, SIGKILL: kill)
fanatid commented 2 years ago

Try to build without --locked:

cargo install --git https://github.com/project-serum/anchor anchor-cli
iulianbarbu commented 2 years ago

Try to build without --locked:

cargo install --git https://github.com/project-serum/anchor anchor-cli

This is not working for me. It's not working specifically for arm64/linux target. On arm64/darwin the installation works on my machine.

Any idea where the issue might come from?

iulianbarbu commented 2 years ago

The underlying problem of the compile error above is caused usually by OOM. In my case I compiled anchor-cli under a docker container restricted in terms of CPUs and memory. Once I've loosen the memory restriction on the container the compilation succeeded. @causevic , do you run on a memory restricted system?

causevic commented 2 years ago

Try to build without --locked:

cargo install --git https://github.com/project-serum/anchor anchor-cli

Already tried that and didn't help, unfortunately. Thank you for suggestion.

causevic commented 2 years ago

The underlying problem of the compile error above is caused usually by OOM. In my case I compiled anchor-cli under a docker container restricted in terms of CPUs and memory. Once I've loosen the memory restriction on the container the compilation succeeded. @causevic , do you run on a memory restricted system?

Thank you @iulianbarbu. The RAM was the issue. I'm running it inside Parallels Desktop on an M1 Max with 32GB of memory, but the (default) RAM for Linux box was only 2GB. When I increased that to 8GB in Parallels settings everything works fine. Thanks once more!

ComradePashka commented 2 years ago

@causevic thank you mate, you save my day! I had similar issue with Oracle VirtualBox, increasing RAM upto 4Gb was enough.

I don't really wanted to reopen the issue, however, it would be good to have some meaningful error message in such case, not just "error: failed to compile anchor-cli"