Error: failed to run custom build command for `openssl-sys v0.9.93`

cargo run	
   Compiling openssl-sys v0.9.93
   Compiling num-traits v0.2.17
   Compiling foreign-types-shared v0.1.1
   Compiling openssl v0.10.57
error: failed to run custom build command for `openssl-sys v0.9.93`

Caused by:
  process didn't exit successfully: `/home/oritse/Desktop/soccer-meet/target/debug/build/openssl-sys-2138c2b24fe60f46/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 = /usr/lib
  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 = /usr/include/openssl
  cargo:rustc-link-search=native=/usr/lib
  cargo:include=/usr/include/openssl
  cargo:rerun-if-changed=build/expando.c
  OPT_LEVEL = Some("0")
  TARGET = Some("x86_64-unknown-linux-gnu")
  HOST = Some("x86_64-unknown-linux-gnu")
  cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
  CC_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
  CC_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
  CFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
  CFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-I" "/usr/include/openssl" "-Wall" "-Wextra" "-E" "build/expando.c"
  exit status: 0
  version: 3_3_0
  cargo:rustc-cfg=openssl
  cargo:rustc-cfg=osslconf="OPENSSL_NO_SSL3_METHOD"
  cargo:conf=OPENSSL_NO_SSL3_METHOD
  cargo:rustc-cfg=ossl300
  cargo:rustc-cfg=ossl101
  cargo:rustc-cfg=ossl102
  cargo:rustc-cfg=ossl102f
  cargo:rustc-cfg=ossl102h
  cargo:rustc-cfg=ossl110
  cargo:rustc-cfg=ossl110f
  cargo:rustc-cfg=ossl110g
  cargo:rustc-cfg=ossl110h
  cargo:rustc-cfg=ossl111
  cargo:rustc-cfg=ossl111b
  cargo:rustc-cfg=ossl111c
  cargo:rustc-cfg=ossl111d
  cargo:version_number=30300000
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIBS
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIBS unset
  cargo:rerun-if-env-changed=OPENSSL_LIBS
  OPENSSL_LIBS unset
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_STATIC
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_STATIC unset
  cargo:rerun-if-env-changed=OPENSSL_STATIC
  OPENSSL_STATIC unset

  --- stderr
  thread 'main' panicked at /home/oritse/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.93/build/main.rs:397:13:
  OpenSSL libdir at `["/usr/lib"]` does not contain the required files to either statically or dynamically link OpenSSL
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
make: *** [Makefile:43: run] Error 101

can somebody help me

Using the default flags of the openssl crate, it needs the OpenSSL library (with headers![1]) to be present on your computer. Please refer to the openssl crate's documentation for more on how to make sure you have a working OpenSSL library with headers available for openssl to link into your program.


  1. While most (I guess) Linux distros have OpenSSL installed right out of the box, the headers often times need to be installed with a separate package. I.e. on OpenSUSE I had to install the headers by running zypper install libopenssl-devel. On Ubuntu the headers can be installed by running apt-get install libssl-dev. â†Šī¸Ž

3 Likes

If you can, try using rustls instead of openssl, it will sidestep these kinds of build problems entirely.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.