-
-
Notifications
You must be signed in to change notification settings - Fork 792
Closed
Description
I'm trying to build a binary for AWS Lambda here and have been stuck trying to get openssl-sys
to build for a long time. I'm getting the error "Could not find directory of OpenSSL installation" even though I have libssl-dev
installed, and even I tried throwing openssl
in there for good measure.
I've tried exploring the resulting file system of the docker container to see where I could point OPENSSL_DIR
, but I can't find anything containing an include
and a lib
directory like the build asks for.
OpenSSL is just being installed here in a very standard way, I don't see why it can't be found.
Thanks!
My Dockerfile
:
FROM rust:1.63.0
RUN apt update
RUN apt install -y musl-tools pkg-config libssl-dev openssl
RUN rustup override set nightly-2022-08-09
RUN rustup target add x86_64-unknown-linux-musl
WORKDIR /build
COPY Cargo.lock .
COPY Cargo.toml .
RUN mkdir src
RUN echo "fn main() {}" > src/main.rs
RUN cargo build --release --target x86_64-unknown-linux-musl
My Cargo.toml
:
[package]
name = "rust-dbucket"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
aws-config = "0.47.0"
aws-sdk-dynamodb = "0.17.0"
aws-sdk-secretsmanager = "0.17.0"
aws-smithy-client = { version = "0.47.0", features = ["test-util"] }
aws-smithy-http = "0.47.0"
base64 = "0.13.0"
chrono = "0.4.22"
color-eyre = "0.6.2"
derive_more = "0.99.17"
enum-iterator = "1.2.0"
futures = "0.3.24"
insta = "1.19.1"
itertools = "0.10.3"
juniper = "0.15.10"
juniper_rocket = "0.8.2"
lambda-web = { version = "0.2.0", features = ["rocket05"] }
reqwest = { version = "0.11.11", features = ["json"] }
rocket = "0.5.0-rc.2"
# Change back to crates.io version when https://github.com/lawliet89/rocket_cors/pull/108 is published
rocket_cors = { git = "https://github.com/lawliet89/rocket_cors.git", rev = "54fae070" }
roxmltree = "0.15.0"
sentry = "0.27.0"
serde = { version = "1.0.144", features = ["derive"] }
serde_dynamo = { version = "4.0.6", features = ["aws-sdk-dynamodb+0_17"] }
serde_json = "1.0.85"
tokio = "1.20.1"
The error that I'm seeing:
#16 41.19 error: failed to run custom build command for `openssl-sys v0.9.75`
#16 41.19
#16 41.19 Caused by:
#16 41.19 process didn't exit successfully: `/build/target/release/build/openssl-sys-bae4e2ea767ca796/build-script-main` (exit status: 101)
#16 41.19 --- stdout
#16 41.19 cargo:rustc-cfg=const_fn
#16 41.19 cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR
#16 41.19 X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR unset
#16 41.19 cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
#16 41.19 OPENSSL_LIB_DIR unset
#16 41.19 cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_INCLUDE_DIR
#16 41.19 X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_INCLUDE_DIR unset
#16 41.19 cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
#16 41.19 OPENSSL_INCLUDE_DIR unset
#16 41.19 cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_DIR
#16 41.19 X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_DIR unset
#16 41.19 cargo:rerun-if-env-changed=OPENSSL_DIR
#16 41.19 OPENSSL_DIR unset
#16 41.19 cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
#16 41.19 cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64-unknown-linux-musl
#16 41.19 cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64_unknown_linux_musl
#16 41.19 cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
#16 41.19 cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
#16 41.19 cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-musl
#16 41.19 cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_musl
#16 41.19 cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
#16 41.19 cargo:rerun-if-env-changed=PKG_CONFIG
#16 41.19 cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-musl
#16 41.19 cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_musl
#16 41.19 cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
#16 41.19 cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
#16 41.19 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."
#16 41.19
#16 41.19 --- stderr
#16 41.19 thread 'main' panicked at '
#16 41.19
#16 41.19 Could not find directory of OpenSSL installation, and this `-sys` crate cannot
#16 41.19 proceed without this knowledge. If OpenSSL is installed and this crate had
#16 41.19 trouble finding it, you can set the `OPENSSL_DIR` environment variable for the
#16 41.19 compilation process.
#16 41.19
#16 41.19 Make sure you also have the development packages of openssl installed.
#16 41.19 For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.
#16 41.19
#16 41.19 If you're in a situation where you think the directory *should* be found
#16 41.19 automatically, please open a bug at https://github.com/sfackler/rust-openssl
#16 41.19 and include information about your system as well as this message.
#16 41.19
#16 41.19 $HOST = x86_64-unknown-linux-gnu
#16 41.19 $TARGET = x86_64-unknown-linux-musl
#16 41.19 openssl-sys = 0.9.75
#16 41.19
#16 41.19 ', /usr/local/cargo/registry/src/git.colasdn.top-1ecc6299db9ec823/openssl-sys-0.9.75/build/find_normal.rs:191:5
#16 41.19 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
#16 41.19 warning: build failed, waiting for other jobs to finish...
------
executor failed running [/bin/sh -c cargo build --release --target x86_64-unknown-linux-musl]: exit code: 101
Metadata
Metadata
Assignees
Labels
No labels