Questions tagged [cargo]
The cargo tag has no usage guidance.
66 questions
0
votes
0
answers
13
views
Error when trying anchor build
I have been running to a parse error - when running anchor build, I was able to solve this by downloading a previous version of cargo, solana and rust, for some reason the current cargo file as a sync/...
1
vote
0
answers
22
views
Running anchor build doesnt give any errors
Hello i am quite new to solana development and i am currently following the Solana Bootcamp https://www.youtube.com/watch?v=amAq-WHAFs8&t=5800s
In the solana bootcamp the nightly compiler ...
1
vote
2
answers
28
views
How To Uninstall Anchor?
My anchor keyfiles are messed up I think, and it's not solved with anchor clean so I want to completely uninstall the anchor-cli.
When I run which anchor I see that it is installed via cargo:
/Users/...
1
vote
1
answer
43
views
How to solve the cargo build-sbf error?
I have just started with rust and solana.
Firstly, I created a solana program using the command:
cargo init hello_world --lib
everything ran fine, and then i read from the official docs, to build i ...
2
votes
1
answer
43
views
Linker error when trying to run cargo test for the CLI in agave repository
Im trying to run the tests in https://github.com/anza-xyz/agave/tree/master/cli using cargo test
But i'm getting some linker errors:
--- stderr
ld: warning: -bind_at_load is deprecated on macOS
ld:...
0
votes
1
answer
47
views
cargo.toml many versions error? (master + v2.0)
I am new to Solana and Rust, I took latest from https://github.com/solana-labs/solana.git
I open cargo.toml (I tried "master" and "v2.0" branch) from VSCode, many versions errors.
...
0
votes
1
answer
46
views
Could not compile `pyth-solana-receiver-sdk` (lib) due to 4 previous errors
I have build problem with the pyth-solana-receiver-sdk basic example.
It is a single file lib.rs program running on WSL2.
Cargo (anchor) build fails with this error:
6 | #[account]
| ^^^^^^^^^^ ...
0
votes
1
answer
45
views
Error in building project with Anchor
Hello and thanks for your help in advance!
I am having an issue building my project, here is the background:
Fedora Linux v.39
rustc 1.78.0
solana-cli 1.18.24 (src:6b04e881; feat:3241752014, client:...
2
votes
3
answers
420
views
Anchor: Cargo Build Failed to install platform-tools
I get this error when running anchor test:
**uanadev@DESKTOP-ED77BQ8:~/workspace/temp-project$ anchor test
[2024-09-11T00:53:29.312271366Z ERROR cargo_build_sbf] Failed to install platform-tools: ...
2
votes
1
answer
73
views
Checking presence of Memo within a transaction with Solana-SDK
I am currently attempting to figure out a way to check for the presence of a specific memo within a transaction using just the Solana-SDK or any off-chain-based Rust crates.
Below is code that is ...
1
vote
1
answer
145
views
error: failed to run custom build command for `etcd-client v0.11.1`
Getting error on a fresh build of agave.
$cargo build
error: failed to run custom build command for `etcd-client v0.11.1`
Caused by:
process didn't exit successfully: `/home/sol/src/agave/target/...
0
votes
0
answers
25
views
How to airdrop sols in Rust test case using tokio framework
I am working over the airdrop over a particular Keypair to perform testing using rust. Signature is being generated but Transaction is not confirmed
#[cfg(test)]
// pub mod utils;
mod tests {
use ...
1
vote
1
answer
31
views
Cargo complaning about unmatchable version requirements with `pyth-solana-receiver-sdk` and `serde_with` crates
I'm Elio, founder at Intrant Inferis Solana mobile RPG
error: failed to select a version for the requirement `serde_with = "^2.3.3"`
candidate versions found which didn't match: 1.14.0, 1.13....
2
votes
1
answer
439
views
Got error "account data too small for instruction" when run Anchor deploy?
Sometimes I got this error when deploy program with running "anchor deploy":
Error: Deploying program failed: RPC response error -32002: Transaction simulation failed: Error processing ...
2
votes
1
answer
69
views
Pyth V2 migration for projects with older dependencies (pull oracles)
At the end of June 2024, Pyth push oracles will be discontinued, so all programs that currently use them must migrate to pull oracles.
The drop-in replacement is to consume Price Feed Accounts. To use ...
1
vote
0
answers
58
views
The trait `borsh::de::BorshDeserialize` is not implemented for `T`
having this issue for the past 2 days with no way of resolving it..
Cargo.toml :
name = "mint-nft"
version = "0.1.0"
description = "Created with Anchor"
edition = "...
2
votes
2
answers
136
views
keep getting this error on a fresh ubuntu 24 lts, although my rustc version is 1.78.0
error: package solana-program v1.18.14 cannot be built because it requires rustc 1.75.0 or newer, while the currently active rustc version is 1.68.0-dev
Either upgrade to rustc 1.75.0 or newer, or use
...
0
votes
0
answers
59
views
problem building new project
Hello i have Apple M2 Pro, with a local solana-test-validator running. I created new wallet and i can airdrop sol and check my balance.
solana-cli 1.17.25
rustup 1.27.1 (54dd3d00f 2024-04-24)
info: ...
2
votes
3
answers
2k
views
anchor build fails with 'no such command: `build-sbf`', but I can see build-sbf is installed
I've installed Rust, Solana 1.18 (currently in beta) and Anchor 0.30.
On a new project:
anchor init project
cd project
anchor build
fails with:
error: no such command: `build-sbf`
View all ...
1
vote
1
answer
216
views
I am getting a compile error: target not supported when trying to compile Solana hello world smart contract
So I'm trying to compile my first Solana smart contract. It's this hello world smart contract:
https://github.com/solana-labs/example-helloworld
Here is my rustc and cargo version:
candid@DESKTOP-...
1
vote
0
answers
94
views
cargo build-bpf doesnt work
and error message is
error: package solana-program v1.18.11 cannot be built because it requires rustc 1.75.0 or newer, while the currently active rustc version is 1.72.0-dev
Either upgrade to rustc 1....
1
vote
1
answer
528
views
How do I resolve the anchor build error: Failed to obtain package metadata
I created a project with the command: anchor init solanasc and I receive this error when I run anchor build
ERROR cargo_build_sbf] Failed to obtain package metadata: `cargo metadata` exited with an ...
5
votes
2
answers
211
views
What's the benefit of using platform-tools compared to Rust's upstream bpfel-unknown-none target?
The fact that Solana's CLI installer shipped (and still ships) with a nearly year-long outdated version of platform-tools has been a pain point with the previous Solana team I've worked with. platform-...
0
votes
1
answer
157
views
Trouble Adding Cargo.toml File to Solana Playground
I'm currently working on converting my Solidity-based implementation to Rust within the Solana Playground environment. I understand that I need to use a Cargo.toml file to manage dependencies, but I'm ...
0
votes
0
answers
30
views
cargo build-sbf no such command: `+solana` [duplicate]
$ cargo build-sbf
info: uninstalling toolchain 'solana'
info: toolchain 'solana' uninstalled
error: no such command: '+solana'
Cargo does not handle `+toolchain` directives. Did you mean to
...
1
vote
2
answers
516
views
package `bumpalo v3.15.2` cannot be built because it requires rustc 1.73.0 or newer, while the currently active rustc version is 1.72.0-dev
package bumpalo v3.15.2 cannot be built because it requires rustc 1.73.0 or newer, while the currently active rustc version is 1.72.0-dev
Either upgrade to rustc 1.73.0 or newer, or use
cargo update -...
2
votes
1
answer
515
views
Cannot compile `solana-program` crate with new `sqlx` versions
For some reason when trying to compile a project having both sqlx and solana-program I get an error on package version mismatches, which is strange, because those should come from different crates and ...
0
votes
1
answer
39
views
solana$ ./cargo test => "error: test failed, to rerun pass `-p solana-cli --test program`" : arguments passed solve nothing
I have a problem when testing the solana chain. I successfully built the solana repo, but after if i do a ./cargo test, i fall on this error:
error: test failed, to rerun pass `-p solana-cli --test ...
0
votes
1
answer
463
views
solana$ ./cargo build => "error: linking with `cc` failed: exit status: 1"
I try to install the Solana chain locally but when I execute the ./cargo build command, i fall on this fail: error: linking with `cc` failed: exit status: 1
But if I do a ./cargo build --release i ...
1
vote
2
answers
213
views
cargo build-bpf in a sandbox environment
Based on the docs in order to compile the sample application, we need to use cargo build-bpf. Unfortunately this tool attempts to access the internet in order to download the platform tools.
Are there ...
1
vote
1
answer
172
views
cargo build-bpf failed
When I execute the command cargo build-bpf, I encounter an error. How can I resolve this issue?
error: target is not supported, for more information see: https://docs.rs/getrandom/#unsupported-targets
...
1
vote
1
answer
609
views
The trait `borsh::de::BorshDeserialize` is not implemented for `T` problem
Im trying to compile in rust a code to mint a candy machine directly, but after I put the dependecies in Cargo.toml it still giving me this error.
My Cargo.toml:
[package]
name = "mint_project&...
0
votes
2
answers
2k
views
cargo build-bpf no such command: `+solana` running build:program-rust
Ran the code npm run build:program-rust getting this error
I've tried uninstalling and reinstalling rustup and also solana tool chain still nothing
[email protected] build:program-rust
cargo build-bpf ...
0
votes
1
answer
500
views
Rust build fails - cannot find libssl.so
The build fails due to error
/home/dev/.rustup/toolchains/bpf/bin/cargo: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
OpenSSL and ...
3
votes
3
answers
4k
views
cargo build-bpf no such command: `+solana`
I used the official documentation.
Install the latest Rust stable from https://rustup.rs/ .
Install the latest Solana command-line tools.
But when i try cargo build-bpf in command line in windows 10 i ...
1
vote
1
answer
207
views
Cannot perform a CPI call using anchor
I tried to make a CPI call from puppret_master to puppet program exactly like the anchor document and i did everything right but "program" AND "cpi" keywords are still unkown for ...
4
votes
3
answers
153
views
Unable to build a binary
Both anchor build and cargo-build-sbf throw:
Warning: cargo-build-bpf is deprecated. Please, use cargo-build-sbf
cargo-build-bpf child: /Users/usr1/solana/bin/cargo-build-sbf --arch bpf
error: package ...
3
votes
4
answers
661
views
Error when anchor build - package `constant_time_eq v0.3.0` cannot be built
I'm trying to build using anchor but there seems to be this error
error: package `constant_time_eq v0.3.0` cannot be built because it requires rustc 1.66.0 or newer, while the currently active rustc ...
0
votes
1
answer
185
views
failed to complete: Instruction passed to inner instruction is too large (12884932868 > 1280)
I am trying to optimize size of my code by moving logic to freeze and approve in a separate file. However when I deploy and try to call my contract, I am getting error:
'Program ...
0
votes
2
answers
4k
views
WSL_Ubuntu: 'hello-solana': error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
I have seen much around this libssl.so.1.1 issue but no resolution so starting a new thread. Does anyone have line of sight into this issue? I have attempted all suggested fixes in related posts ...
3
votes
1
answer
373
views
Getting error while compiling the program
Hey I am facing this error
error[E0658]: let...else statements are unstable
--> /home/asus/.cargo/registry/src/github.com-1ecc6299db9ec823/solana-frozen-abi-macro-1.16.0/src/lib.rs:422:5
|
...
4
votes
3
answers
634
views
Error when anchor build - package `toml_datetime v0.6.2` cannot be built
I'm trying to build using anchor but there seems to be this error
error: package `toml_datetime v0.6.2` cannot be built because it requires rustc 1.64.0 or newer, while the currently active rustc ...
2
votes
1
answer
1k
views
libssl.so.1.1 not found when running anchor test in Kali Linux [duplicate]
I'm getting the following messages and error when running anchor test in Kali Linux:
anchor test
BPF SDK: /home/...
1
vote
1
answer
291
views
Anchor: How to know instruction number without having to run "cargo expand"?
I have a Tic Tac Toe game contract which looks like this:
#[program]
pub mod tic_tac_toe {
use super::*;
pub fn start_game(ctx: Context<StartGame>) -> Result<()> {
...
1
vote
1
answer
39
views
Why can't the Solana validator code base be built with its own tooling?
I am at commit 67d3beeb35e62b8a04b1e511a5917a205db622df. Recent rustup has installed rustc 1.67.0 (fc594f156 2023-01-24), and cargo 1.67.0 (8ecd4f20a 2023-01-10). However, the version of rustc and ...
0
votes
1
answer
36
views
Cargo complaning about unmatchable version requirements, even though matching versions exist
I'm trying to run anchor build on a workspace and receiving errors about a supposedly unmatchable version requirement for the crate "time", even though matching versions exist locally:
As ...
2
votes
1
answer
173
views
Depencencies in Cargo.toml file Solana-SDK and Solana-Client doesn't work
Hello I am trying desperately to use solana-sdk and solana-client but when I do cargo build-bpf it doesn't work. Can someone help me please?
When I use only solana-client as a dependency the ...
1
vote
1
answer
176
views
Solana-SDK and Solana-Client doesn't work as a dependencies
Hello I am trying desperately to use solana-sdk and solana-client but when I do cargo build-bpf it doesn't work. Can someone help me please?
If I specify only solana-client and solana-sdk, I get this ...
1
vote
1
answer
339
views
`Anchor build`: failed to select a version for the requirement `rust_decimal = "..."
Both anchor build and cargo build-bpf fail with:
BPF SDK: /home/fish/.local/share/solana/install/releases/1.9.29/solana-release/bin/sdk/bpf
cargo-build-bpf child: rustup toolchain list -v
cargo-build-...
2
votes
2
answers
2k
views
Solana Helloworld example stuck on cargo build bpf without error message
I'm in the process of deploying the Solana helloworld example smart contract on Ubuntu 20.04. When running npm run build:program-rust, the package.json in the root of the repository states that this ...