Unable to build with rust clap with yaml feature

344 Views Asked by At

I am trying to build with the Clap Yaml feature, but it errors out here.

   Compiling clap v3.1.12
    Building [========================>  ] 44/47: clap, yaml-rust     
error: could not compile `clap`

Caused by:
  process didn't exit successfully: `rustc --crate-name clap --edition=2018 /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-3.1.12/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="atty"' --cfg 'feature="color"' --cfg 'feature="default"' --cfg 'feature="std"' --cfg 'feature="strsim"' --cfg 'feature="suggestions"' --cfg 'feature="termcolor"' --cfg 'feature="yaml"' --cfg 'feature="yaml-rust"' -C metadata=c304c427904608a0 -C extra-filename=-c304c427904608a0 --out-dir /home/ubuntu/Fuzzer/fuzzer/target/release/deps -L dependency=/home/ubuntu/Fuzzer/fuzzer/target/release/deps --extern atty=/home/ubuntu/Fuzzer/fuzzer/target/release/deps/libatty-a738dbd9b3c63306.rmeta --extern bitflags=/home/ubuntu/Fuzzer/fuzzer/target/release/deps/libbitflags-32a2c4a16da85e35.rmeta --extern clap_lex=/home/ubuntu/Fuzzer/fuzzer/target/release/deps/libclap_lex-9fd816bdd1aa0a27.rmeta --extern indexmap=/home/ubuntu/Fuzzer/fuzzer/target/release/deps/libindexmap-2a2b92386f84cd5f.rmeta --extern strsim=/home/ubuntu/Fuzzer/fuzzer/target/release/deps/libstrsim-aa9e0b1c28b1955e.rmeta --extern termcolor=/home/ubuntu/Fuzzer/fuzzer/target/release/deps/libtermcolor-d93b521b81ab3f3d.rmeta --extern textwrap=/home/ubuntu/Fuzzer/fuzzer/target/release/deps/libtextwrap-455b4f0f719538f2.rmeta --extern yaml_rust=/home/ubuntu/Fuzzer/fuzzer/target/release/deps/libyaml_rust-176b9c782134aa71.rmeta --cap-lints allow` (signal: 9, SIGKILL: kill)

Please advise

Here is what my dependencies in the Cargo.toml file look like:

[dependencies]
rand = "0.8.4"
libc = "0.2.122"
rand_chacha = "0.3.1"
rand_pcg = "0.3.1"
rayon = "1.5.2" 
clap = { version = "3.1.12", features = ["yaml"] }
1

There are 1 best solutions below

0
On

There is nothing wrong with what you've shown, but something is killing the Rust compiler.

Are you running on a Raspberry Pi or similar computer with very limited memory? If so, likely you are running out of memory during the compilation, and the Linux “OOM killer” is deciding that the compiler is a runaway process to be stopped.

You can reduce the maximum memory required by creating a Cargo configuration file (this is not Cargo.toml) and setting

[build]
jobs = 1 

to avoid trying to compile multiple crates at once. Setting up a swap partition, if you do not already have one, may also be necessary (warning: this can wear out SD cards quickly; plug in a SSD or hard drive if possible).