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

OpenSSL not found on Ubuntu #763

Closed
SuperCuber opened this issue Oct 25, 2017 · 9 comments
Closed

OpenSSL not found on Ubuntu #763

SuperCuber opened this issue Oct 25, 2017 · 9 comments

Comments

@SuperCuber
Copy link

error: failed to run custom build command for `openssl-sys v0.9.20`
process didn't exit successfully: `/tmp/cargo-install.KbMJWtJ6KkZ4/release/build/openssl-sys-4bbdcf8b48309c22/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
cargo:rerun-if-env-changed=OPENSSL_DIR
run pkg_config fail: "`\"pkg-config\" \"--libs\" \"--cflags\" \"openssl\"` did not exit successfully: exit code: 1\n--- stderr\nPackage openssl was not found in the pkg-config search path.\nPerhaps you should add the directory containing `openssl.pc\'\nto the PKG_CONFIG_PATH environment variable\nNo package \'openssl\' found\n"

--- stderr
thread 'main' panicked at '

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.

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.20

', .cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.20/build.rs:210:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.
@sfackler
Copy link
Owner

Do you have libssl-dev installed?

@SuperCuber
Copy link
Author

After installing libssl-dev it works. Thanks!

@95th
Copy link

95th commented Aug 9, 2019

I am running Ubuntu on WSL and have libssl-dev installed. I am still getting the error:

cargo:rustc-cfg=const_fn
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
run pkg_config fail: "Failed to run `\"pkg-config\" \"--libs\" \"--cflags\" \"openssl\"`: No such file or directory (os error 2)"

--- stderr
thread 'main' panicked at '

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.47


It looks like you're compiling on Linux and also targeting Linux. Currently this
requires the `pkg-config` utility to find OpenSSL but unfortunately `pkg-config`
could not be found. If you have OpenSSL installed you can likely fix this by
installing `pkg-config`.

', /home/95th/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.47/build/find_normal.rs:150:5

@SuperCuber
Copy link
Author

@95th
From the error:

If you have OpenSSL installed you can likely fix this by installing `pkg-config`.

Do you have it installed?

@95th
Copy link

95th commented Aug 16, 2019

It wasn't 😬. But installing it worked.

@floratmin
Copy link

floratmin commented Jul 31, 2020

If you have pkg-config already installed then setting the path to the file openssl.pc helped. For me this was:
export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig

@banool
Copy link

banool commented Jun 8, 2022

For me I was able to skirt around the issue by doing this.

First, figure out what openssl crate version we're relying on:

$ cargo tree --target=x86_64-unknown-linux-musl -i openssl-sys | grep openssel
openssl-sys v0.9.74
└── openssl v0.10.40

Then add something like this to your Cargo.toml:

openssl = { version = "0.10.40", features = ["vendored"] }

@dzmitry-lahoda
Copy link

I followed all steps, cannot do last as it deps of deps. Restarted shell, not worked. So will use OPENSSL_DIR directly

@gordug
Copy link

gordug commented Mar 10, 2024

Do you have libssl-dev installed?

This should be a hint in the error

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

7 participants