LiteSVM / litesvm

Apache License 2.0
132 stars 24 forks source link

Anchor Build Errors #112

Closed OFUZORCHUKWUEMEKE closed 2 days ago

OFUZORCHUKWUEMEKE commented 4 days ago

Please what version of solana-program and solana-sdk does litesvm support . Im getting a build error when i run anchor build .

    Failed to obtain package metadata: `cargo metadata` exited with an error:     Updating crates.io index
    error: failed to select a version for `solana-program`.
        ... required by package `litesvm v0.3.0`
        ... which satisfies dependency `litesvm = "^0.3.0"` of package `nonce v0.1.0 (/workspace/Nonce-Protocol/programs/nonce)`
    versions that meet the requirements `~2.0.5` are: 2.0.18, 2.0.17, 2.0.16, 2.0.15, 2.0.14, 2.0.13, 2.0.11, 2.0.10, 2.0.9, 2.0.8, 2.0.7, 2.0.6, 2.0.5

    all possible versions conflict with previously selected packages.
OFUZORCHUKWUEMEKE commented 4 days ago

This is my cargo.toml file

[lib]
crate-type = ["cdylib", "lib"]
name = "nonce"

[features]
default = []
cpi = ["no-entrypoint"]
no-entrypoint = []
no-idl = []
no-log-ix-name = []
idl-build = ["anchor-lang/idl-build","anchor-spl/idl-build"]

[dependencies]
anchor-lang = {version="0.30.1",features=["init-if-needed"]}
anchor-spl={version="0.30.1",features=["associated_token"]}
pyth-solana-receiver-sdk = "0.3.2"

[dev-dependencies]
litesvm = "0.3.0"

When I run anchor build I get this error

error: failed to run custom build command for `solana-svm v2.0.18`

Caused by:
  process didn't exit successfully: `/workspace/Nonce-Protocol/target/debug/build/solana-svm-4e39e572dde50176/build-script-build` (exit status: 101)
  --- stdout
  cargo:rustc-cfg=RUSTC_WITH_SPECIALIZATION
  cargo:rerun-if-changed=proto/context.proto
  cargo:rerun-if-changed=proto/invoke.proto
  cargo:rerun-if-changed=proto/sysvar.proto
  cargo:rerun-if-changed=proto/txn.proto

  --- stderr
  thread 'main' panicked at /workspace/.cargo/registry/src/index.crates.io-6f17d22bba15001f/prost-build-0.11.9/src/lib.rs:1457:10:
  Could not find `protoc` installation and this build crate cannot proceed without
      this knowledge. If `protoc` is installed and this crate had trouble finding
      it, you can set the `PROTOC` environment variable with the specific path to your
      installed `protoc` binary.If you're on debian, try `apt-get install protobuf-compiler` or download it from https://github.com/protocolbuffers/protobuf/releases

  For more information: https://docs.rs/prost-build/#sourcing-protoc

  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
Error: Building IDL failed
Aursen commented 4 days ago

You need to execute: sudo apt-get install protobuf-compiler And after you need to use git for now if you want to use 2.1.

[lib]
crate-type = ["cdylib", "lib"]
name = "nonce"

[features]
default = []
cpi = ["no-entrypoint"]
no-entrypoint = []
no-idl = []
no-log-ix-name = []
idl-build = ["anchor-lang/idl-build","anchor-spl/idl-build"]

[dependencies]
anchor-lang = {version="0.30.1",features=["init-if-needed"]}
anchor-spl={version="0.30.1",features=["associated_token"]}
pyth-solana-receiver-sdk = "0.3.2"

[dev-dependencies]
litesvm = "0.3.0" #or { git = "https://github.com/LiteSVM/litesvm" }
solana-sdk = "2.0" #or "2.1"
OFUZORCHUKWUEMEKE commented 3 days ago

Fixed !!! , Thank You very Much. I love LiteSVM , great work guys. Thank You