Argyle-Software / kyber

A rust implementation of the Kyber post-quantum KEM
https://docs.rs/pqc_kyber/
Apache License 2.0
163 stars 37 forks source link

Error compiling pqc_kyber library in rust program`(panic_handler)` #98

Closed rauleteee closed 9 months ago

rauleteee commented 9 months ago

Hi,

I am trying to play with pqc_library in order to test some crypto latencies. At the moment of building cargo ( cargo build --release), pqc_library throws the following errors:

$ cargo build --release`
   Compiling pqc_kyber v0.7.1
error: #[panic_handler] function required, but not found

error: language item required, but not found: eh_personality
  |
  = note: this can occur when a binary crate with #![no_std] is compiled for a target where eh_personality is defined in the standard library
  = help: you may be able to compile for a target that doesn't need eh_personality, specify a target with --target or in .cargo/config

error: could not compile pqc_kyber (lib) due to 2 previous errors

I've tried several things such as adding a #[panic_handler] function with panic warnings in main.rs, or adding

[profile.dev]
panic = "abort"

[profile.release]
panic = "abort"

to the cargo.toml file, nothing changes for me. I am running the program in ubuntu20.04.

Any help is welcome, R.

DANIHLARA commented 9 months ago

I've got just the same problem, and found nothing online.

mberry commented 9 months ago

Hey so you will need to enable the standard library in the features. I've been really considering making it a default feature because this has caused problems before for others.

So to fix:

cargo add pqc_kyber -F std

rauleteee commented 9 months ago

The solution is to add std feature in the library. Thank you.