简体   繁体   English

` 错误:无法为 `openssl-sys v0.9.67` 运行自定义构建命令

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

I am building my cargo docker file.我正在构建我的 cargo docker 文件。 It used to work now it doesn't.它以前可以工作,现在不行了。

I am receiving this error: error: failed to run custom build command for `openssl-sys v0.9.67我收到此错误: error: failed to run custom build command for `openssl-sys v0.9.67

I did multiple things based on my multiple digging:根据我的多次挖掘,我做了很多事情:

brew install openssl

brew install pkg-config

brew install perl

I added the below in my dependencies in the cargo.toml as well我也在 cargo.toml 的依赖项中添加了以下内容

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

I even added the below on my.profile我什至在 my.profile 上添加了以下内容

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

Still not working.还是行不通。 The error only shows during the docker build run.该错误仅在 docker 构建运行期间显示。

---here's the error--- ---这是错误---

#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

---below is the my docker file--- ---下面是我的 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"] CMD ["/build-xxx/target/release/xxx"]

Since my error is only happening in the docker build, I updated dockerfile and add the dependencies (build-essential checkinstall zlib1g-dev) required for the OpenSSL.由于我的错误只发生在 docker 版本中,我更新了 dockerfile 并添加了 OpenSSL 所需的依赖项(build-essential checkinstall zlib1g-dev)。

I changed my docker file to the one below, and it works!我将我的 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.

相关问题 错误:无法使用 Rust/Anchor 为 `openssl-sys v0.9.72` 运行自定义构建命令 - error: failed to run custom build command for `openssl-sys v0.9.72` using Rust/Anchor 错误:无法为 `openssl v0.9.24` 运行自定义构建命令 - error: failed to run custom build command for `openssl v0.9.24` 为什么即使在本地安装后 rust 也无法为 openssl-sys v0.9.60 构建命令? - Why rust is failing to build command for openssl-sys v0.9.60 even after local installation? 错误:无法为 `gmp-mpfr-sys v1.4.0` 运行自定义构建命令 - Error: Failed to run custom build command for `gmp-mpfr-sys v1.4.0` 错误:无法为 libudev-sys v0.1.4 运行自定义构建命令 - error: failed to run custom build command for `libudev-sys v0.1.4` 一些错误无法为 `librocksdb-sys v6.11.4` 运行自定义构建命令 - some error failed to run custom build command for `librocksdb-sys v6.11.4` 在Windows上构建openssl-sys条板箱时出错 - Error building openssl-sys crate on Windows 货物错误:无法为“atk-sys v0.10.0”运行自定义构建命令 - Cargo error: failed to run custom build command for `atk-sys v0.10.0` Rust 编译错误“无法为 `freetype-sys v0.13.1' 运行自定义构建命令”win 10 - Rust compilation error " failed to run custom build command for `freetype-sys v0.13.1' " win 10 错误:无法为onig_sys v61.1.0运行自定义生成命令 - error: failed to run custom build command for `onig_sys v61.1.0`
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM