Open phydy opened 9 months ago
Can you include all of the error output?
How is OpenSSL installed in the container?
This is the full output
do docker build --tag docker-rust-image . [+] Building 28.8s (16/18) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 3.54kB 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 642B 0.0s => resolve image config for docker.io/docker/dockerfile:1 2.3s => CACHED docker-image://docker.io/docker/dockerfile:1@sha256:ac85f380a63b13dfcefa89046420e1781752bab202122f8f50032edf31be0021 0.0s => [internal] load metadata for docker.io/library/alpine:3.18 2.3s => [internal] load metadata for docker.io/library/rust:1.76.0-alpine 2.3s => [internal] load metadata for docker.io/tonistiigi/xx:1.3.0 2.3s => [build 1/6] FROM docker.io/library/rust:1.76.0-alpine@sha256:def35884ff7e1e4b0eae050cbb03ca0900d70d1acbcba1d0e428147ab6786de2 0.0s => [final 1/3] FROM docker.io/library/alpine:3.18@sha256:11e21d7b981a59554b3f822c49f6e9f57b6068bb74f49c4cd5cc4c663c7e5160 0.0s => [internal] load build context 0.0s => => transferring context: 143.91kB 0.0s => [xx 1/1] FROM docker.io/tonistiigi/xx:1.3.0@sha256:904fe94f236d36d65aeb5a2462f88f2c537b8360475f6342e7599194f291fb7e 0.0s => CACHED [build 2/6] WORKDIR /app 0.0s => CACHED [build 3/6] COPY --from=xx / / 0.0s => CACHED [build 4/6] RUN apk add --no-cache clang lld musl-dev git file 0.0s => CACHED [build 5/6] RUN xx-apk add --no-cache musl-dev gcc 0.0s => ERROR [build 6/6] RUN --mount=type=bind,source=src,target=src --mount=type=bind,source=Cargo.toml,target=Cargo.toml --mount=type=bind,source=Cargo. 24.0s
`
[build 6/6] RUN --mount=type=bind,source=src,target=src --mount=type=bind,source=Cargo.toml,target=Cargo.toml --mount=type=bind,source=Cargo.lock,target=Cargo.lock --mount=type=cache,target=/app/target/,id=rust-cache-swypt-api-linux/amd64 --mount=type=cache,target=/usr/local/cargo/git/db --mount=type=cache,target=/usr/local/cargo/registry/ xx-cargo build --locked --release --target-dir ./target && cp ./target/$(xx-cargo --print-target-triple)/release/swypt-api /bin/server && xx-verify /bin/server:
1.154 find: /sys/devices/virtual/powercap/intel-rapl-mmio: Permission denied
1.154 find: /sys/devices/virtual/powercap/intel-rapl: Permission denied 2.037 Compiling openssl-sys v0.9.100 2.037 Compiling openssl v0.10.64 2.038 Compiling ethbloom v0.13.0 2.039 Compiling primitive-types v0.12.2 2.041 Compiling want v0.3.1 2.041 Compiling wasm-bindgen-macro-support v0.2.91 2.041 Compiling impl-rlp v0.3.0 2.041 Compiling fixed-hash v0.8.0 2.041 Compiling quote v1.0.35 2.043 Compiling deranged v0.3.11 2.043 Compiling time-macros v0.2.17 2.044 Compiling impl-codec v0.6.0 2.044 Compiling scale-info v2.10.0 2.044 Compiling semver v1.0.22 2.044 Compiling http-body v0.4.6 2.044 Compiling camino v1.1.6 2.088 Compiling der v0.7.8 2.088 Compiling tiny-keccak v2.0.2 2.095 Compiling impl-serde v0.4.0 2.114 Compiling autocfg v0.1.8 2.115 Compiling num-conv v0.1.0 2.118 Compiling tower-service v0.3.2 2.164 Compiling base64 v0.13.1 2.176 Compiling waker-fn v1.1.1 2.245 Compiling time-core v0.1.2 2.252 Compiling wasm-bindgen v0.2.91 2.275 Compiling rand_core v0.4.2 2.354 Compiling ipnet v2.9.0 2.363 Compiling mime v0.3.17 2.398 Compiling openssl-probe v0.1.5 2.561 Compiling hyper v0.14.28 2.578 Compiling syn v2.0.50 2.646 Compiling futures-lite v1.13.0 2.888 error: failed to run custom build command foropenssl-sys v0.9.100
2.888 2.888 Caused by: 2.889 process didn't exit successfully:/app/./target/release/build/openssl-sys-b3d7570ab5eb5e66/build-script-main
(exit status: 101) 2.889 --- stdout 2.889 cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_NO_VENDOR 2.889 X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_NO_VENDOR unset 2.889 cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR 2.889 OPENSSL_NO_VENDOR unset 2.889 cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-musl 2.889 CC_x86_64-unknown-linux-musl = None 2.889 cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_musl 2.889 CC_x86_64_unknown_linux_musl = Some("x86_64-unknown-linux-musl-clang") 2.889 cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS 2.889 CRATE_CC_NO_DEFAULTS = None 2.889 DEBUG = Some("false") 2.889 cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-musl 2.889 CFLAGS_x86_64-unknown-linux-musl = None 2.889 cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_musl 2.889 CFLAGS_x86_64_unknown_linux_musl = None 2.889 cargo:rerun-if-env-changed=HOST_CFLAGS 2.889 HOST_CFLAGS = None 2.889 cargo:rerun-if-env-changed=CFLAGS 2.889 CFLAGS = None 2.889 cargo:rerun-if-env-changed=AR_x86_64-unknown-linux-musl 2.889 AR_x86_64-unknown-linux-musl = None 2.889 cargo:rerun-if-env-changed=AR_x86_64_unknown_linux_musl 2.889 AR_x86_64_unknown_linux_musl = None 2.889 cargo:rerun-if-env-changed=HOST_AR 2.889 HOST_AR = None 2.889 cargo:rerun-if-env-changed=AR 2.889 AR = None 2.889 cargo:rerun-if-env-changed=ARFLAGS_x86_64-unknown-linux-musl 2.889 ARFLAGS_x86_64-unknown-linux-musl = None 2.889 cargo:rerun-if-env-changed=ARFLAGS_x86_64_unknown_linux_musl 2.889 ARFLAGS_x86_64_unknown_linux_musl = None 2.889 cargo:rerun-if-env-changed=HOST_ARFLAGS 2.889 HOST_ARFLAGS = None 2.889 cargo:rerun-if-env-changed=ARFLAGS 2.889 ARFLAGS = None 2.889 cargo:rerun-if-env-changed=RANLIB_x86_64-unknown-linux-musl 2.889 RANLIB_x86_64-unknown-linux-musl = None 2.889 cargo:rerun-if-env-changed=RANLIB_x86_64_unknown_linux_musl 2.889 RANLIB_x86_64_unknown_linux_musl = None 2.889 cargo:rerun-if-env-changed=HOST_RANLIB 2.889 HOST_RANLIB = None 2.889 cargo:rerun-if-env-changed=RANLIB 2.889 RANLIB = None 2.889 cargo:rerun-if-env-changed=RANLIBFLAGS_x86_64-unknown-linux-musl 2.889 RANLIBFLAGS_x86_64-unknown-linux-musl = None 2.889 cargo:rerun-if-env-changed=RANLIBFLAGS_x86_64_unknown_linux_musl 2.889 RANLIBFLAGS_x86_64_unknown_linux_musl = None 2.889 cargo:rerun-if-env-changed=HOST_RANLIBFLAGS 2.889 HOST_RANLIBFLAGS = None 2.889 cargo:rerun-if-env-changed=RANLIBFLAGS 2.889 RANLIBFLAGS = None 2.889 running cd "/app/./target/x86_64-unknown-linux-musl/release/build/openssl-sys-7e597ec0dd58eccf/out/openssl-build/build/src" && env -u CROSS_COMPILE AR="ar" CC="x86_64-unknown-linux-musl-clang" RANLIB="ranlib" "perl" "./Configure" "--prefix=/app/./target/x86_64-unknown-linux-musl/release/build/openssl-sys-7e597ec0dd58eccf/out/openssl-build/install" "--openssldir=/usr/local/ssl" "no-dso" "no-shared" "no-ssl3" "no-tests" "no-comp" "no-zlib" "no-zlib-dynamic" "--libdir=lib" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "no-engine" "no-async" "linux-x86_64" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "--target=x86_64-unknown-linux-musl" "-DOPENSSL_NO_SECURE_MEMORY" 2.889 2.889 --- stderr 2.889 thread 'main' panicked at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-src-300.2.3+3.2.1/src/lib.rs:611:9: 2.889 2.889 2.889 2.889 Error configuring OpenSSL build: 2.889 Command: cd "/app/./target/x86_64-unknown-linux-musl/release/build/openssl-sys-7e597ec0dd58eccf/out/openssl-build/build/src" && env -u CROSS_COMPILE AR="ar" CC="x86_64-unknown-linux-musl-clang" RANLIB="ranlib" "perl" "./Configure" "--prefix=/app/./target/x86_64-unknown-linux-musl/release/build/openssl-sys-7e597ec0dd58eccf/out/openssl-build/install" "--openssldir=/usr/local/ssl" "no-dso" "no-shared" "no-ssl3" "no-tests" "no-comp" "no-zlib" "no-zlib-dynamic" "--libdir=lib" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "no-engine" "no-async" "linux-x86_64" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "--target=x86_64-unknown-linux-musl" "-DOPENSSL_NO_SECURE_MEMORY" 2.889 Failed to execute: No such file or directory (os error 2) 2.889 2.889 2.889
2.889 note: run withRUST_BACKTRACE=1
environment variable to display a backtrace 2.889 warning: build failed, waiting for other jobs to finish... Dockerfile:44 43 | # output directory before the cache mounted /app/target is unmounted. 44 | >>> RUN --mount=type=bind,source=src,target=src \ 45 | >>> --mount=type=bind,source=Cargo.toml,target=Cargo.toml \ 46 | >>> --mount=type=bind,source=Cargo.lock,target=Cargo.lock \ 47 | >>> --mount=type=cache,target=/app/target/,id=rust-cache-${APP_NAME}-${TARGETPLATFORM} \ 48 | >>> --mount=type=cache,target=/usr/local/cargo/git/db \ 49 | >>> --mount=type=cache,target=/usr/local/cargo/registry/ \ 50 | >>> xx-cargo build --locked --release --target-dir ./target && \ 51 | >>> cp ./target/$(xx-cargo --print-target-triple)/release/$APP_NAME /bin/server && \ 52 | >>> xx-verify /bin/server 53 |
ERROR: failed to solve: process "/bin/sh -c xx-cargo build --locked --release --target-dir ./target && cp ./target/$(xx-cargo --print-target-triple)/release/$APP_NAME /bin/server && xx-verify /bin/server" did not complete successfully: exit code: 101`
You probably need o install perl in the container.
Try adding openssl-dev
+ openssl-libs-static
. Since you're using xx
to cross-compile to another target, I think you'd need to add those via xx-apk
.
You probably need o install perl in the container.
I tried this and it still could not build openssl
Try adding
openssl-dev
+openssl-libs-static
. Since you're usingxx
to cross-compile to another target, I think you'd need to add those viaxx-apk
.
This managed to configure openssl butstill threw an error when building its dependencies.
Error building OpenSSL dependencies: 66.65 Command: cd "/app/./target/x86_64-unknown-linux-musl/release/build/openssl-sys-7e597ec0dd58eccf/out/openssl-build/build/src" && "make" "depend" 66.65 Failed to execute: No such file or directory (os error 2)
This managed to configure openssl butstill threw an error when building its dependencies.
You need to share more context.
Simplify what you're trying to do, ignore the cache mounts, ignore the cross-platform building with xx
. Does your Dockerfile
work then? Or is there still a problem?
xx
.Do you actually want to build OpenSSL? If you do, identify what other packages you're missing and add them until the failure goes away. Otherwise try figure out why it's trying to build OpenSSL, perhaps you just need to use OPENSSL_DIR
(to the location for openssl-libs-static
files, /usr
is sufficient normally but may be different due to xx-apk
, you'll need to figure that out) + OPENSSL_STATIC=1
(explicitly request static link).
You probably need o install perl in the container.
on my Mac m1 I was having troubles with openssl-sys
and on my environment worked a brew install perl
docker init
.RUN apk add --no-cache clang lld musl-dev git perl openssl-libs-static pkgconf openssl-dev make
openssl = { version = "0.10", features = ["vendored"] }
docker build -t myapp .
(success)docker run --privileged --rm tonistiigi/binfmt --install all
first.docker build --platform=linux/amd64 -t myapp .
just add pkgconf openssl-dev to dockerfile
RUN apk add --no-cache clang lld musl-dev pkgconf openssl-dev
ENV OPENSSL_DIR=/usr
ENV OPENSSL_LIB_DIR=/usr/lib
ENV OPENSSL_INCLUDE_DIR=/usr/include
I am trying to build a docker image but keep getting the same error despite changing openssl versions.
5 error: failed to run custom build command for openssl-sys v0.9.100 Caused by: process didn't exit successfully:
/app/./target/release/build/openssl-sys-ad9c51fb308547bd/build-script-main(exit status: 101)
ERROR: failed to solve: process "/bin/sh -c xx-cargo build --locked --release --target-dir ./target && cp ./target/$(xx-cargo --print-target-triple)/release/$APP_NAME /bin/server && xx-verify /bin/server" did not complete successfully: exit code: 101
I have configured all openssl deps including explicitly exporting is dir