Skip to content

solana-verify fails to build anchor program #35

@omarkilani

Description

@omarkilani

I'm trying to verify an anchor program: mtly_reward_center

The command line I'm using:

solana-verify verify-from-repo --program-id rwdD3F6CgoCAoVaxcitXAeWRjQdiGc5AVABKCpQSMfd https://github.com/motleylabs/reward-center-program.git --commit-hash 4dee91ee12b8b65c9f0639d998cb30a8e8b6f42d --library-name mtly_reward_center --bpf

The solana-verify output:

Cloning repo into: /tmp/solana-verify/55c5181b-1105-4595-96dd-9e1fdcd8454e/reward-center-program.git
Checked out commit hash: 4dee91ee12b8b65c9f0639d998cb30a8e8b6f42d
Build path: "/tmp/solana-verify/55c5181b-1105-4595-96dd-9e1fdcd8454e/reward-center-program.git/"
Verifying program: mtly_reward_center
Mounting path: /tmp/solana-verify/55c5181b-1105-4595-96dd-9e1fdcd8454e/reward-center-program.git/
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Workdir: /workdir
Building program at /workdir//program/
Building manifest path: /workdir//program/Cargo.toml
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
error: could not find `Cargo.toml` in `/workdir` or any parent directory
Finished fetching build dependencies
BPF SDK: /root/.local/share/solana/install/releases/1.13.5/solana-release/bin/sdk/bpf
cargo-build-bpf child: rustup toolchain list -v
cargo-build-bpf child: cargo +bpf build --target bpfel-unknown-unknown --release --locked --frozen --manifest-path /workdir//program/Cargo.toml
error: failed to get `env_logger` as a dependency of package `mtly-reward-center v0.2.9 (/workdir/program)`

Caused by:
  attempting to make an HTTP request, but --frozen was specified
Finished building program
Program Solana version: v1.9.29
Docker image Solana version: v1.13.5
Stopping container 70099221d5de5b3fbd249be4f44dac8b712bab34273bcaae18074402df5b3edf
Stopped container 70099221d5de5b3fbd249be4f44dac8b712bab34273bcaae18074402df5b3edf
Removing temp dir /tmp/solana-verify/55c5181b-1105-4595-96dd-9e1fdcd8454e
Removed temp dir /tmp/solana-verify/55c5181b-1105-4595-96dd-9e1fdcd8454e
Error: Error verifying program. Err(Failed to parse output)

Trying to run solana-verify build --bpf in the program directory also fails:

Mounting path: /Users/omar/src/motleylabs/reward-center-program/program
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Workdir: /workdir
Building program at /workdir/
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
    Updating crates.io index
error: failed to get `mpl-testing-utils` as a dependency of package `mtly-reward-center v0.2.9 (/workdir)`

Caused by:
  failed to load source for dependency `mpl-testing-utils`

Caused by:
  Unable to update /testing-utils

Caused by:
  failed to read `/testing-utils/Cargo.toml`

Caused by:
  No such file or directory (os error 2)
Finished fetching build dependencies
Failed to obtain package metadata: `cargo metadata` exited with an error: error: failed to get `mpl-testing-utils` as a dependency of package `mtly-reward-center v0.2.9 (/workdir)`

Caused by:
  failed to load source for dependency `mpl-testing-utils`

Caused by:
  Unable to update /testing-utils

Caused by:
  failed to read `/testing-utils/Cargo.toml`

Caused by:
  No such file or directory (os error 2)
Finished building program
Program Solana version: v1.14.17
Docker image Solana version: v1.13.5

I think due to a dev dependency using a path:

mpl-testing-utils= { path = "./../testing-utils" }
anchor build --verifiable

Runs successfully with output:

