Skip to content

Failed to run custom build command for openssl-sys v0.9.80 #1853

Closed
@Dmdv

Description

@Dmdv

I have the following Dockefile. It used to work but now is failing.

FROM rust:slim AS builder

RUN apt-get update -y && \
  apt-get install -y make g++ libssl-dev && \
  rustup target add x86_64-unknown-linux-gnu

WORKDIR /app
COPY . .

RUN cargo build --release --target x86_64-unknown-linux-gnu


FROM gcr.io/distroless/cc
COPY --from=builder /app/target/x86_64-unknown-linux-gnu/release/rebot /bin/rebot
ENTRYPOINT [ "/bin/rebot" ]

I have this error

#11 426.3 error: failed to run custom build command for `openssl-sys v0.9.80`
#11 426.3
#11 426.3 Caused by:
#11 426.3   process didn't exit successfully: `/app/target/release/build/openssl-sys-a00b6be9953405cd/build-script-main` (exit status: 101)
#11 426.3   --- stdout
#11 426.3   cargo:rustc-cfg=const_fn
#11 426.3   cargo:rustc-cfg=openssl
#11 426.3   cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
#11 426.3   X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR unset
#11 426.3   cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
#11 426.3   OPENSSL_LIB_DIR unset
#11 426.3   cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
#11 426.3   X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR unset
#11 426.3   cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
#11 426.3   OPENSSL_INCLUDE_DIR unset
#11 426.3   cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
#11 426.3   X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR unset
#11 426.3   cargo:rerun-if-env-changed=OPENSSL_DIR
#11 426.3   OPENSSL_DIR unset
#11 426.3   cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
#11 426.3   cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64-unknown-linux-gnu
#11 426.3   cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64_unknown_linux_gnu
#11 426.3   cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
#11 426.3   cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
#11 426.3   cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
#11 426.3   cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
#11 426.3   cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
#11 426.3   cargo:rerun-if-env-changed=PKG_CONFIG
#11 426.3   cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
#11 426.3   cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
#11 426.3   cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
#11 426.3   cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
#11 426.3   run pkg_config fail: "pkg-config has not been configured to support cross-compilation.\n\nInstall a sysroot for the target platform and configure it via\nPKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a\ncross-compiling wrapper for pkg-config and set it via\nPKG_CONFIG environment variable."
#11 426.3
#11 426.3   --- stderr
#11 426.3   thread 'main' panicked at '
#11 426.3
#11 426.3   Could not find directory of OpenSSL installation, and this `-sys` crate cannot
#11 426.3   proceed without this knowledge. If OpenSSL is installed and this crate had
#11 426.3   trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
#11 426.3   compilation process.
#11 426.3
#11 426.3   Make sure you also have the development packages of openssl installed.
#11 426.3   For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.
#11 426.3
#11 426.3   If you're in a situation where you think the directory *should* be found
#11 426.3   automatically, please open a bug at https://github.com/sfackler/rust-openssl
#11 426.3   and include information about your system as well as this message.
#11 426.3
#11 426.3   $HOST = aarch64-unknown-linux-gnu
#11 426.3   $TARGET = x86_64-unknown-linux-gnu
#11 426.3   openssl-sys = 0.9.80
#11 426.3
#11 426.3
#11 426.3   It looks like you're compiling on Linux and also targeting Linux. Currently this
#11 426.3   requires the `pkg-config` utility to find OpenSSL but unfortunately `pkg-config`
#11 426.3   could not be found. If you have OpenSSL installed you can likely fix this by
#11 426.3   installing `pkg-config`.
#11 426.3
#11 426.3   ', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.80/build/find_normal.rs:191:5
#11 426.3   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
#11 426.3 warning: build failed, waiting for other jobs to finish...
------
executor failed running [/bin/sh -c cargo build --release --target x86_64-unknown-linux-gnu]: exit code: 101

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions