为了让二进制能跑在主流发行版上, 现在用的 cargo zigbuild --target x86_64-unknown-linux-gnu.2.17 --release
编译.
有个问题, 如果依赖的库用了 openssl, 一直提示 cargo:warning=build/expando.c:2:10: fatal error: 'openssl/opensslconf.h' file not found
系统是 debian11, 已安装 libssl-dev pkg-config
. 直接用 cargo build 能编译过的, 用 zigbuild 就不行. 因为依赖的库只能依赖 openssl, 不支持 rustls, 有没有比较好的解决办法?
1 kyonn OP .... 主动添加下 openssl 依赖就解决了, cargo add openssl --features vendored |
2 kyonn OP 有没有大佬解释下原因 |
![]() | 3 arloor 265 天前 |
4 w568w 265 天前 跨平台的话用 rustls 更好,完全不会产生外部依赖,根证书都是打包进应用的。 |
5 kyonn OP @arloor 默认 openssl 的 rust 代码是不编译 openssl ,直接调用系统的库,做了一层 wrapper ,可以这么理解吗? vendor 这个特性应该是 openssl 的 rust 库自己实现的吧?是个普遍的特性吗(是不是大部分 c 库 wrapper 都有)? |
![]() | 7 daimaosix 265 天前 openssl = { version = "0.10", features = ["vendored"] } 用 cross 构建 |