Using image "projectserum/build:v0.27.0"
Run docker image
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
ca412c16e78dc46d37b0fdbc5ecdefe798950fa124813dce17739f0f3a7f43d8
Building mtly_reward_center manifest: "program/Cargo.toml"
Warning: cargo-build-bpf is deprecated. Please, use cargo-build-sbf
cargo-build-bpf child: /root/.local/share/solana/install/active_release/bin/cargo-build-sbf --manifest-path program/Cargo.toml --arch bpf
   Compiling proc-macro2 v1.0.51
   Compiling unicode-ident v1.0.8
   Compiling quote v1.0.23
   Compiling syn v1.0.109
   Compiling version_check v0.9.4
   Compiling serde_derive v1.0.154
   Compiling typenum v1.16.0
   Compiling serde v1.0.154
   Compiling autocfg v1.1.0
   Compiling thiserror v1.0.39
   Compiling serde_json v1.0.94
   Compiling semver v1.0.16
   Compiling libc v0.2.140
   Compiling anyhow v1.0.69
   Compiling subtle v2.4.1
   Compiling once_cell v1.17.1
   Compiling rustversion v1.0.12
   Compiling feature-probe v0.1.1
   Compiling cfg-if v1.0.0
   Compiling log v0.4.17
   Compiling itoa v1.0.6
   Compiling ryu v1.0.13
   Compiling bs58 v0.4.0
   Compiling lazy_static v1.4.0
   Compiling constant_time_eq v0.2.4
   Compiling arrayref v0.3.6
   Compiling arrayvec v0.7.2
   Compiling either v1.8.1
   Compiling keccak v0.1.3
   Compiling hashbrown v0.12.3
   Compiling opaque-debug v0.3.0
   Compiling unicode-segmentation v1.10.1
   Compiling cpufeatures v0.2.5
   Compiling winnow v0.3.5
   Compiling toml_datetime v0.6.1
   Compiling bs58 v0.3.1
   Compiling base64 v0.13.1
   Compiling memchr v2.5.0
   Compiling paste v1.0.12
   Compiling byteorder v1.4.3
   Compiling regex-syntax v0.6.28
   Compiling assert_matches v1.5.0
   Compiling generic-array v0.14.6
   Compiling ahash v0.7.6
   Compiling num-traits v0.2.15
   Compiling memoffset v0.6.5
   Compiling indexmap v1.9.2
   Compiling bv v0.11.1
   Compiling itertools v0.10.5
   Compiling heck v0.3.3
   Compiling rustc_version v0.4.0
   Compiling jobserver v0.1.26
   Compiling aho-corasick v0.7.20
   Compiling cc v1.0.79
   Compiling hashbrown v0.11.2
   Compiling solana-frozen-abi-macro v1.14.17
   Compiling solana-frozen-abi v1.14.17
   Compiling regex v1.7.1
   Compiling toml_edit v0.19.4
   Compiling digest v0.9.0
   Compiling block-buffer v0.9.0
   Compiling blake3 v1.3.3
   Compiling solana-program v1.14.17
   Compiling block-buffer v0.10.4
   Compiling crypto-common v0.1.6
   Compiling sha2 v0.9.9
   Compiling digest v0.10.6
   Compiling proc-macro-crate v1.3.1
   Compiling rmp v0.8.11
   Compiling borsh-schema-derive-internal v0.9.3
   Compiling borsh-derive-internal v0.9.3
   Compiling sha2 v0.10.6
   Compiling sha3 v0.10.6
   Compiling thiserror-impl v1.0.39
   Compiling bytemuck_derive v1.4.0
   Compiling solana-sdk-macro v1.14.17
   Compiling num-derive v0.3.3
   Compiling num_enum_derive v0.5.11
   Compiling anchor-derive-space v0.27.0
   Compiling mpl-token-metadata-context-derive v0.2.1
   Compiling bytemuck v1.13.1
   Compiling num_enum v0.5.11
   Compiling toml v0.5.11
   Compiling shank_macro_impl v0.0.11
   Compiling serde_bytes v0.11.9
   Compiling bincode v1.3.3
   Compiling rmp-serde v1.1.1
   Compiling anchor-syn v0.27.0
   Compiling proc-macro-crate v0.1.5
   Compiling shank_macro v0.0.11
   Compiling borsh-derive v0.9.3
   Compiling anchor-attribute-program v0.27.0
   Compiling anchor-derive-accounts v0.27.0
   Compiling anchor-attribute-error v0.27.0
   Compiling anchor-attribute-constant v0.27.0
   Compiling anchor-attribute-access-control v0.27.0
   Compiling anchor-attribute-account v0.27.0
   Compiling anchor-attribute-event v0.27.0
   Compiling shank v0.0.11
   Compiling borsh v0.9.3
   Compiling solana-zk-token-sdk v1.14.17
   Compiling spl-token v3.5.0
   Compiling spl-memo v3.0.1
   Compiling anchor-lang v0.27.0
   Compiling mpl-token-auth-rules v1.2.0
   Compiling spl-token-2022 v0.5.0
   Compiling mpl-utils v0.1.0
   Compiling spl-associated-token-account v1.1.2
   Compiling mpl-token-metadata v1.10.0
   Compiling anchor-spl v0.27.0
   Compiling mtly-auction-house v1.4.8
   Compiling mtly-reward-center v0.2.9 (/workdir/program)
    Finished release [optimized] target(s) in 1m 32s

Copying out the build artifacts
                                               Successfully copied 658kB to /Users/omar/src/motleylabs/reward-center-program/target/verifiable/mtly_reward_center.so
Cleaning up the docker target directory
Removing the docker container
anchor-program
Extracting the IDL
Writing the IDL file
Writing the .ts file
Build success

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions