[GH-ISSUE #8] Cargo install custom build command for openssl fails #9

Closed
opened 2026-03-02 23:01:39 +03:00 by kerem · 5 comments
Owner

Originally created by @Siilwyn on GitHub (Jul 8, 2020).
Original GitHub issue: https://github.com/agrinman/tunnelto/issues/8

Running on Ubuntu 20.04 with rustc 1.44.1.

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

Caused by:
  process didn't exit successfully: `/tmp/cargo-installRs25uj/release/build/openssl-sys-b3896320ad7f5e70/build-script-main` (exit code: 101)
--- stdout
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: "`\"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.58

Following the advice to sudo apt install libssl-dev solves it, but depending on system libraries like this is a (small) hurdle to installing the crate. Would there be a way to use an alternative dependency that doesn't need this system dependency?

Originally created by @Siilwyn on GitHub (Jul 8, 2020). Original GitHub issue: https://github.com/agrinman/tunnelto/issues/8 Running on Ubuntu 20.04 with `rustc 1.44.1`. ``` error: failed to run custom build command for `openssl-sys v0.9.58` Caused by: process didn't exit successfully: `/tmp/cargo-installRs25uj/release/build/openssl-sys-b3896320ad7f5e70/build-script-main` (exit code: 101) --- stdout 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: "`\"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.58 ``` Following the advice to `sudo apt install libssl-dev` solves it, but depending on system libraries like this is a (small) hurdle to installing the crate. Would there be a way to use an alternative dependency that doesn't need this system dependency?
kerem closed this issue 2026-03-02 23:01:39 +03:00
Author
Owner

@agrinman commented on GitHub (Jul 8, 2020):

We need TLS for the secure websocket connection. Currently we rely on https://github.com/sfackler/rust-native-tls which uses OpenSSL on non macOS platforms, so I don't see a workaround yet unfortunately. Any ideas?

<!-- gh-comment-id:655557561 --> @agrinman commented on GitHub (Jul 8, 2020): We need TLS for the secure websocket connection. Currently we rely on https://github.com/sfackler/rust-native-tls which uses OpenSSL on non macOS platforms, so I don't see a workaround yet unfortunately. Any ideas?
Author
Owner

@agrinman commented on GitHub (Jul 11, 2020):

Closing this for now...please re-open if there's a workaround. Simplifying the build process is definitely a priority.

<!-- gh-comment-id:657081834 --> @agrinman commented on GitHub (Jul 11, 2020): Closing this for now...please re-open if there's a workaround. Simplifying the build process is definitely a priority.
Author
Owner

@Siilwyn commented on GitHub (Jul 13, 2020):

Hi @agrinman sorry about the late reply but I think a good alternative would be rustls. Though it might be difficult to use since rust-native-tls is not a direct dependency by the looks of it?

<!-- gh-comment-id:657422327 --> @Siilwyn commented on GitHub (Jul 13, 2020): Hi @agrinman sorry about the late reply but I think a good alternative would be [rustls](https://github.com/ctz/rustls). Though it might be difficult to use since rust-native-tls is not a direct dependency by the looks of it?
Author
Owner

@Siilwyn commented on GitHub (Jul 24, 2020):

@agrinman I can't re-open this issue btw.

<!-- gh-comment-id:663375432 --> @Siilwyn commented on GitHub (Jul 24, 2020): @agrinman I can't re-open this issue btw.
Author
Owner

@agrinman commented on GitHub (Jul 25, 2020):

Yeah it's not a direct dep so I don't see that as an option...

<!-- gh-comment-id:663837249 --> @agrinman commented on GitHub (Jul 25, 2020): Yeah it's not a direct dep so I don't see that as an option...
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tunnelto#9
No description provided.