Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo can't find openssl even after i added to system path #2326

Open
Gtucker3d opened this issue Nov 12, 2024 · 6 comments
Open

cargo can't find openssl even after i added to system path #2326

Gtucker3d opened this issue Nov 12, 2024 · 6 comments

Comments

@Gtucker3d
Copy link

rust_projects\test_crate\target\debug\build\openssl-sys-40ca9080d7103201\build-script-main(exit code: 101) --- stdout cargo:rustc-check-cfg=cfg(osslconf, values("OPENSSL_NO_OCB", "OPENSSL_NO_SM4", "OPENSSL_NO_SEED", "OPENSSL_NO_CHACHA", "OPENSSL_NO_CAST", "OPENSSL_NO_IDEA", "OPENSSL_NO_CAMELLIA", "OPENSSL_NO_RC4", "OPENSSL_NO_BF", "OPENSSL_NO_PSK", "OPENSSL_NO_DEPRECATED_3_0", "OPENSSL_NO_SCRYPT", "OPENSSL_NO_SM3", "OPENSSL_NO_RMD160", "OPENSSL_NO_EC2M", "OPENSSL_NO_OCSP", "OPENSSL_NO_CMS", "OPENSSL_NO_COMP", "OPENSSL_NO_SOCK", "OPENSSL_NO_STDIO", "OPENSSL_NO_EC", "OPENSSL_NO_SSL3_METHOD", "OPENSSL_NO_KRB5", "OPENSSL_NO_TLSEXT", "OPENSSL_NO_SRP", "OPENSSL_NO_RFC3779", "OPENSSL_NO_SHA", "OPENSSL_NO_NEXTPROTONEG", "OPENSSL_NO_ENGINE", "OPENSSL_NO_BUF_FREELISTS")) cargo:rustc-check-cfg=cfg(openssl) cargo:rustc-check-cfg=cfg(libressl) cargo:rustc-check-cfg=cfg(boringssl) cargo:rustc-check-cfg=cfg(libressl250) cargo:rustc-check-cfg=cfg(libressl251) cargo:rustc-check-cfg=cfg(libressl252) cargo:rustc-check-cfg=cfg(libressl261) cargo:rustc-check-cfg=cfg(libressl270) cargo:rustc-check-cfg=cfg(libressl271) cargo:rustc-check-cfg=cfg(libressl273) cargo:rustc-check-cfg=cfg(libressl280) cargo:rustc-check-cfg=cfg(libressl281) cargo:rustc-check-cfg=cfg(libressl291) cargo:rustc-check-cfg=cfg(libressl310) cargo:rustc-check-cfg=cfg(libressl321) cargo:rustc-check-cfg=cfg(libressl332) cargo:rustc-check-cfg=cfg(libressl340) cargo:rustc-check-cfg=cfg(libressl350) cargo:rustc-check-cfg=cfg(libressl360) cargo:rustc-check-cfg=cfg(libressl361) cargo:rustc-check-cfg=cfg(libressl370) cargo:rustc-check-cfg=cfg(libressl380) cargo:rustc-check-cfg=cfg(libressl381) cargo:rustc-check-cfg=cfg(libressl382) cargo:rustc-check-cfg=cfg(libressl390) cargo:rustc-check-cfg=cfg(libressl400) cargo:rustc-check-cfg=cfg(ossl101) cargo:rustc-check-cfg=cfg(ossl102) cargo:rustc-check-cfg=cfg(ossl102f) cargo:rustc-check-cfg=cfg(ossl102h) cargo:rustc-check-cfg=cfg(ossl110) cargo:rustc-check-cfg=cfg(ossl110f) cargo:rustc-check-cfg=cfg(ossl110g) cargo:rustc-check-cfg=cfg(ossl110h) cargo:rustc-check-cfg=cfg(ossl111) cargo:rustc-check-cfg=cfg(ossl111b) cargo:rustc-check-cfg=cfg(ossl111c) cargo:rustc-check-cfg=cfg(ossl111d) cargo:rustc-check-cfg=cfg(ossl300) cargo:rustc-check-cfg=cfg(ossl310) cargo:rustc-check-cfg=cfg(ossl320) cargo:rustc-check-cfg=cfg(ossl330) cargo:rustc-check-cfg=cfg(ossl340) cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_LIB_DIR X86_64_PC_WINDOWS_MSVC_OPENSSL_LIB_DIR unset cargo:rerun-if-env-changed=OPENSSL_LIB_DIR OPENSSL_LIB_DIR unset cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_INCLUDE_DIR X86_64_PC_WINDOWS_MSVC_OPENSSL_INCLUDE_DIR unset cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR OPENSSL_INCLUDE_DIR unset cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_DIR X86_64_PC_WINDOWS_MSVC_OPENSSL_DIR unset cargo:rerun-if-env-changed=OPENSSL_DIR OPENSSL_DIR unset note: vcpkg did not find openssl: Could not find Vcpkg tree: No vcpkg installation found. Set the VCPKG_ROOT environment variable or run 'vcpkg integrate install' cargo:warning=Could not find directory of OpenSSL installation, and this-syscrate cannot proceed without this knowledge. If OpenSSL is installed and this crate had trouble finding it, you can set theOPENSSL_DIR` environment variable for the compilation process. See stderr section below for further information.

--- stderr

Could not find directory of OpenSSL installation, and this -sys crate cannot
proceed without this knowledge. If OpenSSL is installed and this crate had
trouble finding it, you can set the OPENSSL_DIR environment variable for the
compilation process.

Make sure you also have the development packages of openssl installed.
For example, libssl-dev on Ubuntu or openssl-devel on Fedora.

If you're in a situation where you think the directory should be found
automatically, please open a bug at https://github.com/sfackler/rust-openssl
and include information about your system as well as this message.

$HOST = x86_64-pc-windows-msvc
$TARGET = x86_64-pc-windows-msvc
openssl-sys = 0.9.104

It looks like you're compiling for MSVC but we couldn't detect an OpenSSL
installation. If there isn't one installed then you can try the rust-openssl
README for more information about how to download precompiled binaries of
OpenSSL:

https://github.com/sfackler/rust-openssl#windows

error: aborting due to 12 previous errors

@gaojunran
Copy link

I have the same issue when I use tauri.

@0xViva
Copy link

0xViva commented Nov 30, 2024

encountering the same issue. suspect that [email protected] is using [email protected]?

@Liam19
Copy link

Liam19 commented Jan 6, 2025

I get the same error trying to install trunk

@jordan-bravo
Copy link

I'm having a similar issue on Ubuntu 24.04.

Steps to reproduce:

  • Confirm that openssl is installed:
❯ openssl version -d
OPENSSLDIR: "/usr/lib/ssl"
  • Attempt install:
❯ cargo install claude_cli
    Updating crates.io index
  Installing claude_cli v0.1.3
    Updating crates.io index
     Locking 164 packages to latest compatible versions
      Adding base64 v0.21.7 (latest: v0.22.1)
      Adding bitflags v1.3.2 (latest: v2.8.0)
      ...
The following warnings were emitted during compilation:

warning: [email protected]: Could not find directory of OpenSSL installation, and this `-sys` crate cannot proceed without this knowledge. If OpenSSL is installed and this crate had trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the compilation process. See stderr section below for further information.

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

Caused by:
  process didn't exit successfully: `/tmp/cargo-installAewKLi/release/build/openssl-sys-4b14006097f19119/build-script-main` (exit status: 101)
  --- stdout
  cargo:rustc-check-cfg=cfg(osslconf, values("OPENSSL_NO_OCB", "OPENSSL_NO_SM4", "OPENSSL_NO_SEED", "OPENSSL_NO_CHACHA", "OPENSSL_NO_CAST", "OPENSSL_NO_IDEA", "OPENSSL_NO_CAMELLIA", "OPENSSL_NO_RC4", "OPENSSL_NO_BF", "OPENSSL_NO_PSK", "OPENSSL_NO_DEPRECATED_3_0", "OPENSSL_NO_SCRYPT", "OPENSSL_NO_SM3", "OPENSSL_NO_RMD160", "OPENSSL_NO_EC2M", "OPENSSL_NO_OCSP", "OPENSSL_NO_CMS", "OPENSSL_NO_COMP", "OPENSSL_NO_SOCK", "OPENSSL_NO_STDIO", "OPENSSL_NO_EC", "OPENSSL_NO_SSL3_METHOD", "OPENSSL_NO_KRB5", "OPENSSL_NO_TLSEXT", "OPENSSL_NO_SRP", "OPENSSL_NO_RFC3779", "OPENSSL_NO_SHA", "OPENSSL_NO_NEXTPROTONEG", "OPENSSL_NO_ENGINE", "OPENSSL_NO_BUF_FREELISTS"))
  cargo:rustc-check-cfg=cfg(openssl)
  cargo:rustc-check-cfg=cfg(libressl)
  cargo:rustc-check-cfg=cfg(boringssl)
  cargo:rustc-check-cfg=cfg(libressl250)
  ...
  cargo:rustc-check-cfg=cfg(ossl101)
  ...
  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 unset
  cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=OPENSSL_STATIC
  cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR


  Could not find openssl via pkg-config:

  pkg-config exited with status code 1
  > PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags openssl

  The system library `openssl` required by crate `openssl-sys` was not found.
  The file `openssl.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
  The PKG_CONFIG_PATH environment variable is not set.

  HINT: if you have installed the library, try setting PKG_CONFIG_PATH to the directory containing `openssl.pc`.


  cargo:warning=Could not find directory of OpenSSL installation, and this `-sys` crate cannot proceed without this knowledge. If OpenSSL is installed and this crate had trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the compilation process. See stderr section below for further information.

  --- stderr


  Could not find directory of OpenSSL installation, and this `-sys` crate cannot
  proceed without this knowledge. If OpenSSL is installed and this crate had
  trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
  compilation process.

  Make sure you also have the development packages of openssl installed.
  For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

  If you're in a situation where you think the directory *should* be found
  automatically, please open a bug at https://github.com/sfackler/rust-openssl
  and include information about your system as well as this message.

  $HOST = x86_64-unknown-linux-gnu
  $TARGET = x86_64-unknown-linux-gnu
  openssl-sys = 0.9.104


warning: build failed, waiting for other jobs to finish...
error: failed to compile `claude_cli v0.1.3`, intermediate artifacts can be found at `/tmp/cargo-installAewKLi`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

Based on the error message, I tried running the install with the variable OPENSSL_DIR:

❯ OPENSSL_DIR=/usr/lib/ssl cargo install claude_cli

Which fails with:

  --- stderr
  thread 'main' panicked at /home/jordan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.104/build/main.rs:144:9:
  OpenSSL include directory does not exist: /usr/lib/ssl/include

@sukusec301
Copy link

use features = ["vendored"], it will automaticlly use rust OpenSSL rather than your system's OpenSSL

@jordan-bravo
Copy link

use features = ["vendored"], it will automaticlly use rust OpenSSL rather than your system's OpenSSL

❯ cargo install --features vendored claude_cli
    Updating crates.io index
  Installing claude_cli v0.1.3
error: failed to compile `claude_cli v0.1.3`, intermediate artifacts can be found at `/tmp/cargo-installMpYHJ0`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

Caused by:
  none of the selected packages contains these features: vendored

There are no features listed in Cargo.toml and I looked up the claude_cli crate on docs.rs and it shows:

Image

Any suggestions on how to proceed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants