我在编译Rust lambda时遇到了一些问题。这些问题是在我包含rusoto包之后开始的,它正在抱怨链接器问题(选项和库)。
我在跑步:
cargo lambda build
获取:
= note: warning: unsupported linker arg: -znoexecstack
warning: unsupported linker arg: -zrelro
warning: unsupported linker arg: -znow
ld.lld: error: unable to find library -lssl
ld.lld: error: unable to find library -lcrypto
我的货物。
[package]
name = "super-lambda"
version = "0.1.0"
edition = "2021"
# Starting in Rust 1.62 you can use `cargo add` to add dependencies
# to your project.
#
# If you're using an older Rust version,
# download cargo-edit(https://github.com/killercup/cargo-edit#installation)
# to install the `add` subcommand.
#
# Running `cargo add DEPENDENCY_NAME` will
# add the latest version of a dependency to the list,
# and it will keep the alphabetic ordering for you.
[dependencies]
lambda_http = "0.7"
lambda_runtime = "0.7"
lazy_static = "1.4.0"
rusoto_core = "0.48.0"
rusoto_dynamodb = "0.48.0"
serde = "1.0.149"
tokio = { version = "1", features = ["macros"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
我确实试过禁用zig-linker:
cargo lambda build --disable-zig-linker
然后它编译,但AWS会抱怨:
/var/task/bootstrap: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory
我能做些什么来解决这个问题?
1条答案
按热度按时间ie3xauqp1#
Cargo-lambda将针对
x86_64-unknown-linux-gnu
进行交叉编译。为了避免依赖libssl依赖项,您可以尝试使用rustls
为x1m2 n1 a构建项目。您应该能够为rusoto
启用rustls
功能,如下所示:您还可以看到与此主题相关的GitHub issue。
如果您使用的是Linux,您可能会尝试安装
libssl-dev
并再次构建它。但是,根据我的经验,zigbuild
(cargo-lambda
用于交叉编译)可能很难找到这种依赖关系。