rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
99.07k stars 12.79k forks source link

rustc fails when including some C++ libs because of wasm32 linker fatal warnings #61846

Open jrandall opened 5 years ago

jrandall commented 5 years ago

rustc is now passing the argument --fatal-warnings to lld on wasm32 (wasm-ld). This appears to have been added in https://github.com/rust-lang/rust/pull/54258

While I agree with the sentiment in the comment "Rust code should never have warnings, and warnings are often indicative of bugs, let's prevent them", unfortunately the same cannot apparently be said of C++ code.

I am currently getting bitten by "harmless" warnings due to a bug in LLVM: https://bugs.llvm.org/show_bug.cgi?id=40412

Unfortunately, because rustc is passing --fatal-warnings to wasm-ld, these warnings are not harmless to me but rather prevent me from linking the C++ library into my rust project.

I looked for an override such as --no-fatal-warnings but there does not appear to be one. Could we perhaps add an option to rustc such that the --fatal-warnings option can be suppressed (maybe via RUSTFLAGS) in cases where for whatever reason we run into otherwise harmless LLVM warnings?

jrandall commented 5 years ago

I believe this issue should have resolved itself from rust 1.38.0, as that has updated to llvm 9.0 which I believe no longer emits this particular warning for C++ code in wasm. I will verify this and update here.

bjorn3 commented 2 days ago

Has this been fixed?