I'm starting a new Rust project and included the ggez package in Cargo.toml
[package]
name = "Project"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
ggez = "0.8.1"
However, when I run cargo build, I get the following error
error: failed to download `raw-window-handle v0.4.3`
Caused by:
unable to get packages from source
Caused by:
failed to parse manifest at `C:\Users\scout\.cargo\registry\src\github.com-1ecc6299db9ec823\raw-window-handle-0.4.3\Cargo.toml`
Caused by:
could not parse input as TOML
Caused by:
TOML parse error at line 1, column 1
|
1 |
| ^
Unexpected ``
Expected key or end of input
How can I remedy this issue?
I've tried including the raw-window-handle package manually, but I still get the same issue.
Related
I run the command:
cargo install cosmwasm-check
And i get this:
error: failed to compile `cosmwasm-check v1.2.1`, intermediate artifacts can be found at `/tmp/cargo-installF9zQyx`
Caused by:
failed to download `addr2line v0.19.0`
Caused by:
unable to get packages from source
Caused by:
failed to parse manifest at `/home/xxvxrxx/.cargo/registry/src/github.com-1ecc6299db9ec823/addr2line-0.19.0/Cargo.toml`
Caused by:
could not parse input as TOML
Caused by:
TOML parse error at line 1, column 1
|
1 |
| ^
Unexpected ``
Expected key or end of input
Can anyone tell me why is it doing that and how to fix it?
Update
I copied the Toml file from github and now i get the same error but for the next crate in the folder
I just set up a new anchor project yesterday, every command runs smoothly.
Today I installed a new anchor project. I run anchor test to see if the project is set up correctly. I am getting this error:
Failed to obtain package metadata: `cargo metadata` exited with an error: Updating crates.io index
error: failed to select a version for the requirement `anchor-lang = "^0.23.0"`
candidate versions found which didn't match: 0.24.2
location searched: crates.io index
required by package `myAnchorProject v0.1.0 (.../programs/myAnchorProject)`
It is not clear what candidate versions mean. I deleted node_modules and install it with "#project-serum/anchor": "^0.24.2", still same error.
I clear the lib.rs and testing file to see something different, but it still gives the same error.
executing cargo update is giving same error
It's not the problem with dependency in your package.json is due to the use of yanked rust crate anchor-lang
all the other version the 0.24.2 have been yanked so you can't build any cargo project which has yanked dependeny.
refer here https://crates.io/crates/anchor-lang/versions
what you need to do get it working is
go to <your-project-root>/programs/myAnchorProject/cargo.toml.
I'm assuming your program name is myAnchorProject or replace it with your program name.
your current cargo.toml must look something like
...
<other content goes here>
...
[dependencies]
anchor-lang = "^0.23.0"
you need to upgrade the anchor-lang version to 0.24.2 or any other version if available which is not yanked.
so your final cargo.toml should look like
...
<other content goes here>
...
[dependencies]
anchor-lang = "^0.24.2"
I am trying to build a gtk-4 GUI application with the Rust in VScode, but I am unable to because I can't build my project. What could be the problem? How do I fix it?
Here's the error
fatal error LNK1181: cannot open input file 'gobject-2.0.lib'
My Cargo.toml
[package]
name = "my-gtk-app"
version = "0.1.0"
edition = "2021"
[dependencies]
gtk = { version = "0.4.7", package = "gtk4", features = ["v4_6"]}
Building the project as an administrator fixed the problem.
When I run the build command
cargo build-bpf --manifest-path=Cargo.toml --bpf-out-dir=dist/program
error: failed to download solana-frozen-abi v1.7.9
Caused by:
unable to get packages from source
Caused by:
failed to parse manifest at /home/USER/.cargo/registry/src/github.com-1ecc6299db9ec823/solana-frozen-abi-1.7.9/Cargo.toml
Caused by:
feature resolver is required
There have been people with similar issues but the cause was old rustc version. Mine looks ok
rustc --version
rustc 1.55.0-nightly (7c3872e6b 2021-06-24)
cargo --version
cargo 1.55.0-nightly (9233aa06c 2021-06-22)
My Cargo.toml file looks like
[package]
name = "test"
version = "0.0.1"
edition = "2018"
exclude = ["tests/**"]
[features]
no-entrypoint = []
test-bpf = []
[dependencies]
borsh = "0.8.2"
num-derive = "0.3"
num-traits = "0.2"
solana-program = "1.6.10"
spl-token = { version="3.1.1", features = [ "no-entrypoint" ] }
thiserror = "1.0"
[dev-dependencies]
solana-program-test = "1.6.10"
solana-sdk = "1.6.10"
[lib]
crate-type = ["cdylib", "lib"]
I have downloaded the metaplex rust code (exact same dependencies) and the build bpf command compiles successfully.
I have also tried running cargo clean which doesnt change anything.
I fixed it by updating to the latest version (1.7.9) of Solana (which is not the release version):
sh -c "$(curl -sSfL https://release.solana.com/v1.7.9/install)"
The same inputs from Cargo.toml do not mean the the Rust build will be repeatable on other machines — Cargo.lock contains the exact versions used. Additionally, cargo clean doesn't remove Cargo.lock
https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
I am attempting to replicate code I found in a tutorial. I am using the following dependencies in my Cargo.toml file:
[dependencies]
iron = "0.5.1"
mime = "0.2.3"
router = "0.5.1"
urlencoded = "0.5.0"
I receive the following error message when I execute cargo run from the project's src directory:
Updating registry `https://github.com/rust-lang/crates.io-index`
An unknown error occurred
It hangs at "Updating registry" for roughly 15 minutes before the error appears. I would guess versioning as the issue, however the tutorial that I am using directly states that they included them as a way to avoid version mismatch with the example code.
I attempted to search for an answer but the error code is too vague to find anything.
The results of cargo run --verbose added:
Caused by:
the given version requirement is invalid
I am now getting:
failed to parse registry's information for: serde_json
and
failed to parse registry's information for: serde
when I compile/run with cargo with my listed dependencies and with "*" as the version, respectively.