簡體   English   中英

` 錯誤:無法為 `openssl-sys v0.9.67` 運行自定義構建命令

[英]` error: failed to run custom build command for `openssl-sys v0.9.67`

我正在構建我的 cargo docker 文件。 它以前可以工作,現在不行了。

我收到此錯誤: error: failed to run custom build command for `openssl-sys v0.9.67

根據我的多次挖掘,我做了很多事情:

brew install openssl

brew install pkg-config

brew install perl

我也在 cargo.toml 的依賴項中添加了以下內容

openssl-sys = "0.9"
openssl = { version = "0.10.33", features = ["vendored"] }

我什至在 my.profile 上添加了以下內容

export PKG_CONFIG_PATH="/usr/local/opt/openssl@3/lib/pkgconfig"

還是行不通。 該錯誤僅在 docker 構建運行期間顯示。

---這是錯誤---

#7 133.6 error: failed to run custom build command for `openssl-sys v0.9.67`
#7 133.6 
#7 133.6 Caused by:
#7 133.6   process didn't exit successfully: `/build-xxx/target/release/build/openssl-sys-bb0d0329fb009fff/build-script-main` (exit status: 101)
#7 133.6   --- stdout
#7 133.6   cargo:rustc-cfg=const_fn
#7 133.6   cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_NO_VENDOR
#7 133.6   X86_64_UNKNOWN_LINUX_GNU_OPENSSL_NO_VENDOR unset
#7 133.6   cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
#7 133.6   OPENSSL_NO_VENDOR unset
#7 133.6   CC_x86_64-unknown-linux-gnu = None
#7 133.6   CC_x86_64_unknown_linux_gnu = None
#7 133.6   HOST_CC = None
#7 133.6   CC = None
#7 133.6   CFLAGS_x86_64-unknown-linux-gnu = None
#7 133.6   CFLAGS_x86_64_unknown_linux_gnu = None
#7 133.6   HOST_CFLAGS = None
#7 133.6   CFLAGS = None
#7 133.6   CRATE_CC_NO_DEFAULTS = None
#7 133.6   DEBUG = Some("false")
#7 133.6   CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
#7 133.6   running "perl" "./Configure" "--prefix=/build-xxx/target/release/build/openssl-sys-c2883a05afa95d60/out/openssl-build/install" "no-dso" "no-shared" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "linux-x86_64" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64"
#7 133.6 
#7 133.6   --- stderr
#7 133.6   Can't locate FindBin.pm in @INC (you may need to install the FindBin module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at ./Configure line 15.
#7 133.6   BEGIN failed--compilation aborted at ./Configure line 15.
#7 133.6   thread 'main' panicked at '
#7 133.6 
#7 133.6 
#7 133.6   Error configuring OpenSSL build:
#7 133.6       Command: "perl" "./Configure" "--prefix=/build-xxx/target/release/build/openssl-sys-c2883a05afa95d60/out/openssl-build/install" "no-dso" "no-shared" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "linux-x86_64" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64"
#7 133.6       Exit status: exit status: 2
#7 133.6 
#7 133.6 
#7 133.6       ', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/openssl-src-111.16.0+1.1.1l/src/lib.rs:479:13
#7 133.6   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
#7 133.6 warning: build failed, waiting for other jobs to finish...
#7 133.7 error: build failed
#7 ERROR: executor failed running [/bin/sh -c cd /build-xxx/ && rustup default nightly && rustup update && cargo build --release]: exit code: 101

---下面是我的 docker 文件---

FROM rust:slim
COPY . /build-xxx/
RUN cd /build-xxx/ && rustup default nightly && rustup update && cargo build --release
LABEL Name=XXX Version=0.0.1
EXPOSE 8000
ENV ROCKET_ENV=stage

CMD ["/build-xxx/target/release/xxx"]

由於我的錯誤只發生在 docker 版本中,我更新了 dockerfile 並添加了 OpenSSL 所需的依賴項(build-essential checkinstall zlib1g-dev)。

我將我的 docker 文件更改為下面的文件,並且有效!

FROM rust:slim
RUN apt-get update && apt-get install -y \
build-essential checkinstall zlib1g-dev -y
COPY . /build-xxx/
RUN cd /build-xxx/ && rustup default nightly && rustup update && cargo build --release
LABEL Name=XXX Version=0.0.1
EXPOSE 8000
ENV ROCKET_ENV=stage
CMD ["/build-xxx/target/release/xxx"]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM