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 installed but it can't find its directory #951

Closed
GildedHonour opened this issue Jun 21, 2018 · 14 comments
Closed

OpenSsl installed but it can't find its directory #951

GildedHonour opened this issue Jun 21, 2018 · 14 comments

Comments

@GildedHonour
Copy link

Arch linux:

$ openssl version
OpenSSL 1.1.0h  27 Mar 2018

And:

$ cargo build --release
   [...............]
   Compiling openssl-sys v0.9.33
error: failed to run custom build command for `openssl-sys v0.9.33`
process didn't exit successfully: `/home/my_user/web_apps/my_app/target/release/build/openssl-sys-1dcc7ad8d923639a/build-script-main` (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: "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.33


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/my_user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/openssl-sys-0.9.33/build/main.rs:232:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
@sfackler
Copy link
Owner

You need to have pkg-config installed.

@sfackler sfackler closed this as completed Aug 4, 2018
@JesseSilv
Copy link

Nope thats not it

@JesseSilv
Copy link

Just checked

@JesseSilv
Copy link

cargo install --git https://github.com/sfackler/rust-openssl.git Updating git repository https://github.com/sfackler/rust-openssl.git`
Installing systest v0.1.0 (https://github.com/sfackler/rust-openssl.git#91a78bc3)
Updating crates.io index
Compiling proc-macro2 v0.4.24
Compiling unicode-xid v0.1.0
Compiling semver-parser v0.7.0
Compiling libc v0.2.45
Compiling serde v1.0.82
Compiling ryu v0.2.7
Compiling num-traits v0.2.6
Compiling cfg-if v0.1.6
Compiling term v0.4.6
Compiling itoa v0.4.3
Compiling bitflags v0.9.1
Compiling pkg-config v0.3.14
Compiling cc v1.0.26
Compiling semver v0.9.0
Compiling log v0.4.6
Compiling log v0.3.9
Compiling rand v0.4.3
Compiling rustc_version v0.2.3
Compiling openssl-sys v0.9.39 (https://github.com/sfackler/rust-openssl.git#91a78bc3)
Compiling extprim v1.6.0
Compiling quote v0.6.10
Compiling syn v0.15.23
error: failed to run custom build command for openssl-sys v0.9.39 (https://github.com/sfackler/rust-openssl.git#91a78bc3)
process didn't exit successfully: /tmp/cargo-installKuOfSZ/release/build/openssl-sys-50524e073a8255fd/build-script-main (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.

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

', /root/.cargo/git/checkouts/rust-openssl-41da9d20ce19f5aa/91a78bc/openssl-sys/build/main.rs:269:9
note: Run with RUST_BACKTRACE=1 for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: failed to compile systest v0.1.0 (https://github.com/sfackler/rust-openssl.git#91a78bc3), intermediate artifacts can be found at `/tmp/cargo-installKuOfSZ``

@sfackler
Copy link
Owner

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

@fiddybux
Copy link

fiddybux commented Jul 5, 2019

I'm getting the same errors, and I have the development packages of openssl installed, and pkg-config installed.

Attempting to build for armhf from Ubuntu 19.04.

@internetuser0x00
Copy link

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

installing libssl-dev worked for me on Ubuntu

@gregzaitsev
Copy link

Turns out you need both libssl-dev and pkg-config, so the full solution (for Ubuntu) is:

apt-get install libssl-dev pkg-config

@ctaggart
Copy link

ctaggart commented Jan 2, 2021

I realize this thread is Linux, but I'm going to leave my future self a note. The dependencies for Mac are:

brew install openssl@1.1

@zwhitchcox
Copy link

I installed pkg-config, but now I'm getting the error

   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"

Doing this through github actions

@zwhitchcox
Copy link

Tried setting config path

export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig

But still getting same error

@zwhitchcox
Copy link

I've even verified openssl.pc is in the PKG_CONFIG_PATH

@zwhitchcox
Copy link

Looks like it's to do with this issue: cross-rs/cross#404

shantanoo-desai added a commit to shantanoo-desai/akri that referenced this issue Jun 9, 2021
- Without previous installation of `openssl-dev`, `pkg-config`,
  `cargo install cargo-generate` will fail.
- Potential solution is to install the respective dependencies beforehand

Tested On: Windows10 Pro + WSL2 (Ubuntu-20.04 LTS) + rustc > v1.51
Possible Solution found on: sfackler/rust-openssl#951

Signed-off-by: Shan Desai <shantanoo.desai@gmail.com>
kate-goldenring pushed a commit to project-akri/akri that referenced this issue Jun 14, 2021
* docs: add info about openssl, pkg-config deps

- Without previous installation of `openssl-dev`, `pkg-config`,
  `cargo install cargo-generate` will fail.
- Potential solution is to install the respective dependencies beforehand

Tested On: Windows10 Pro + WSL2 (Ubuntu-20.04 LTS) + rustc > v1.51
Possible Solution found on: sfackler/rust-openssl#951

Signed-off-by: Shan Desai <shantanoo.desai@gmail.com>

* docs: point to `cargo-generate` installation section

- Reason: `cargo install cargo-generate` provides `--features` flag to
  enable SSL binding which can add dependencies and remove the `openssl-dev`
  and `pkg-config` standalone installations.
- Approach: Give user the choice to either install these deps accordingly by
  pointing to the Installtion Instruction for `cargo-generate`

Signed-off-by: Shan Desai <shantanoo.desai@gmail.com>

* docs: refactor docs for clarity

Signed-off-by: Shan Desai <shantanoo.desai@gmail.com>

* refactor(docs): remove redundant sentence
kate-goldenring pushed a commit to project-akri/akri-docs that referenced this issue Aug 5, 2021
* docs: add info about openssl, pkg-config deps

- Without previous installation of `openssl-dev`, `pkg-config`,
  `cargo install cargo-generate` will fail.
- Potential solution is to install the respective dependencies beforehand

Tested On: Windows10 Pro + WSL2 (Ubuntu-20.04 LTS) + rustc > v1.51
Possible Solution found on: sfackler/rust-openssl#951

Signed-off-by: Shan Desai <shantanoo.desai@gmail.com>

* docs: point to `cargo-generate` installation section

- Reason: `cargo install cargo-generate` provides `--features` flag to
  enable SSL binding which can add dependencies and remove the `openssl-dev`
  and `pkg-config` standalone installations.
- Approach: Give user the choice to either install these deps accordingly by
  pointing to the Installtion Instruction for `cargo-generate`

Signed-off-by: Shan Desai <shantanoo.desai@gmail.com>

* docs: refactor docs for clarity

Signed-off-by: Shan Desai <shantanoo.desai@gmail.com>

* refactor(docs): remove redundant sentence
@ceoshikhar
Copy link

I realize this thread is Linux, but I'm going to leave my future self a note. The dependencies for Mac are:

brew install openssl@1.1

Thank you!

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

9 participants