Questions tagged [rust-cargo]

Cargo is the official package manager for the Rust programming language.

Cargo is the official package manager for the Rust programming language. Using a manifest, the programmer can provide metadata about a project, including dependencies, which Cargo can automatically download and compile before compiling the project itself.

You can find more information in the cargo book and browse the crates (Rust packages) in crates.io.

2044 questions
12
votes
1 answer

How can I build standalone test binary to run under a debugger?

I want to package up a specific unit test into an executable binary that I can run myself under a debugger. How can I do this with cargo?
Eloff
  • 20,828
  • 17
  • 83
  • 112
12
votes
1 answer

Rust cargo.toml specify custom path for C linker and compiler

I'm having some issues due to my ignorance of cargo setup and the vast amount of documentation. The cargo.toml file is the current: [package] name = "hello" version = "0.1.0" authors = ["PC4\\Author"] [dependencies] sdl2 = { version = "0.34.1",…
CoffeDeveloper
  • 7,961
  • 3
  • 35
  • 69
12
votes
7 answers

Cache Cargo dependencies in a Docker volume

I'm building a Rust program in Docker (rust:1.33.0). Every time code changes, it re-compiles (good), which also re-downloads all dependencies (bad). I thought I could cache dependencies by adding VOLUME ["/usr/local/cargo"]. edit I've also tried…
Mark
  • 18,730
  • 7
  • 107
  • 130
12
votes
1 answer

How can I clean cargo stuff?

I tried to install Parity (an Ethereum client) on my CHIP computer (similar to a Raspberry Pi with 4GB memory). I cloned the repository and ran cargo build --release After a while I noticed that about 40% of the memory was used and I stopped the…
Sergey Potekhin
  • 621
  • 1
  • 11
  • 27
12
votes
1 answer

Could not exec the linker `cc` error when running "cargo build"

I just installed Rust on my Mac and rustc --version --verbose displays rustc 1.0.0-nightly (91bdf23f5 2015-03-09) (built 2015-03-08) binary: rustc commit-hash: 91bdf23f504f79ed59617cde3dfebd3d5e39a476 commit-date: 2015-03-09 build-date:…
abips
  • 209
  • 3
  • 9
12
votes
2 answers

Portable binaries with Rust

I have problems building a portable executable with rust. Running an executable simply built with cargo build on Ubuntu fails with ./test: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found (required by ./test) Building with rustc ...…
globin
  • 432
  • 5
  • 13
11
votes
3 answers

Skip Updating crates.io index when using cargo run

I have a simple Program written in Rust. When I type cargo run in terminal it always shows: Updating crates.io index... And this takes around 40 seconds. But I just wan to execute my Program and I think cargo does not need to update the index every…
thefeiter
  • 329
  • 2
  • 6
11
votes
2 answers

error: failed to run custom build command for `openssl v0.9.24`

I want to install cargo-apk cargo install cargo-apk to my system (Linux Mint), but I'm getting this error error: failed to run custom build command for `openssl v0.9.24` Caused by: process didn't exit successfully:…
Jura
  • 111
  • 1
  • 4
11
votes
1 answer

Why must a WASM library in Rust set the crate-type to cdylib?

The Rust reference states: A dynamic system library will be produced. This is used when compiling a dynamic library to be loaded from another language. This output type will create *.so files on Linux, *.dylib files on macOS, and *.dll files on…
Armeen Moon
  • 18,061
  • 35
  • 120
  • 233
11
votes
1 answer

How can I make macOS frameworks available to clang in a Nix environment?

I'm on macOS 10.13.5, learning to program Rust, and I use Nix to control my development environment. Some actions, such as including the jsonwebtoken library or installing the cargo-watch module, cause a build that requires a macOS framework that…
Savanni D'Gerinel
  • 2,379
  • 17
  • 27
11
votes
1 answer

Why does the last platform-specific dependency take precedence in Cargo?

I have a dependency in my Cargo file that needs to be different by platform, specifically, the default features. Here's what I am trying to do: [package] name = "..blah.." version = "..blah.." authors = ["..blah.."] [target.'cfg(target_os =…
vcsjones
  • 138,677
  • 31
  • 291
  • 286
11
votes
1 answer

error: native library `openssl` is being linked to by more than one version of the same package

I'm facing this problem when I try to cargo build: error: native library openssl is being linked to by more than one version of the same package, but it can only be linked once; try updating or pinning your dependencies to ensure that this package…
mgul
  • 742
  • 8
  • 27
11
votes
1 answer

How to resolve "multiple matching crates for `package`" in cargo?

When running cargo build: error: multiple matching crates for `url` It then lists the candidates: ./target/deps/liburl-11a95471847b9e04.rlib /usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liburl-4e7c5e5c.{so,rlib} ... and then aborts because…
bojangle
  • 888
  • 1
  • 8
  • 14
10
votes
2 answers

Rust compilation error " failed to run custom build command for `freetype-sys v0.13.1' " win 10

I am trying to build a Rust program on Windows 10 having a GUI. When trying to compile a Rust file with gtk dependency on Windows 10 I keep getting the following error messages. warning: unused manifest key:…
K. Ajay
  • 101
  • 1
  • 1
  • 3
10
votes
1 answer

How to run a single doc test in Rust?

I would like to only run a particular doc test instead of running all of them. Is there a way I can do this? I know that you can pass --doc to run only doc tests but is there a flag that allows me to run just a particular one.
Henry
  • 1,311
  • 1
  • 9
  • 26