简体   繁体   English

我如何使“ rustc”的注释静音,以免链接到哪些本地工件?

[英]How can I silence `rustc`'s note about which native artifacts to link against?

I've got a project where Rust source files are being automatically generated and compiled into static libraries. 我有一个项目,其中Rust源文件被自动生成并编译到静态库中。 I'd like the output of rustc to be streamed to stdout and stderr as usual, but I wish that the following note wasn't always emitted: 我希望将rustc输出像往常一样流式传输到stdout和stderr,但我希望并非总是发出以下注释:

note: link against the following native artifacts when linking against this static library

note: the order and any duplication can be significant on some platforms, and so may need to be preserved

note: library: System

note: library: resolv

note: library: c

note: library: m

Is there any way to silence this without silencing too much else? 有什么办法可以在不使其他内容沉默太多的情况下将其静音? The note was useful to me when I was figuring out how to link things automatically, but it won't be useful to my users who never actually see the linking process. 当我想出如何自动链接内容时,该注释对我很有用,但对于从未真正看到链接过程的用户而言,它将无用。

In Rust 1.21 and earlier, there is no way to turn off the output. 在Rust 1.21和更早的版本中,无法关闭输出。

In Rust 1.22, the --print=native-static-libs option was added. 在Rust 1.22中,添加了--print=native-static-libs选项。 When it is not present, it outputs: 如果不存在,则输出:

note: This list will not be printed by default. 注意:默认情况下不会打印此列表。 Please add --print native-static-libs if you need this information. 如果需要此信息,请添加--print native-static-libs。

Adding the option will silence the warning. 添加该选项将使警告静音。

To silence this information without silencing anything else, upgrade to Rust 1.23 once it's released. 要使此信息静音而不使其他任何内容静默,请在Rust 1.23发布后将其升级。

https://github.com/rust-lang/rust/pull/43067 https://github.com/rust-lang/rust/pull/43067

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何找到 rustc --target=$TARGET 将链接到哪个 libc.so? - How to find which libc.so will `rustc --target=$TARGET` link against? 我可以获得Rust链接的本机工件的完整路径吗? - Can I get the full path of native artifacts that Rust links against? 我如何查询主机三元组的 rustc? - How can I query rustc for the host triple? 如何相对于项目位置进行 rustc-link-search? - How do I make rustc-link-search relative to the project location? rustc 可以给我更多关于类型歧义错误的细节吗? - Can rustc give me more detail about type ambiguity errors? 如何在外部板条箱中对宏中的Rust警告进行静音? - How can I silence Rust warnings in macros from external crates? 如何使用 glibc 而不是 musl 创建带有 rustc 的 static 可执行文件? - How can I create a static executable with rustc using glibc instead of musl? 如何仅使用rustc而不使用商品链接动态Rust库? - How to link a dynamic Rust library using only rustc and not cargo? 如果标记包含空格,如何将标记从构建脚本传递给rustc? - How can I pass flags to rustc from a build script if they contain a space? 如何在现有项目中对Cargo进行类似的依赖解析,并且只使用rustc进行代码分析? - How can I get similar dependency resolution to Cargo in an existing project with only rustc for code analysis?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM