生锈的标志是“链接自由式的”与货物交叉相比?
How does link-self-contained
work with cross
, which is described as
“Zero setup” cross compilation and “cross testing” of Rust crates
Versus the link-self-contained
option of rustc?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这些工具都有不同的目标,因此您不会选择一个目标。
链接 - 封装
选择构建一个自包含的可执行文件,该可执行文件将拥有在任何正确体系结构的系统上运行所需的一切。这包括可执行文件使用的所有库。替代方案(默认值)将用于可执行文件,以查找运行时安装在系统上的库。查看动态与静态库,以了解有关此信息的更多信息。Cross
可以使工具更容易交叉编译和测试不同的体系结构。很多时候,运行时环境将拥有最少的资源,并且在开发过程中不理想。使用交叉编译,以便可以在具有更多资源的机器上进行开发。设置交叉编译器通常需要一些时间来手动进行操作,因此该工具旨在使该过程变得更加简单。至于它们如何一起工作,理想情况下,它们在使用两者时都会以相同的方式执行。如果您交叉编译ARM架构并设置
链接链接
标志,那么您最终将获得一个自包装的二进制文件,该二进制可以使用正确的ARM体系结构移至任何系统并拥有一切它需要运行。These tools both have different goals so they aren't something that you would choose one over the other.
link-self-contained
is choosing to build a self contained executable that will have everything it needs to run on any system that is the correct architecture. This includes any libraries that are used by the executable. The alternative (default) would be for the executable to look for libraries that are installed on the system when it is ran. Take a look into dynamic vs static libraries for more information on this.cross
is tooling to make it easier to cross compile and test for different architectures. Many times the runtime environment will have minimal resources and is not ideal to work on during the development process. Cross compiling is used so that development can be done on a machine with more resources. Setting up a cross compiler usually takes some time to do manually and so this tooling aims to make that process much simpler.As far as how these work together, ideally they would perform the same way when both are being used. If you cross compile for an arm architecture and set the
link-self-contained
flag, then you will end up with a self contained binary that can be moved to any system using the correct arm architecture and have everything it needs to run.