Hey there,
I’m trying to compile a project of mine made in rust, but I’m unable to compile it because openssl-sys
complain that I don’t have the required files in the /nix/store/<id>-openssl-3.0.13-dev/lib
path, and indeed I don’t have any other file that pkg-config
:
$ ls /nix/store/dz2mjwyvs1l3vvvp5izx0xpxq1vvw075-openssl-3.0.13-dev/lib
pkgconfig
so I don’t know why the library files are not included, anyone have an idea ?
for context there is my shell.nix
file :
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
rustup
rustfmt
clippy
gcc
pkg-config
];
buildInputs = with pkgs; [
openssl
];
shellHook = ''
export OPENSSL_DIR="${pkgs.openssl.dev}"
export PKG_CONFIG_PATH="${pkgs.openssl.dev}/lib/pkgconfig"
'';
}
and the error I get when trying to compile :
$ cargo run
Compiling openssl-sys v0.9.102
Compiling hyper-util v0.1.6
Compiling rust-embed v8.4.0
Compiling portable-atomic v1.6.0
Compiling tar v0.4.41
Compiling serde_json v1.0.120
Compiling dirs v5.0.1
Compiling tempfile v3.10.1
Compiling chksum-md5 v0.0.0
Compiling wincompatlib v0.7.4
Compiling time v0.3.36
Compiling colored v2.1.0
Compiling zeroize v1.8.1
Compiling shell-words v1.1.0
Compiling number_prefix v0.4.0
Compiling fs_extra v1.3.0
Compiling dotenv v0.15.0
error: failed to run custom build command for `openssl-sys v0.9.102`
Caused by:
process didn't exit successfully: `/home/alez/project/rust/Babylonia-terminal/babylonia-terminal-cli/target/debug/build/openssl-sys-733d657f1410cfe3/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 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 = /nix/store/dz2mjwyvs1l3vvvp5izx0xpxq1vvw075-openssl-3.0.13-dev
cargo:rerun-if-changed=/nix/store/dz2mjwyvs1l3vvvp5izx0xpxq1vvw075-openssl-3.0.13-dev/include/openssl
cargo:rustc-link-search=native=/nix/store/dz2mjwyvs1l3vvvp5izx0xpxq1vvw075-openssl-3.0.13-dev/lib
cargo:include=/nix/store/dz2mjwyvs1l3vvvp5izx0xpxq1vvw075-openssl-3.0.13-dev/include
cargo:rerun-if-changed=build/expando.c
OPT_LEVEL = Some(0)
TARGET = Some(x86_64-unknown-linux-gnu)
OUT_DIR = Some(/home/alez/project/rust/Babylonia-terminal/babylonia-terminal-cli/target/debug/build/openssl-sys-e4053c2d98d1d4bd/out)
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 = Some(gcc)
RUSTC_WRAPPER = None
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
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
version: 3_0_13
cargo:rustc-cfg=osslconf="OPENSSL_NO_SSL3_METHOD"
cargo:conf=OPENSSL_NO_SSL3_METHOD
cargo:rustc-cfg=openssl
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=300000d0
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/alez/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.102/build/main.rs:417:13:
OpenSSL libdir at `["/nix/store/dz2mjwyvs1l3vvvp5izx0xpxq1vvw075-openssl-3.0.13-dev/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...