# Rust-env-demo error

**URL:** <https://discourse.flox.dev/t/rust-env-demo-error/755>\
**Category:** Bug Reports\
**Tags:** closed\
**Created:** [June 3, 2023, 1:55pm UTC](https://discourse.flox.dev/t/rust-env-demo-error/755 "2023-06-03T13:55:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xytras](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.flox.dev/xytras/32/585_2.png) [@xytras](https://discourse.flox.dev/u/xytras)\
**Post date:** [June 3, 2023, 1:55pm UTC](https://discourse.flox.dev/t/rust-env-demo-error/755/1 "2023-06-03T13:55:14Z")

</div>

Hi. I’m a very novice user to flox and nix. I’m running Debian 12 Bookwork fresh install and just installed Flox per Flox docs. While trying to do the “flox in 5 minutes” demo I get the following error when running Cargo Run:  
cargo run  
Compiling openssl-sys v0.9.87  
error: failed to run custom build command for `openssl-sys v0.9.87`

Caused by:  
process didn’t exit successfully: `/home/xytras/flox/rust-env-demo/target/debug/build/openssl-sys-9ed23725276d135a/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 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  
run pkg\_config fail: `PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" "pkg-config" "--libs" "--cflags" "openssl"` did not exit successfully: exit status: 1  
error: could not find system library ‘openssl’ required by the ‘openssl-sys’ crate

— stderr  
Package openssl was not found in the pkg-config search path.  
Perhaps you should add the directory containing `openssl.pc’  
to the PKG\_CONFIG\_PATH environment variable  
Package ‘openssl’, required by ‘virtual:world’, not found

— 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 [GitHub - sfackler/rust-openssl: OpenSSL bindings for Rust](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.87

', /home/xytras/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.87/build/find\_normal.rs:190:5  
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Any ideas? Thanks

---

<div class="post-metadata">

**Author:** ![aameen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.flox.dev/aameen/32/564_2.png) [@aameen](https://discourse.flox.dev/u/aameen)\
**Post date:** [June 7, 2023, 2:50pm UTC](https://discourse.flox.dev/t/rust-env-demo-error/755/2 "2023-06-07T14:50:29Z")

</div>

Hey thanks for your report, I’ll get this passed along to our engineers.

---

<div class="post-metadata">

**Author:** ![tomberek](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.flox.dev/tomberek/32/83_2.png) [@tomberek](https://discourse.flox.dev/u/tomberek)\
**Post date:** [September 15, 2023, 8:31pm UTC](https://discourse.flox.dev/t/rust-env-demo-error/755/3 "2023-09-15T20:31:02Z")

</div>

@xytras Can you verify that you are in a flox development environment? `which cargo` should return something like `/nix/store/n05kbk1c1d750yv9d36jxs4ar7sp3s6p-auditable-cargo-1.71.1/bin/cargo` not `/usr/bin/cargo`. You can enter the development environment with `flox develop rust-env`.

Another thing to try is to run `pkg-config --libs --cflags openssl` inside the development shell and examine the error.

Ensuring things like openssl libraries are available is one of the flox core features. If you are still having difficulties, please let us know.
