2,427 questions
0
votes
0
answers
19
views
Pass `configurable-env` to cargo custom subcommand
I have a script named cargo-custom located in my $PATH. The script looks like this:
#!/usr/bin/bash
echo "Using DATA_PATH: $DATA_PATH"
echo "Cargo target dir: $CARGO_TARGET_DIR"
...
0
votes
2
answers
46
views
How to prepare a crate for cargo publish when it needs to be built with the nightly rust toolchain?
I have extracted some functionality into a crate that I think would also be useful to others, so i would like to publish it on crates.io. However, my code makes use of some features that are not in ...
-2
votes
0
answers
31
views
failed to compile `cargo-generate v0.22.0`, intermediate artifacts can be found at `C:\Users\13300\AppData\Local\Temp\cargo-installZmiwB5` [closed]
failed to compile cargo-generate v0.22.0, intermediate artifacts can be found at C:\Users\13300\AppData\Local\Temp\cargo-installZmiwB5.
I encountered an error while installing rust generator; what ...
0
votes
1
answer
36
views
how to specify conditional rustflags in cargo config file
I need to add
"-C link-arg /STACK:4000000"
but only for windows builds. I could not follow the cargo book and could not find any sample config.toml files.
0
votes
0
answers
39
views
How to build a Cargo.lock file for a package within a workspace
When I cargo publish from the package directory in my workspace, I get:
error: Source directory was modified by build.rs during cargo publish. Build scripts should not modify anything outside of ...
0
votes
0
answers
18
views
Rust LibP2P transaction
I’m working on a project that I plan to make open-source in the future. It’s built using Rust and LibP2P to create an environment where smartphones can connect peer-to-peer to form a decentralized ...
1
vote
1
answer
16
views
Does reference not only transfer data also the type of variable
I'm really sorry for my way of questioning if it's confusing u, new to rust
let p = vec![23, 3, 31, 4];
let mut p1 = p;
p1.push(10);
let p2 = &mut p1;
p2.push(11);
The above code ownership is ...
0
votes
1
answer
79
views
how to solve cargo build-bpf / anchor build error on wsl ubuntu latest version
error: failed to parse lock file at: /home/totdking/SolanaUbuntu/token_raffle/Cargo.lock
Caused by:
lock file version 4 requires -Znext-lockfile-bump
This error was gotten while i tried to run the ...
0
votes
0
answers
40
views
Duplicate lang item in crate `std` (which `once_cell` depends on): `panic_impl` [closed]
I have no duplicate crates, all versions point to the same revision of polkadot, yet my dapp won't build due to the error in title. I'm pasting Cargo.lock right here, with a link to a full PR of what ...
-1
votes
1
answer
64
views
cargo build not using the right rustc version
This is a noob question but I have just pulled https://github.com/succinctlabs/rsp/ and try to build it but it fails
$ cargo build
Compiling rsp v0.1.0 (/Users/clementwalter/Documents/rsp/bin/host)
...
-1
votes
1
answer
58
views
How to run Single File Programs in Rust?
I'm trying using Rust in OI (Olympics in Informatics), which only allows submitting Single File Programs.
In C++, we can easily use g++ path/to/file.cpp -oout.exe; ./out.exe. But I haven't found a ...
0
votes
0
answers
24
views
Return an HTTP error response in rust tokio tungstenite
I'm trying to build a websocket server using rust tokio tungstenite.
When the user connects, I want them to specify a roomID as a request query parameter.
If this roomID parameter does not exist, I ...
0
votes
1
answer
52
views
Rust idomatic way to decrementing the value from a map and remove the key when value is 0
Noob to Rust and trying to figure out the idomatic way to decrement the value from a hashmap and remove the corresponding key when the value after decrementing reaches 0.
I am doing it like this but ...
0
votes
0
answers
28
views
Cargo build using incorrect linker
I'm running into an issue trying to cross compile a simple "hello world".
For my use case, I need to build compile a simple application for both x86_64-apple-darwin and aarch64-apple-darwin ...
-1
votes
1
answer
96
views
How do I remove the target wasm32-wasi and add the new wasm32-wasip1
When I try to rustup update, I get
error: component 'rust-std' for target 'wasm32-wasi' is unavailable for download for channel 'nightly'
error: Sometimes not all components are available in any ...
0
votes
1
answer
45
views
Use a different cargo profile for CI
So I recently discovered this neat trick for optimizing compilation times:
[profile.dev.package."*"]
opt-level = 3
This will make all dependencies optimized to maximum, which improves ...
3
votes
1
answer
58
views
How can I debug why a dependency is in my Cargo.lock?
I have mysterious appearance of quinn dependency in Cargo.lock in project which includes request dependency, while I expect it to be not present due to disabled features.
It is very easy to reproduce ...
0
votes
1
answer
72
views
How to properly upload files using Rocket?
Looking for some variants how to upload file and meta-data in one request, I find out that I can use multipart/form-data content-type.
In rust rocket documentation, I found example where TempFile was ...
0
votes
1
answer
45
views
How to link a Rust program with a full path to a static library?
I am using Rust in a Meson based build-system where I build a static library that I need to link to a Rust crate built with Cargo. Right-now I use this environment variable in my Cargo invocation:
'...
0
votes
0
answers
6
views
How do I stop the following Cargo Build Error
Im getting the following error and was wondering how one is able to fix it
enter error: invalid table header
duplicate key package in document root
--> Cargo.toml:21:1
|
21 | [package]
| ^
|
PS C:\...
2
votes
1
answer
66
views
Why does Rust include dev-only features as part of a release build?
I've made a simplified example of my question in this github repo: https://github.com/JackSpagnoli/rust_features
I have a library "auth" handling api authentication, which in prod I would ...
1
vote
0
answers
46
views
Is there a way to customize target folder for Tauri build
By default, cargo tauri build build the target bundle at the root_project_direct/target folder. But is there a way to customize the path ?Since the project folder is in a temp folder on CI and being ...
2
votes
1
answer
31
views
cargo_toml and embuild versions don't match
This is my cargo.toml file
[package]
name = "thingspeak-example"
version = "0.1.0"
authors = ["Sergio Gasquez <[email protected]>"]
edition = "2021"...
0
votes
1
answer
98
views
How to use a different source for a cargo dependency under miri
My project depends on the bitvec crate (crate knowlege not required for question).
This crate is unfortunately not very actively maintained and has a few
issues under miri.
A gracious soul has fixed ...
0
votes
1
answer
57
views
Cargo registry auth: Unable to login/publish to private cargo repo in JFrog Artifactory
I'm trying to publish a cargo pkg to federated cargo repository configured in Jfrog artifactory using cargo cli.
I get a 401 when I try to publish via cargo publish command from my local machine
`...
0
votes
0
answers
21
views
Loosen overly specific transitive dependency requirement in Cargo.toml [duplicate]
Consider the following dependency situation. My crate depends on two other crates, parser-foo and parser-bar, both of which depend on parser-core. The parser-core crate links to a native library, so ...
0
votes
0
answers
24
views
Add target specific rustc flags when building "std"
I'm trying add a new target in rustc and I need to provide a separate search path to a directory which contains native artifacts (such as static libraries or crt*) that are needed for linking for the ...
0
votes
1
answer
72
views
Why doesn't clippy report all pedantic warnings in a Cargo workspace? [duplicate]
I have a Rust workspace crate for Rust 1.82.0. The configuration for Clippy resides inside the Cargo.toml. The configuration section for Clippy looks as follows:
[workspace.lints.rust]
...
1
vote
0
answers
60
views
Dynamically changing underlying crate code depending on cargo features
I have a rust workspace which looks like the following:
* program_a
* libloragw - features = [ manufacturer_a ]
* dependency_a
* libloragw
* program_b
* libloragw - features = [ ...
0
votes
1
answer
98
views
Cargo failed to load source dependency, virtual manifest
I'm new to Rust/Cargo and been struggling to address an issue when compiling a new Yocto recipe for gst-plugins-rs, the Cargo.toml file can be found in this directory structure.
../gstreamer1.0-...
0
votes
1
answer
223
views
cargo build error : error: linking with `cc` failed: exit status: 1 on Macbook AIr M2
I am attempting to run and building my rust code, I built the sample rust project using cargo new sampleProject, and then attempted to run it using cargo run and cargo build, both of which are failing,...
0
votes
2
answers
70
views
Failed to resolve polars_core, arrow::legacy, Dataframe is polars-lazy = "0.44.2"
Despite the:
reading of the polar_lazy 0.44.2
sucessful installation of cargo add polars-lazy
the following code results in errors:
error[E0433]: failed to resolve: could not find legacy in arrow
...
1
vote
1
answer
47
views
Openvino library runtime conflict in cargo workspace
I think I have a linker conflict happening in my cargo workspace.
Some context:
My workspace consists of 3 crates:
engine: Rust crate that calls a C++ application via ffi
engine_rs: complete rust ...
0
votes
0
answers
18
views
How do I convert a virtual manifest into a package manifest? [duplicate]
This is almost a duplicate of existing questions about the error message below, but not quite.
I have a Cargo.toml that contains the line:
wgpu = "22.1"
and everything works just fine. But ...
0
votes
1
answer
73
views
How to test web REST server [closed]
I'm currently writing a REST web server with Rust.
I'm using "reqwest" to test the REST API. To get these tests running, I need to have an instance of the server running.
If I launch it ...
0
votes
0
answers
70
views
How to I tell cargo to use a custom build target?
I am currently following this tutorial on making a simple rust OS.
As the author instructs, I created a json file named x86_64-simple_os.json with the following contents:
{
"llvm-target":...
0
votes
0
answers
31
views
VFP register args linker errors while compiling a rust binary for ARMv7/Cortex-A9
I just recently started messing around with cross compilation and playing around with ARM in general, so I am pretty sure there is something I am missing here.
I am trying to see if I can compile the ...
1
vote
2
answers
85
views
Rust version for dependencies
I am new to Rust.
I try to build an example project using a dependency
actix-web = "3.3.2"
I must use Rust 1.59.0, as an older Yocto Linux version manages the build, which only has that ...
0
votes
0
answers
62
views
'Cargo install cargo-php' giving - linking with `cc` failed: exit status: 1
Rustc --version
rustc 1.78.0 (9b00956e5 2024-04-29)
cargo --version
cargo 1.78.0 (54d8815d0 2024-03-26)
OS - On WSL - Ubuntu 22.4
I am running the command Cargo install cargo-php And it throws the ...
1
vote
1
answer
162
views
Unable to resolve wasm-bindgen dependency conflict
I'm using Tauri v2. I'm trying to add the amazing photon_rs crate for image manipulation.
When I run cargo run I can see there's a version conflict with wasm-bindgen:
Updating crates.io index
error: ...
0
votes
1
answer
51
views
Using rust features as a build flag
I'm trying to use the features of a Cargo.toml file to conditionally set a property at build time. I do this so that I can have some slight differences for the build intended for integration testing.
#...
1
vote
1
answer
82
views
Is it possible to enable a specific feature when another feature is disabled?
I have the following:
comfy-table = { version = "7.1.1", default-features = false }
[features]
wasm = []
I want:
when the wasm feature is not enabled the feature tty in comfy-table should ...
0
votes
0
answers
50
views
can't find crate for `alloc` in rust [duplicate]
rustc 1.84.0-nightly (662180b34 2024-10-20)
a minimal reproducible is here : minimal_reproducible
https://github.com/Horc-zh/-minimal_reproducible
I use the alloc crate in my lib.rs like this:
lib.rs:
...
-1
votes
1
answer
82
views
variable ownership in rust [duplicate]
I'm new rust language. I tried to understand the concept of ownership and borrow.
let mut s = String::from("hello");
{
s.push_str(" world");
let mut r1 = &mut s;
...
0
votes
0
answers
46
views
Conditially enable code in Rust with feature flag by including dependency using git
I've tried importing a Rust library using a feature flag with git dependency. But that doesn't seem to enable the code using CFG annotations in the code but when using the regular library through ...
1
vote
0
answers
85
views
Can anything in Rust be turned into or from bytes?
I am creating a protocol simulation and research tool made with Rust as a library for Python through maturin and Pyo3. I´m relying on different crates that implement protocols in a secure way, but I ...
3
votes
1
answer
74
views
What are the semantics of an underspecified exact version pin in Cargo?
Consider an entry in the [dependencies] section of Cargo.toml file as follows:
[dependencies]
thingy = "=1.2"
So, this is a comparison requirement, and it is an "equals" ...
0
votes
0
answers
20
views
Rust contract DispatchError
I have a RUST contract to stake and unstake coins. I am able to stake multiple times but I am able to unstake only once as soon as the contract is deployed then I am getting contract is trapped error ....
1
vote
0
answers
49
views
Is there a way to specify a compiler flag for specific target-triple in Cargo.toml?
I'd like to pass a compiler flag for a specific target. For example, there are target-feature flags that are specific to a processor like target-feature="+popcnt". I want to pass this flag ...
0
votes
1
answer
520
views
Error while installing jupyter notebook with pip: Preparing metadata (pyproject.toml) did not run successfully
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Cargo, the Rust package manager, is not installed or is ...