什么是构建依赖性?
"Build dependencies" explained in the cargo book:
You can depend on other Cargo-based crates for use in your build scripts. Dependencies are declared through the
build-dependencies
section of the manifest
I have difficulty in understanding what exactly this means and what's the difference between the normal dependencies
and build-dependencies
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它们有点不同:
依赖项
:您可以在通常的src
目录下使用它们,该目录通常是您为主程序编写源代码build依赖性
:您可以在build.rs
中使用它们 ,该用于准备一些外部(即系统范围的共享库)或调用外部命令(即在构建程序之前,C或C ++编译器)。build.rs
称为“ nofollow noreferrer”>“构建脚本。”They're a bit different:
dependencies
: You can use them under the usualsrc
directory which is normally you write your source code for the main programbuild-dependencies
: You can use them only inbuild.rs
on project root, which is used to prepare some external (i.e. system-wide shared library) dependencies or invoke external command (i.e. the C or C++ compiler) before the program being built. Thebuild.rs
is called "build script."