I am trying to import some primitives into pallet in substrate but when I execute cargo check I get this error: failed to load manifest for dependency 'name of primitives'
Dex pallet: https://github.com/Kabocha-Network/cumulus/tree/v0.9.13-elio/pallets/dex
Can somebody please take a look and let me know. Thank you in advance.
if you run cargo check you get:
error: failed to load manifest for workspace member `/root/cumulus/pallets/dex`
Caused by:
failed to load manifest for dependency `acala-primitives`
Caused by:
failed to load manifest for dependency `module-evm-utiltity`
Caused by:
failed to read `/root/cumulus/primitives/modules/evm-utiltity/Cargo.toml`
Caused by:
No such file or directory (os error 2)
The problem is that /root/cumulus/primitives/modules/evm-utiltity/Cargo.toml, is not found because you haven't included this pallet locally or the pallet is misplaced and located somewhere else.
Simple solutions:
1. Locate and correct
Find where the pallet is and correctly link to it, or import the pallet to the location root/cumulus/primitives/modules/evm-utiltity/Cargo.toml so it can be found.
2. Externally linking rather than importing pallets locally.
You can link to the pallet from its external source rather than importing it locally, otherwise you will find you need to take many more dependencies and store them locally just like the /root/cumulus/primitives/modules/evm-utiltity/Cargo.toml mentioned above in the error.
What you can do instead is:
Go directly to the runtime directory, which is /root/cumulus/parachain-template/runtime/Cargo.toml and link to the external dex directly from github.com/acala-network/acala
something like this:
[dependencies.pallet-dexl]
default-features = false
git = 'https://github.com/Acala-Network/acala.git'
branch = polkadot-v0.9.13
version = '3.0.0'
or actually it is still using the older dependency version, which will be like:
pallet-dex = { git = "https://github.com/Acala-Network/acala", default-features = false, branch = "polkadot-v0.9.13" }
and more specifically for this error:
module-evm-utlity = { git = "https://github.com/Acala-Network/acala", default-features = false, branch = "polkadot-v0.9.13" }
but if you link to pallet-dex from its external source, the error should disappear and you will probably not need to link acala-primitives or module-evm-utility.
https://docs.substrate.io/how-to-guides/v3/basics/pallet-integration/
also, evm-utiltity is not spelled correctly (utility).
My fix for this error was setting the correct branch value, from .17 to .18 in my pallets cargo.toml file. For the sp-io dependency I had branch = "polkadot-v0.9.17" which didn't match the polkadot-v0.9.18 version every other dependency is on.
Original with problem on sp-io (last line)
[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [
"derive",
] }
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
frame-support = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18"}
frame-system = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18" }
frame-benchmarking = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18", optional = true }
sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.17" }
Fix (sp-io)
sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18" }
Now the "branch" matches with everything else and my errors are gone! Back to the Substrate Kitties tutorial I go!
Related
I am getting some dependencies version errors in rust.
I am fairly new to rust so I do not have any idea how to check for compatible updates between multiple dependencies.
It will be great if someone can resolve this issue and let me know how to manage dependencies.
Cargo.toml:
[package]
name = "chatbot"
version = "0.2.3"
authors = ["Joe Wilm <joe#jwilm.com>"]
license = "MIT"
description = "An extensible chatbot"
documentation = "https://docs.rs/chatbot"
repository = "https://github.com/jwilm/chatbot"
keywords = ["chat", "bot", "extensible"]
readme = "README.md"
[package.metadata.docs.rs]
all-features = true
[dependencies]
regex = "0.1"
rustc-serialize = "0.3"
getopts = "0.2"
irc = { version = "0.12", optional = true }
slack = { version = "0.18.0", optional = true }
[features]
default = []
irc-adapter = ["irc"]
slack-adapter = ["slack"]
I tried with versions suggested by VS Code but it did not work.
Error which I am getting after I do cargo-run is:
failed to select a version for the requirement `security-framework
= "^0.1.13"`
candidate versions found which didn't match: 2.8.2, 2.8.1, 2.8.0, ...
location searched: crates.io index
required by package `native-tls v0.1.2`
... which satisfies dependency `native-tls = "^0.1.2"` of package `tungstenite v0.2.0`
... which satisfies dependency `tungstenite = "^0.2.0"` of package `slack v0.18.0`
... which satisfies dependency `slack = "^0.18.0"` of package `chatbot v0.2.3
You are using old versions of the slack and irc crates. Both depend on an old version of native-tls (v0.1) in their dependency trees. native-tls v0.1 depends on a very old version of the security-framework crate (v0.1). All versions of security-framework v0.1 have been yanked from crates.io, see here: https://crates.io/crates/security-framework/versions. I assume this is due to a security issue in those versions. Because the v0.1 version of security-framework is yanked, you can't download it from crates.io anymore, causing the dependency error during compilation.
You can fix this by updating your irc and slack dependencies to their latest versions:
[package]
name = "chatbot"
version = "0.2.3"
authors = ["Joe Wilm <joe#jwilm.com>"]
license = "MIT"
description = "An extensible chatbot"
documentation = "https://docs.rs/chatbot"
repository = "https://github.com/jwilm/chatbot"
keywords = ["chat", "bot", "extensible"]
readme = "README.md"
[package.metadata.docs.rs]
all-features = true
[dependencies]
regex = "0.1"
rustc-serialize = "0.3"
getopts = "0.2"
irc = { version = "0.15", optional = true }
slack = { version = "0.25", optional = true }
[features]
default = []
irc-adapter = ["irc"]
slack-adapter = ["slack"]
Be aware that updating these dependencies is likely to break your code, since there are probably API changes in between your current and the latest version of these crates.
Just update your dependencies especially
[dependencies]
irc = { version = "0.15.0", optional = true }
slack = { version = "0.25.0", optional = true }
seem to be troublesome.
Suppose I want to install the following dependency in my project:
[dependencies]
multi-party-ecdsa = { git = "https://github.com/ZenGo-X/multi-party-ecdsa.git", rev =
"3e711c792db06aaeeac5694b137d24f7551069d1"}
which builds it with cargo build command.
I would like this instead: cargo build --no-default-features --features curv-kzen/num-bigint. Is it possible without doing it manually?
[dependencies]
multi-party-ecdsa = { git = "https://github.com/zengo-x/multi-party-ecdsa.git", rev = "3e711c792db06aaeeac5694b137d24f7551069d1", default-features = false }
curv-kzen = { version = "*", default-features = false, features = ["num-bigint"] }
This should work.
Im having some problems compiling a Rust lambda. The problems started after I included the rusoto package, and it is complaining about linker problems (options and libraries).
Im running:
cargo lambda build
Getting:
= note: warning: unsupported linker arg: -znoexecstack
warning: unsupported linker arg: -zrelro
warning: unsupported linker arg: -znow
ld.lld: error: unable to find library -lssl
ld.lld: error: unable to find library -lcrypto
My Cargo.toml:
[package]
name = "super-lambda"
version = "0.1.0"
edition = "2021"
# Starting in Rust 1.62 you can use `cargo add` to add dependencies
# to your project.
#
# If you're using an older Rust version,
# download cargo-edit(https://github.com/killercup/cargo-edit#installation)
# to install the `add` subcommand.
#
# Running `cargo add DEPENDENCY_NAME` will
# add the latest version of a dependency to the list,
# and it will keep the alphabetic ordering for you.
[dependencies]
lambda_http = "0.7"
lambda_runtime = "0.7"
lazy_static = "1.4.0"
rusoto_core = "0.48.0"
rusoto_dynamodb = "0.48.0"
serde = "1.0.149"
tokio = { version = "1", features = ["macros"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
I did try to disable the zig-linker:
cargo lambda build --disable-zig-linker
Then it compiles, but AWS will complain:
/var/task/bootstrap: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory
What can I do to resolve this?
Cargo-lambda will do a cross-compilation targeting x86_64-unknown-linux-gnu. To avoid relying on a libssl dependency, you can try building the project using rustls for rusoto. You should be able to enable rustls feature for rusoto as follows:
rusoto_core = {version = "0.48.0", features = ["rustls"], default-features = false}
rusoto_dynamodb = {version = "0.48.0", features = ["rustls"], default-features = false}
You can also see this GitHub issue which relates to this topic.
If you are on Linux, you might try to install libssl-dev and try to build it again. However, in my experience, zigbuild (used by cargo-lambda for cross-compilation) might struggle to find this dependency.
I am trying to integrate rust-gpu into a project. The docs explain how to use it as a build dependency but the examples use it as a straight dependency, I have struggled with both but I would prefer to get the dependency version to work as it's more suited for my purposes.
I downloaded the rust-gpu git repo and compiled the ash example, which runs.
This is the toml I used for compilation:
[package]
name = "example-runner-ash"
version = "0.0.0"
authors = ["Embark <opensource#embark-studios.com>"]
edition = "2021"
license = "MIT OR Apache-2.0"
publish = false
# See rustc_codegen_spirv/Cargo.toml for details on these features
[features]
default = ["use-compiled-tools"]
use-installed-tools = ["spirv-builder/use-installed-tools"]
use-compiled-tools = ["spirv-builder/use-compiled-tools"]
[dependencies]
ash = "0.35"
ash-window = "0.9"
winit = "0.26"
structopt = "0.3.20"
cfg-if = "1.0.0"
shared = { path = "../../shaders/shared" }
spirv-builder = { path = "../../../crates/spirv-builder", default-features = false }
# TODO: Remove this once no longer needed, only needed to make cargo-deny happy for some reason.
# https://rustsec.org/advisories/RUSTSEC-2021-0119
nix = "0.20.2"
[target.'cfg(target_os = "macos")'.dependencies]
ash-molten = { version = "0.12.0", features = ["pre-built"] }
So I thought if I did something similar on my own code it would work:
[package]
name = "vulkan_bindings"
version = "0.1.0"
edition = "2021"
[features]
default = ["use-compiled-tools"]
use-installed-tools = ["spirv-builder/use-installed-tools"]
use-compiled-tools = ["spirv-builder/use-compiled-tools"]
[dependencies]
ash = { version = "0.37.0" }
glfw = { version = "0.45.0", features = ["vulkan"] }
gpu-allocator = "0.18.0"
ash-window = "0.9"
winit = "0.26"
structopt = "0.3.20"
cfg-if = "1.0.0"
# shared = { path = "../../shaders/shared" }
spirv-builder = { path = "rust-gpu/crates/spirv-builder", default-features = false }
paste = "1.0.8"
termcolor = "1.1.3"
But this fails with a multiplicity of errors, the first of which is:
error[E0432]: unresolved import `rustc_codegen_ssa::METADATA_FILENAME`
--> /home/makogan/.cargo/git/checkouts/rust-gpu-e0a37a82a46176e6/8052971/crates/rustc_codegen_spirv/src/link.rs:9:52
|
9 | use rustc_codegen_ssa::{CodegenResults, NativeLib, METADATA_FILENAME};
| ^^^^^^^^^^^^^^^^^ no `METADATA_FILENAME` in the root
Not that I am pointing my project to the spirv-builder crate in the rust-gpu repo I downloaded, which worked for the ash example.
I also tried just following the instructions in the docs
So I declared spirv-builder as a build-dependency (using the git link) and I made a build.rs build script and copy pasted the snippet in the docs, as described.
I get the same error about missing METADATA_FILENAME.
I do have a rust-toolchain file setup just like the docs mentioned, and I tried switching the edition field in the toml to 2018, but I consistently get the same error.
I am nto sure what to do now.
I need to build the rustc compiler using a modified libc crate. I cloned the libc directory and made the changes, now how do I include the modified libc in my build?
This is my Cargo.toml
[patch.crates-io]
# Similar to Cargo above we want the RLS to use a vendored version of `rustfmt`
# that we're shipping as well (to ensure that the rustfmt in RLS and the
# `rustfmt` executable are the same exact version).
rustfmt-nightly = { path = "src/tools/rustfmt" }
# See comments in `src/tools/rustc-workspace-hack/README.md` for what's going on
# here
rustc-workspace-hack = { path = 'src/tools/rustc-workspace-hack' }
# See comments in `tools/rustc-std-workspace-core/README.md` for what's going on
# here
rustc-std-workspace-core = { path = 'src/tools/rustc-std-workspace-core' }
rustc-std-workspace-alloc = { path = 'src/tools/rustc-std-workspace-alloc' }
rustc-std-workspace-std = { path = 'src/tools/rustc-std-workspace-std' }
libc = {path = "../libc"}
[patch."https://github.com/rust-lang/rust-clippy"]
clippy_lints = { path = "src/tools/clippy/clippy_lints" }
[dependencies]
# libc = {verion = "0.2", default-features= false, path = "../libc"}
This is the error I get:
mahto#hydlnxeng27:/local/mnt/workspace/mahto/rust$ ./x.py build --config config.toml src/libstd 2>&1 | tee build.log
Updating only changed submodules
Submodules updated in 0.04 seconds
error: failed to parse manifest at `/local/mnt/workspace/mahto/rust/Cargo.toml`
Caused by:
virtual manifests do not specify [dependencies]
failed to run: /local/mnt/workspace/mahto/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /local/mnt/workspace/mahto/rust/src/bootstrap/Cargo.toml
Build completed unsuccessfully in 0:00:00
After commenting-out the dependencies section in Cargo.toml, I get this new error:
error[E0433]: failed to resolve: unresolved import
error: aborting due to previous error
For more information about this error, try `rustc --explain E0433`.
error: could not compile `libc`.