puiterwijk/uefi-eventlog-rs

build failures in ubuntu:21.04 and fedora:34

Opened this issue · 3 comments

In a fresh ubuntu:21.04 container, I installed rust and git, cloned this repo, and tried cargo build. It failed as follows.

root@dd80ba578ce3:~/git/src/github.com/puiterwijk/uefi-eventlog-rs# cargo build
    Updating crates.io index
  Downloaded atty v0.2.14
  Downloaded env_logger v0.7.1
  Downloaded fallible-iterator v0.2.0
  Downloaded foreign-types-shared v0.1.1
  Downloaded foreign-types v0.3.2
  Downloaded log v0.4.14
  Downloaded openssl-sys v0.9.61
  Downloaded libc v0.2.93
  Downloaded num-derive v0.3.3
  Downloaded linked-hash-map v0.5.4
  Downloaded once_cell v1.7.2
  Downloaded num-traits v0.2.14
  Downloaded openssl v0.10.33
  Downloaded base64 v0.13.0
  Downloaded autocfg v1.0.1
  Downloaded byteorder v1.4.3
  Downloaded humantime v1.3.0
  Downloaded quote v1.0.9
  Downloaded serde v1.0.125
  Downloaded quick-error v1.2.3
  Downloaded serde_derive v1.0.125
  Downloaded memchr v2.3.4
  Downloaded hex v0.4.3
  Downloaded dtoa v0.4.8
  Downloaded cfg-if v1.0.0
  Downloaded cc v1.0.67
  Downloaded serde_yaml v0.8.17
  Downloaded bitflags v1.2.1
  Downloaded syn v1.0.69
  Downloaded uuid v0.8.2
  Downloaded tpmless-tpm2 v0.3.3
  Downloaded thiserror-impl v1.0.24
  Downloaded thiserror v1.0.24
  Downloaded yaml-rust v0.4.5
  Downloaded widestring v0.4.3
  Downloaded unicode-xid v0.2.1
  Downloaded aho-corasick v0.7.15
  Downloaded proc-macro2 v1.0.26
  Downloaded pretty_env_logger v0.4.0
  Downloaded pkg-config v0.3.19
  Downloaded termcolor v1.1.2
  Downloaded regex-syntax v0.6.23
  Downloaded regex v1.4.5
  Downloaded 43 crates (2.5 MB) in 1.07s
   Compiling proc-macro2 v1.0.26
   Compiling unicode-xid v0.2.1
   Compiling syn v1.0.69
   Compiling autocfg v1.0.1
   Compiling libc v0.2.93
   Compiling serde_derive v1.0.125
   Compiling pkg-config v0.3.19
   Compiling memchr v2.3.4
   Compiling cc v1.0.67
   Compiling cfg-if v1.0.0
   Compiling serde v1.0.125
   Compiling bitflags v1.2.1
   Compiling log v0.4.14
   Compiling regex-syntax v0.6.23
   Compiling openssl v0.10.33
   Compiling quick-error v1.2.3
   Compiling foreign-types-shared v0.1.1
   Compiling termcolor v1.1.2
   Compiling once_cell v1.7.2
   Compiling linked-hash-map v0.5.4
   Compiling dtoa v0.4.8
   Compiling hex v0.4.3
   Compiling base64 v0.13.0
   Compiling byteorder v1.4.3
   Compiling fallible-iterator v0.2.0
   Compiling widestring v0.4.3
   Compiling num-traits v0.2.14
   Compiling humantime v1.3.0
   Compiling foreign-types v0.3.2
   Compiling yaml-rust v0.4.5
   Compiling aho-corasick v0.7.15
   Compiling quote v1.0.9
   Compiling atty v0.2.14
   Compiling openssl-sys v0.9.61
error: failed to run custom build command for `openssl-sys v0.9.61`

Caused by:
  process didn't exit successfully: `/root/git/src/github.com/puiterwijk/uefi-eventlog-rs/target/debug/build/openssl-sys-9c15595717dd924c/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
  cargo:rerun-if-env-changed=OPENSSL_NO_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: "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.61


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

  ', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.61/build/find_normal.rs:174:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
root@dd80ba578ce3:~/git/src/github.com/puiterwijk/uefi-eventlog-rs# 

I also tried a fresh fedora:34 container. The build failed like this:

