debris / tiny-keccak

An implementation of Keccak derived functions specified in FIPS-202, SP800-185 and KangarooTwelve
Creative Commons Zero v1.0 Universal
193 stars 49 forks source link

Build Error on Ubuntu 16 #26

Closed DrPeterVanNostrand closed 6 years ago

DrPeterVanNostrand commented 6 years ago

When building a Rust crate with tiny-keccak as a dependency, I received the following build error.

   Compiling tiny-keccak v1.4.1
     Running `rustc --crate-name tiny_keccak /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/tiny-keccak-1.4.1/src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=49d6f213a92cfbc2 -C extra-filename=-49d6f213a92cfbc2 --out-dir /home/ubuntu/whatever/target/debug/deps -L dependency=/home/ubuntu/whatever/target/debug/deps --extern crunchy=/home/ubuntu/whatever/target/debug/deps/libcrunchy-c57bfed60427bcc4.rlib --cap-lints allow`
error: Could not compile `tiny-keccak`.

Caused by:
  process didn't exit successfully: `rustc --crate-name tiny_keccak /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/tiny-keccak-1.4.1/src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=49d6f213a92cfbc2 -C extra-filename=-49d6f213a92cfbc2 --out-dir /home/ubuntu/whatever/target/debug/deps -L dependency=/home/ubuntu/whatever/target/debug/deps --extern crunchy=/home/ubuntu/whatever/target/debug/deps/libcrunchy-c57bfed60427bcc4.rlib --cap-lints allow` (signal: 9, SIGKILL: kill)

This error occurred when building tiny-keccak on a fresh Ubuntu 16 EC2 instance.

Cargo.toml:

[dependencies]
tiny-keccak = "1.4.1"

Rust Version: rustc 1.27.0-nightly

dmihal commented 5 years ago

@DrPeterVanNostrand I'm getting this issue now, did you find a solution?

DrPeterVanNostrand commented 5 years ago

Yup, for me it was the Linux out-of-memory process killer caused by the loop unrolling macros unroll!. If you try to build the tiny-keccak crate and get the SIGILL caused by crunchy, you can check if the build process was killed by the Linux OOM killer by running:

grep -i kill /var/log/messages*

If you see something like the following, then you ran out of memory during the build process:

Out of Memory: Killed process <build PID>

When building anything using tiny-keccak on a small EC2 instance, I manually remove the unroll! macros and use that version in place of tiny-keccak in my Cargo.toml files. If you are not limited to using a small EC2 instance, try starting an instance with more RAM and rebuilding there.