Skip to content

Commit

Permalink
add pkg-config package dependency (#8066)
Browse files Browse the repository at this point in the history
During installation of sui I encountered the following error: 
```
erun-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: "Could not run `\"pkg-config\" \"--libs\" \"--cflags\" \"openssl\"`\nThe pkg-config command could not be found.\n\nMost likely, you need to install a pkg-config package for your OS.\nTry `apt install pkg-config`, or `yum install pkg-config`,\nor `pkg install pkg-config`, or `apk add pkgconfig` depending on your distribution.\n\nIf you've already installed it, ensure the pkg-config command is one of the\ndirectories in the PATH environment variable.\n\nIf you did not expect this build to link to a pre-installed system library,\nthen check documentation of the openssl-sys crate for an option to\nbuild the library from source, or disable features or dependencies\nthat require pkg-config."

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


  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/szymonwolny/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.80/build/find_normal.rs:191:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `sui v0.25.0 (https://github.com/MystenLabs/sui.git?branch=main#b4d69b2c)`, intermediate artifacts can be found at `/tmp/cargo-installbY2K8Q`
```

Installing the `pkg-config` package solves the issue. I added a note to
the documentation about it.

Co-authored-by: Szymon Wolny <Szymon.Wolny@itechart-group.com>
  • Loading branch information
szymcio32 and Szymon Wolny authored Feb 3, 2023
1 parent 1f4dd6f commit 41b4511
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doc/src/build/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ Use the following command to install `libssl-dev`:
sudo apt-get install libssl-dev
```

(Optional) If you have OpenSSL it may be required to also install `pkg-config`:

```shell
sudo apt-get install pkg-config
```

### libclang-dev

Use the following command to install `libclang-dev`:
Expand Down

0 comments on commit 41b4511

Please sign in to comment.