我正在尝试使用Cross交叉编译Rust项目
我收到一个错误,我想通过设置环境变量RUST_BACKTRACE=1
来跟踪进程
但我不知道如何在使用Cross时这样做。
编辑
我使用的是命令cross build --target aarch64-unknown-linux-gnu
这是我的“cross.toml”目录
[target.aarch64-unknown-linux-gnu]
openssl-sys = "0.9.76"
[build.env]
passthrough = [
"RUST_BACKTRACE",
"RUST_LOG",
"TRAVIS",
]
[target.aarch64-unknown-linux-gnu.env]
passthrough = [
"RUST_DEBUG",
]
我在尝试编译时收到以下错误
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 = aarch64-unknown-linux-gnu
openssl-sys = 0.9.76
', /cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.76/build/find_normal.rs:191:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
1条答案
按热度按时间9bfwbjaz1#
在Cross.toml中使用
passthrough
只是 * 传递 * 你的本地环境变量。所以在你的例子中,它是按预期工作的,但它没有按你希望的那样工作的原因是因为RUST_BACKTRACE
变量没有设置。在Linux/Unix(mac)中,您可以通过例如写入
echo $RUST_BACKTRACE
来检查环境变量的值,并通过写入RUST_BACKTRACE=1
来临时设置它。因此,为了设置cross中的变量,您可以在运行如下命令时设置
RUST_BACKTRACE
:或者,您可以直接在
Cross.toml
配置中设置该值,如下所示: