gpt4 book ai didi

ubuntu - 为ARM编译时openssl无法编译,否则工作正常

转载 作者:行者123 更新时间:2023-12-04 18:37:12 28 4
gpt4 key购买 nike

所以最近我一直在为 ARM 编译一个 Rust 项目。它可以完美地为 x86 编译,但每当我切换到 ARM 目标时,它都找不到 Openssl 安装,我已经安装了 pkg-config 并正在运行,所以它不是那个错误。不确定如何成功设置 OPENSSL_DIR 变量或自己在哪里找到安装。错误已完整粘贴在下面

error: failed to run custom build command for `openssl-sys v0.9.61`

Caused by:
process didn't exit successfully: `/home/bob/yagna/blueberry/debug/build/openssl-sys-aae22c7790b14724/build-script-main` (exit code: 101)
--- stdout
cargo:rustc-cfg=const_fn
cargo:rerun-if-env-changed=ARMV7_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_LIB_DIR
ARMV7_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=ARMV7_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_INCLUDE_DIR
ARMV7_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=ARMV7_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_DIR
ARMV7_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_DIR
OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_armv7-unknown-linux-gnueabihf
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_armv7_unknown_linux_gnueabihf
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_armv7-unknown-linux-gnueabihf
cargo:rerun-if-env-changed=PKG_CONFIG_armv7_unknown_linux_gnueabihf
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_armv7-unknown-linux-gnueabihf
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_armv7_unknown_linux_gnueabihf
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
run pkg_config fail: "pkg-config has not been configured to support cross-compilation.\n\n Install a sysroot for the target platform and configure it via\n PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a\n cross-compiling wrapper for pkg-config and set it via\n PKG_CONFIG environment variable."

--- stderr
thread 'main' panicked at '

Could not find directory of OpenSSL installation, and this `-sys` crate cannot
proceed without this knowledge. If OpenSSL is installed and this crate had
trouble finding it, you can set the `OPENSSL_DIR` environment variable for the
compilation process.

Make sure you also have the development packages of openssl installed.
For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

If you're in a situation where you think the directory *should* be found
automatically, please open a bug at https://github.com/sfackler/rust-openssl
and include information about your system as well as this message.

$HOST = x86_64-unknown-linux-gnu
$TARGET = armv7-unknown-linux-gnueabihf
openssl-sys = 0.9.61

', /home/bob/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.61/build/find_normal.rs:174:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

.cargo 配置文件也如下

[build]
target-dir="/home/bob/yagna/blueberry"
target="armv7-unknown-linux-gnueabihf"
linker = "arm-linux-gnueabihf-gcc"
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"

不知道该怎么办,这个ubuntu,我安装了libssl-dev并且是最新的,添加了目标并使用rustup和sudo apt get进行安装。不知道如何解决这个问题

最佳答案

如果您正在使用 OpenSSL 编译 armhf 的内容,那么您需要有 libssl-dev为该架构安装的软件包。这将涉及通过 dpkg --add-architecture armhf 为其设置 dpkg然后做 apt-get updateapt-get install libssl-dev:armhf .

请注意,可能无法安装 libssl-dev 的多个版本立即解决依赖关系,但最终不会删除大量包可能会很棘手。 Debian 风格的多架构非常强大,但有时可能有点繁琐。

您绝对不应该供应 OpenSSL,因为它经常发布安全更新。同样,静态链接 OpenSSL 也是一个坏主意。如果您使用供应商或静态链接它,除非您非常小心地使其保持最新,否则您的代码将包含安全漏洞。

关于ubuntu - 为ARM编译时openssl无法编译,否则工作正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67046689/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com