0

I have a rust project that uses the below crate.

reqwest = { version = "0.11.18", features = ["blocking", "json"] }

In order to make it work, I installed "libssl-dev" using the below command in the terminal.

sudo apt install libssl-dev

However, when I tried to run the project using the command cargo run, I got the below error message.

error: failed to run custom build command for `openssl-sys v0.9.90`

Caused by:
  process didn't exit successfully: `/home/user/rust/target/debug/build/openssl-sys-cb188c5370e333b3/build-script-main` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
  OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
  OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_DIR
  OPENSSL_DIR = /usr/include/openssl

  --- stderr
  thread 'main' panicked at 'OpenSSL include directory does not exist: /usr/include/openssl/include', /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.90/build/main.rs:80:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

This should not happen since openssl is already installed. How do I make it work?

I tried to add the code export OPENSSL_DIR=/usr/include/openssl to the file "/.bashrc" in the home directory but it did not make any difference.

Saad
  • 33
  • 5

0 Answers0