[root@4566ec0bd118 uefi-eventlog-rs]# cargo build
    Updating crates.io index
  Downloaded env_logger v0.7.1
  Downloaded fallible-iterator v0.2.0
  Downloaded cfg-if v1.0.0
  Downloaded humantime v1.3.0
  Downloaded foreign-types v0.3.2
  Downloaded base64 v0.13.0
  Downloaded log v0.4.14
  Downloaded num-derive v0.3.3
  Downloaded num-traits v0.2.14
  Downloaded once_cell v1.7.2
  Downloaded quote v1.0.9
  Downloaded quick-error v1.2.3
  Downloaded openssl-sys v0.9.61
  Downloaded serde v1.0.125
  Downloaded serde_derive v1.0.125
  Downloaded dtoa v0.4.8
  Downloaded cc v1.0.67
  Downloaded serde_yaml v0.8.17
  Downloaded syn v1.0.69
  Downloaded yaml-rust v0.4.5
  Downloaded linked-hash-map v0.5.4
  Downloaded widestring v0.4.3
  Downloaded uuid v0.8.2
  Downloaded tpmless-tpm2 v0.3.3
  Downloaded thiserror v1.0.24
  Downloaded regex-syntax v0.6.23
  Downloaded pkg-config v0.3.19
  Downloaded termcolor v1.1.2
  Downloaded memchr v2.3.4
  Downloaded thiserror-impl v1.0.24
  Downloaded proc-macro2 v1.0.26
  Downloaded foreign-types-shared v0.1.1
  Downloaded byteorder v1.4.3
  Downloaded bitflags v1.2.1
  Downloaded atty v0.2.14
  Downloaded libc v0.2.93
  Downloaded regex v1.4.5
  Downloaded unicode-xid v0.2.1
  Downloaded pretty_env_logger v0.4.0
  Downloaded hex v0.4.3
  Downloaded autocfg v1.0.1
  Downloaded aho-corasick v0.7.15
  Downloaded openssl v0.10.33
  Downloaded 43 crates (2.5 MB) in 0.56s
   Compiling proc-macro2 v1.0.26
   Compiling unicode-xid v0.2.1
   Compiling syn v1.0.69
   Compiling autocfg v1.0.1
   Compiling libc v0.2.93
   Compiling serde_derive v1.0.125
   Compiling memchr v2.3.4
   Compiling cc v1.0.67
   Compiling pkg-config v0.3.19
   Compiling cfg-if v1.0.0
   Compiling serde v1.0.125
   Compiling bitflags v1.2.1
   Compiling log v0.4.14
   Compiling quick-error v1.2.3
   Compiling openssl v0.10.33
   Compiling foreign-types-shared v0.1.1
   Compiling regex-syntax v0.6.23
   Compiling termcolor v1.1.2
   Compiling linked-hash-map v0.5.4
   Compiling once_cell v1.7.2
   Compiling hex v0.4.3
   Compiling dtoa v0.4.8
   Compiling base64 v0.13.0
   Compiling fallible-iterator v0.2.0
   Compiling byteorder v1.4.3
   Compiling widestring v0.4.3
   Compiling humantime v1.3.0
   Compiling foreign-types v0.3.2
   Compiling num-traits v0.2.14
   Compiling yaml-rust v0.4.5
   Compiling aho-corasick v0.7.15
   Compiling quote v1.0.9
   Compiling atty v0.2.14
   Compiling openssl-sys v0.9.61
   Compiling regex v1.4.5
error: failed to run custom build command for `openssl-sys v0.9.61`

Caused by:
  process didn't exit successfully: `/root/git/src/github.com/uiterwijk/uefi-eventlog-rs/target/debug/build/openssl-sys-efb115039936d14f/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
  cargo:rerun-if-env-changed=OPENSSL_NO_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\" \"--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\nPackage \'openssl\', required by \'virtual:world\', not 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.61

  ', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.61/build/find_normal.rs:174:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
[root@4566ec0bd118 uefi-eventlog-rs]# 

FYI, in the ubuntu:21.04 container:

root@dd80ba578ce3:~/git/src/github.com/puiterwijk/uefi-eventlog-rs# rustc --version
rustc 1.50.0
root@dd80ba578ce3:~/git/src/github.com/puiterwijk/uefi-eventlog-rs# 
root@dd80ba578ce3:~/git/src/github.com/puiterwijk/uefi-eventlog-rs# dpkg -l | grep ssl
ii  libssl1.1:amd64            1.1.1j-1ubuntu3                                                      amd64        Secure Sockets Layer toolkit - shared libraries
ii  libzstd1:amd64             1.4.8+dfsg-2build1                                                   amd64        fast lossless compression algorithm
ii  openssl                    1.1.1j-1ubuntu3                                                      amd64        Secure Sockets Layer toolkit - cryptographic utility
root@dd80ba578ce3:~/git/src/github.com/puiterwijk/uefi-eventlog-rs# 

So installed libssl-dev on Ubuntu, and that still led to cargo build failing --- but now it gives me the next clue:

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

My fedora:34 container already had pkg-config by the time cargo failed; adding dnf install openssl-devel was enough to enable cargo build to succeed.