镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

libm 0.2.12 breaks rust-gpu #242

Closed

Description

@simensgreen

Summary

libm 0.2.12+ breaks rust-gpu due to introducing new intrinsics that interact with rustc. We have a bit of a weird way to process these intrinsics and emit the corresponding SPIR-V (potentially with GLSL extensions) that needs to be updated to understand these new intrinsics. For now, we're locking libm to 0.2.11 to prevent new projects or cargo update from picking up newer broken versions.

Expected Behaviour

Successful compilation

Example & Steps To Reproduce

  1. clone repository https://github.com/simensgreen/rust_gpu_union_issue
  2. cargo build

System Info

  • Rust: rustc 1.84.0-nightly (b19329a37 2024-11-21)
  • OS: MacOS 15.3.2
  • GPU: M2 Max

Backtrace

Backtrace

thread 'rustc' panicked at compiler/rustc_middle/src/ty/mod.rs:1676:13:
Box<dyn Any>
stack backtrace:
   0:        0x1129ed7b0 - std::backtrace::Backtrace::create::hf5e5ba1728bb8de7
   1:        0x110844da8 - <alloc[e2e5e8515d00274d]::boxed::Box<rustc_driver_impl[c6ade677a6b0e20c]::install_ice_hook::{closure#0}> as core[924c651d484e1a25]::ops::function::Fn<(&dyn for<'a, 'b> core[924c651d484e1a25]::ops::function::Fn<(&'a std[fc297465fa958267]::panic::PanicHookInfo<'b>,), Output = ()> + core[924c651d484e1a25]::marker::Send + core[924c651d484e1a25]::marker::Sync, &std[fc297465fa958267]::panic::PanicHookInfo)>>::call
   2:        0x110844bb0 - <alloc[e2e5e8515d00274d]::boxed::Box<rustc_driver_impl[c6ade677a6b0e20c]::install_ice_hook::{closure#0}> as core[924c651d484e1a25]::ops::function::Fn<(&dyn for<'a, 'b> core[924c651d484e1a25]::ops::function::Fn<(&'a std[fc297465fa958267]::panic::PanicHookInfo<'b>,), Output = ()> + core[924c651d484e1a25]::marker::Send + core[924c651d484e1a25]::marker::Sync, &std[fc297465fa958267]::panic::PanicHookInfo)>>::call
   3:        0x112a07edc - std::panicking::rust_panic_with_hook::heb73fc7746f92ba7
   4:        0x1108e9718 - std[fc297465fa958267]::panicking::begin_panic::<rustc_errors[caf545eadef7fdd]::ExplicitBug>::{closure#0}
   5:        0x1108e94d0 - std[fc297465fa958267]::sys::backtrace::__rust_end_short_backtrace::<std[fc297465fa958267]::panicking::begin_panic<rustc_errors[caf545eadef7fdd]::ExplicitBug>::{closure#0}, !>
   6:        0x11516c04c - std[fc297465fa958267]::panicking::begin_panic::<rustc_errors[caf545eadef7fdd]::ExplicitBug>
   7:        0x1108efad4 - <rustc_errors[caf545eadef7fdd]::diagnostic::BugAbort as rustc_errors[caf545eadef7fdd]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   8:        0x111590098 - rustc_middle[dc5a577fd6f5eb51]::util::bug::opt_span_bug_fmt::<rustc_span[60df94d8028129a3]::span_encoding::Span>::{closure#0}
   9:        0x11158eb1c - rustc_middle[dc5a577fd6f5eb51]::ty::context::tls::with_opt::<rustc_middle[dc5a577fd6f5eb51]::util::bug::opt_span_bug_fmt<rustc_span[60df94d8028129a3]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  10:        0x11158eae8 - rustc_middle[dc5a577fd6f5eb51]::ty::context::tls::with_context_opt::<rustc_middle[dc5a577fd6f5eb51]::ty::context::tls::with_opt<rustc_middle[dc5a577fd6f5eb51]::util::bug::opt_span_bug_fmt<rustc_span[60df94d8028129a3]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  11:        0x115218d90 - rustc_middle[dc5a577fd6f5eb51]::util::bug::bug_fmt
  12:        0x11154678c - <rustc_middle[dc5a577fd6f5eb51]::ty::context::TyCtxt>::item_name
  13:        0x10a88e08c - rustc_codegen_spirv::codegen_cx::declare::<impl rustc_codegen_spirv::codegen_cx::CodegenCx>::declare_fn_ext::h62af5aed91b065ab
  14:        0x10a88f6bc - rustc_codegen_spirv::codegen_cx::declare::<impl rustc_codegen_spirv::maybe_pqp_cg_ssa::traits::declare::PreDefineCodegenMethods for rustc_codegen_spirv::codegen_cx::CodegenCx>::predefine_fn::hb68792579dcb451d
  15:        0x10a81f738 - <rustc_middle::mir::mono::MonoItem as rustc_codegen_spirv::maybe_pqp_cg_ssa::mono_item::MonoItemExt>::predefine::h9fc0a1eadbbb089b
  16:        0x10a803d74 - <rustc_codegen_spirv::SpirvCodegenBackend as rustc_codegen_spirv::maybe_pqp_cg_ssa::traits::backend::ExtraBackendMethods>::compile_codegen_unit::{{closure}}::h0debe4e59a7b21f1
  17:        0x10a803820 - <rustc_codegen_spirv::SpirvCodegenBackend as rustc_codegen_spirv::maybe_pqp_cg_ssa::traits::backend::ExtraBackendMethods>::compile_codegen_unit::h1919ebc51166cdfc
  18:        0x10a8a55e0 - rustc_codegen_spirv::maybe_pqp_cg_ssa::base::codegen_crate::hef28e44872569f65
  19:        0x10a8024f8 - <rustc_codegen_spirv::SpirvCodegenBackend as rustc_codegen_spirv::maybe_pqp_cg_ssa::traits::backend::CodegenBackend>::codegen_crate::hffbf186d2f0b9484
  20:        0x1110dbad8 - <rustc_session[3e2f7db2cc04b493]::session::Session>::time::<alloc[e2e5e8515d00274d]::boxed::Box<dyn core[924c651d484e1a25]::any::Any>, rustc_interface[fb6f1569d3f1850c]::passes::start_codegen::{closure#0}>
  21:        0x11120add4 - rustc_interface[fb6f1569d3f1850c]::passes::start_codegen
  22:        0x1111985f0 - <rustc_interface[fb6f1569d3f1850c]::queries::Linker>::codegen_and_build_linker
  23:        0x11082dd20 - <rustc_middle[dc5a577fd6f5eb51]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[c6ade677a6b0e20c]::run_compiler::{closure#0}::{closure#1}::{closure#7}, core[924c651d484e1a25]::result::Result<core[924c651d484e1a25]::option::Option<rustc_interface[fb6f1569d3f1850c]::queries::Linker>, rustc_span[60df94d8028129a3]::ErrorGuaranteed>>
  24:        0x1107f51b0 - <rustc_interface[fb6f1569d3f1850c]::interface::Compiler>::enter::<rustc_driver_impl[c6ade677a6b0e20c]::run_compiler::{closure#0}::{closure#1}, core[924c651d484e1a25]::result::Result<core[924c651d484e1a25]::option::Option<rustc_interface[fb6f1569d3f1850c]::queries::Linker>, rustc_span[60df94d8028129a3]::ErrorGuaranteed>>
  25:        0x110837588 - rustc_span[60df94d8028129a3]::create_session_globals_then::<core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>, rustc_interface[fb6f1569d3f1850c]::util::run_in_thread_with_globals<rustc_interface[fb6f1569d3f1850c]::util::run_in_thread_pool_with_globals<rustc_interface[fb6f1569d3f1850c]::interface::run_compiler<core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>, rustc_driver_impl[c6ade677a6b0e20c]::run_compiler::{closure#0}>::{closure#1}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>::{closure#0}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}>
  26:        0x11081f588 - std[fc297465fa958267]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[fb6f1569d3f1850c]::util::run_in_thread_with_globals<rustc_interface[fb6f1569d3f1850c]::util::run_in_thread_pool_with_globals<rustc_interface[fb6f1569d3f1850c]::interface::run_compiler<core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>, rustc_driver_impl[c6ade677a6b0e20c]::run_compiler::{closure#0}>::{closure#1}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>::{closure#0}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>
  27:        0x110822b54 - <<std[fc297465fa958267]::thread::Builder>::spawn_unchecked_<rustc_interface[fb6f1569d3f1850c]::util::run_in_thread_with_globals<rustc_interface[fb6f1569d3f1850c]::util::run_in_thread_pool_with_globals<rustc_interface[fb6f1569d3f1850c]::interface::run_compiler<core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>, rustc_driver_impl[c6ade677a6b0e20c]::run_compiler::{closure#0}>::{closure#1}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>::{closure#0}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>::{closure#1} as core[924c651d484e1a25]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  28:        0x112a11fe8 - std::sys::pal::unix::thread::Thread::new::thread_start::h5a3f92a0fdbf8eb0
  29:        0x1978002e4 - __pthread_deallocate


rustc version: 1.84.0-nightly (b19329a37 2024-11-21)
platform: aarch64-apple-darwin

query stack during panic:
end of query stack
thread 'rustc' panicked at compiler/rustc_middle/src/ty/mod.rs:1676:13:
Box<dyn Any>
stack backtrace:
   0:        0x1129ed7b0 - std::backtrace::Backtrace::create::hf5e5ba1728bb8de7
   1:        0x110844da8 - <alloc[e2e5e8515d00274d]::boxed::Box<rustc_driver_impl[c6ade677a6b0e20c]::install_ice_hook::{closure#0}> as core[924c651d484e1a25]::ops::function::Fn<(&dyn for<'a, 'b> core[924c651d484e1a25]::ops::function::Fn<(&'a std[fc297465fa958267]::panic::PanicHookInfo<'b>,), Output = ()> + core[924c651d484e1a25]::marker::Send + core[924c651d484e1a25]::marker::Sync, &std[fc297465fa958267]::panic::PanicHookInfo)>>::call
   2:        0x112a07edc - std::panicking::rust_panic_with_hook::heb73fc7746f92ba7
   3:        0x1108e9718 - std[fc297465fa958267]::panicking::begin_panic::<rustc_errors[caf545eadef7fdd]::ExplicitBug>::{closure#0}
   4:        0x1108e94d0 - std[fc297465fa958267]::sys::backtrace::__rust_end_short_backtrace::<std[fc297465fa958267]::panicking::begin_panic<rustc_errors[caf545eadef7fdd]::ExplicitBug>::{closure#0}, !>
   5:        0x11516c04c - std[fc297465fa958267]::panicking::begin_panic::<rustc_errors[caf545eadef7fdd]::ExplicitBug>
   6:        0x1108efad4 - <rustc_errors[caf545eadef7fdd]::diagnostic::BugAbort as rustc_errors[caf545eadef7fdd]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   7:        0x111590098 - rustc_middle[dc5a577fd6f5eb51]::util::bug::opt_span_bug_fmt::<rustc_span[60df94d8028129a3]::span_encoding::Span>::{closure#0}
   8:        0x11158eb1c - rustc_middle[dc5a577fd6f5eb51]::ty::context::tls::with_opt::<rustc_middle[dc5a577fd6f5eb51]::util::bug::opt_span_bug_fmt<rustc_span[60df94d8028129a3]::span_encoding::Span>::{closure#0}, !>::{closure#0}
   9:        0x11158eae8 - rustc_middle[dc5a577fd6f5eb51]::ty::context::tls::with_context_opt::<rustc_middle[dc5a577fd6f5eb51]::ty::context::tls::with_opt<rustc_middle[dc5a577fd6f5eb51]::util::bug::opt_span_bug_fmt<rustc_span[60df94d8028129a3]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  10:        0x115218d90 - rustc_middle[dc5a577fd6f5eb51]::util::bug::bug_fmt
  11:        0x11154678c - <rustc_middle[dc5a577fd6f5eb51]::ty::context::TyCtxt>::item_name
  12:        0x10a88e08c - rustc_codegen_spirv::codegen_cx::declare::<impl rustc_codegen_spirv::codegen_cx::CodegenCx>::declare_fn_ext::h62af5aed91b065ab
  13:        0x10a88f6bc - rustc_codegen_spirv::codegen_cx::declare::<impl rustc_codegen_spirv::maybe_pqp_cg_ssa::traits::declare::PreDefineCodegenMethods for rustc_codegen_spirv::codegen_cx::CodegenCx>::predefine_fn::hb68792579dcb451d
  14:        0x10a81f738 - <rustc_middle::mir::mono::MonoItem as rustc_codegen_spirv::maybe_pqp_cg_ssa::mono_item::MonoItemExt>::predefine::h9fc0a1eadbbb089b
  15:        0x10a803d74 - <rustc_codegen_spirv::SpirvCodegenBackend as rustc_codegen_spirv::maybe_pqp_cg_ssa::traits::backend::ExtraBackendMethods>::compile_codegen_unit::{{closure}}::h0debe4e59a7b21f1
  16:        0x10a803820 - <rustc_codegen_spirv::SpirvCodegenBackend as rustc_codegen_spirv::maybe_pqp_cg_ssa::traits::backend::ExtraBackendMethods>::compile_codegen_unit::h1919ebc51166cdfc
  17:        0x10a8a55e0 - rustc_codegen_spirv::maybe_pqp_cg_ssa::base::codegen_crate::hef28e44872569f65
  18:        0x10a8024f8 - <rustc_codegen_spirv::SpirvCodegenBackend as rustc_codegen_spirv::maybe_pqp_cg_ssa::traits::backend::CodegenBackend>::codegen_crate::hffbf186d2f0b9484
  19:        0x1110dbad8 - <rustc_session[3e2f7db2cc04b493]::session::Session>::time::<alloc[e2e5e8515d00274d]::boxed::Box<dyn core[924c651d484e1a25]::any::Any>, rustc_interface[fb6f1569d3f1850c]::passes::start_codegen::{closure#0}>
  20:        0x11120add4 - rustc_interface[fb6f1569d3f1850c]::passes::start_codegen
  21:        0x1111985f0 - <rustc_interface[fb6f1569d3f1850c]::queries::Linker>::codegen_and_build_linker
  22:        0x11082dd20 - <rustc_middle[dc5a577fd6f5eb51]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[c6ade677a6b0e20c]::run_compiler::{closure#0}::{closure#1}::{closure#7}, core[924c651d484e1a25]::result::Result<core[924c651d484e1a25]::option::Option<rustc_interface[fb6f1569d3f1850c]::queries::Linker>, rustc_span[60df94d8028129a3]::ErrorGuaranteed>>
  23:        0x1107f51b0 - <rustc_interface[fb6f1569d3f1850c]::interface::Compiler>::enter::<rustc_driver_impl[c6ade677a6b0e20c]::run_compiler::{closure#0}::{closure#1}, core[924c651d484e1a25]::result::Result<core[924c651d484e1a25]::option::Option<rustc_interface[fb6f1569d3f1850c]::queries::Linker>, rustc_span[60df94d8028129a3]::ErrorGuaranteed>>
  24:        0x110837588 - rustc_span[60df94d8028129a3]::create_session_globals_then::<core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>, rustc_interface[fb6f1569d3f1850c]::util::run_in_thread_with_globals<rustc_interface[fb6f1569d3f1850c]::util::run_in_thread_pool_with_globals<rustc_interface[fb6f1569d3f1850c]::interface::run_compiler<core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>, rustc_driver_impl[c6ade677a6b0e20c]::run_compiler::{closure#0}>::{closure#1}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>::{closure#0}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}>
  25:        0x11081f588 - std[fc297465fa958267]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[fb6f1569d3f1850c]::util::run_in_thread_with_globals<rustc_interface[fb6f1569d3f1850c]::util::run_in_thread_pool_with_globals<rustc_interface[fb6f1569d3f1850c]::interface::run_compiler<core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>, rustc_driver_impl[c6ade677a6b0e20c]::run_compiler::{closure#0}>::{closure#1}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>::{closure#0}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>
  26:        0x110822b54 - <<std[fc297465fa958267]::thread::Builder>::spawn_unchecked_<rustc_interface[fb6f1569d3f1850c]::util::run_in_thread_with_globals<rustc_interface[fb6f1569d3f1850c]::util::run_in_thread_pool_with_globals<rustc_interface[fb6f1569d3f1850c]::interface::run_compiler<core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>, rustc_driver_impl[c6ade677a6b0e20c]::run_compiler::{closure#0}>::{closure#1}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>::{closure#0}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>::{closure#1} as core[924c651d484e1a25]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  27:        0x112a11fe8 - std::sys::pal::unix::thread::Thread::new::thread_start::h5a3f92a0fdbf8eb0
  28:        0x1978002e4 - __pthread_deallocate


query stack during panic:
end of query stack

Activity

  1. changed the title [-](my bug report)[/-] [+]Rust-gpu main fails to build[/+] on Apr 24, 2025
  2. LegNeato commented on Apr 24, 2025

    @LegNeato
  3. LegNeato commented on Apr 24, 2025

    @LegNeato
    Collaborator

    I am getting a panic here:

    "missing libm intrinsic {symbol_name}, which is {instance}"

  4. LegNeato commented on Apr 24, 2025

    @LegNeato
  5. LegNeato commented on Apr 24, 2025

    @LegNeato
    Collaborator

    Ok, looks like updating the lockfile causes issues:

    https://github.com/Rust-GPU/rust-gpu/actions/runs/14645774261/job/41099428403?pr=243

    So it is in one of those.

  6. LegNeato commented on Apr 24, 2025

    @LegNeato
    Collaborator

    This was probably caused by libm releasing 0.2.13 2 days ago. Can't find the issue right now, will look later if someone hasn't beaten me to it.

  7. simensgreen commented on Apr 24, 2025

    @simensgreen
    Author

    Yeah, if force libm to 0.2.11 this error disappears. Check out https://github.com/simensgreen/rust_gpu_union_issue/tree/libm-fixed

  8. LegNeato commented on Apr 25, 2025

    @LegNeato
    Collaborator

    Ok, so something about our symbol resolution when swapping out libm intrinsics is messing up with the new versions.

  9. LegNeato commented on Apr 25, 2025

    @LegNeato
    Collaborator

    I don't have time to bisect, but a good candidate is rust-lang/compiler-builtins@161036a. My hunch is because these are inlined, we can't replace the symbol because the symbol doesn't exist because they're inlined.

  10. LegNeato commented on Apr 25, 2025

    @LegNeato
    Collaborator

    To work around this for now you can use patch in your Cargo.toml for crates.io to set libm for all deps.

  11. tgross35 commented on Apr 25, 2025

    @tgross35

    Coming here from the libm side. is this crate looking for global symbols from a libm rlib? If so this isn't reliable, we don't provide #[no_mangle] symbols. If this is needed then you may need to provide a wrapper shim that exports what you expect, unless the symbols can come from compiler-builtins somehow (c-b reexports the libm functions as extern c).

  12. LegNeato commented on Apr 26, 2025

    @LegNeato
    Collaborator

    Ok thanks. I am unfamiliar with this portion of the project so I'll take a this week if someone doesn't get to it before me, thanks for chiming in.

  13. LegNeato commented on Apr 29, 2025

    @LegNeato
    Collaborator

    Just an update on this, we landed a temporary fix to lock libm to a specific version without this issue, but we have not delved into the root cause yet.

  14. tgross35 commented on Apr 29, 2025

    @tgross35

    I am getting a panic here:

    rust-gpu/crates/rustc_codegen_spirv/src/codegen_cx/declare.rs

    Line 174 in 6bbbfe4
    "missing libm intrinsic {symbol_name}, which is {instance}"

    Do you happen to know what this error actually prints? Might narrow things down.

    There is also a chance this is related to f16 or f128 if those aren't well supported in the cg backend yet. As of very recently, the backends can say whether or not they support them rust-lang/rust#140323, I'll be switching libm and compiler-builtins to use this after the beta branch and bootstrap bump (~2 weeks).

  15. LegNeato commented on Apr 29, 2025

    @LegNeato
    Collaborator

    We're on an old version of rustc that doesn't include those changes I think (nightly-2024-11-22). I'll get the messages later today. Thanks for following up!

  16. Firestar99 commented on Jun 29, 2025

    @Firestar99
    Member

    should have been closed by #244

  17. changed the title [-]Rust-gpu main fails to build[/-] [+]libm `0.2.12` breaks rust-gpu[/+] on Jun 30, 2025
  18. tuguzT commented on Aug 15, 2025

    @tuguzT
    Contributor

    Do you happen to know what this error actually prints? Might narrow things down.

    I'm trying to delve into the root cause as a contributor.

    By the output below (when compiling glam crate) I guess that rust-gpu backend tries to use all libm public functions (with or without actual libm intrinsics, IDK for sure):

         Compiling glam v0.30.5
      error: missing libm intrinsic _RNvMNtNtNtCsfUJYpeEtpQ8_4libm4math7support3bigNtB2_4u2566signed, which is math::support::big::u256::signed
    
      error: missing libm intrinsic _RNvXs2_NtNtNtCsfUJYpeEtpQ8_4libm4math7support3bigNtB5_4u256NtNtNtCs1ZsejSY4Xa7_4core3ops5arith3Add3add, which is <math::support::big::u256 as core::ops::Add>::add
    
      error: missing libm intrinsic _RNvXs4_NtNtNtCsfUJYpeEtpQ8_4libm4math7support3bigoNtNtB7_10int_traits4HInt5widen, which is math::support::big::<impl math::support::int_traits::HInt for u128>::widen
    
      error: missing libm intrinsic _RNvXs4_NtNtNtCsfUJYpeEtpQ8_4libm4math7support3bigoNtNtB7_10int_traits4HInt10zero_widen, which is math::support::big::<impl math::support::int_traits::HInt for u128>::zero_widen
    

    ...with lots of similar errors, and at the end it outputs this:

      query stack during panic:
      end of query stack
      note: `rust-gpu` version `0.9.0`
    
      error: could not compile `libm` (lib) due to 349 previous errors
    

    Currently I'm trying to find out if libm provided extern symbols for intrinsics before 0.2.11 or not, and if it provides them now...


    U.P.D.: I noticed that filtering out by "math::" substring does not work, because in either case output contains this:

    error: internal compiler error: compiler\rustc_middle\src\ty\mod.rs:1631:13: item_name: no name for DefPath { data: [DisambiguatedDefPathData { data: TypeNs("math"), disambiguator: 0 }, DisambiguatedDefPathData { data: TypeNs("generic"), disambiguator: 0 }, DisambiguatedDefPathData { data: TypeNs("rint"), disambiguator: 0 }, DisambiguatedDefPathData { data: ValueNs("rint_round"), disambiguator: 0 }, DisambiguatedDefPathData { data: Closure, disambiguator: 0 }], krate: crate0 }
    

    What does crate0 even mean?
    Maybe it is just inlining after all...


    Here is another interesting part of the output (look at 21-23):

      thread 'rustc' panicked at compiler\rustc_middle\src\ty\mod.rs:1631:13:
      Box<dyn Any>
      stack backtrace:
         0:     0x7ffe37861492 - std::backtrace_rs::backtrace::win64::trace
                                     at /rustc/be19eda0dc4c22c5cf5f1b48fd163acf9bd4b0a6/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
         1:     0x7ffe37861492 - std::backtrace_rs::backtrace::trace_unsynchronized
                                     at /rustc/be19eda0dc4c22c5cf5f1b48fd163acf9bd4b0a6/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
         2:     0x7ffe37861492 - std::sys::backtrace::_print_fmt
                                     at /rustc/be19eda0dc4c22c5cf5f1b48fd163acf9bd4b0a6/library\std\src\sys\backtrace.rs:66
         3:     0x7ffe37861492 - std::sys::backtrace::impl$0::print::impl$0::fmt
                                     at /rustc/be19eda0dc4c22c5cf5f1b48fd163acf9bd4b0a6/library\std\src\sys\backtrace.rs:39
         4:     0x7ffe3789419b - core::fmt::rt::Argument::fmt
                                     at /rustc/be19eda0dc4c22c5cf5f1b48fd163acf9bd4b0a6/library\core\src\fmt\rt.rs:173
         5:     0x7ffe3789419b - core::fmt::write
                                     at /rustc/be19eda0dc4c22c5cf5f1b48fd163acf9bd4b0a6/library\core\src\fmt\mod.rs:1465
         6:     0x7ffe378571f7 - std::io::default_write_fmt
                                     at /rustc/be19eda0dc4c22c5cf5f1b48fd163acf9bd4b0a6/library\std\src\io\mod.rs:639
         7:     0x7ffe378571f7 - std::io::Write::write_fmt<std::sys::stdio::windows::Stderr>
                                     at /rustc/be19eda0dc4c22c5cf5f1b48fd163acf9bd4b0a6/library\std\src\io\mod.rs:1954
         8:     0x7ffe378612d5 - std::sys::backtrace::BacktraceLock::print
                                     at /rustc/be19eda0dc4c22c5cf5f1b48fd163acf9bd4b0a6/library\std\src\sys\backtrace.rs:42
         9:     0x7ffe37866fda - std::panicking::default_hook::closure$0
                                     at /rustc/be19eda0dc4c22c5cf5f1b48fd163acf9bd4b0a6/library\std\src\panicking.rs:300
        10:     0x7ffe37866d70 - std::panicking::default_hook
                                     at /rustc/be19eda0dc4c22c5cf5f1b48fd163acf9bd4b0a6/library\std\src\panicking.rs:327
        11:     0x7ffe3900aceb - core[2c13913618a3aa88]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[fe50efb9a6637fb]::Level, &str), usize), <((rustc_lint_defs[fe50efb9a6637fb]::Level, &str), usize) as core[2c13913618a3aa88]::cmp::PartialOrd>::lt>
        12:     0x7ffe3900aceb - core[2c13913618a3aa88]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[fe50efb9a6637fb]::Level, &str), usize), <((rustc_lint_defs[fe50efb9a6637fb]::Level, &str), usize) as core[2c13913618a3aa88]::cmp::PartialOrd>::lt>
        13:     0x7ffe37867c2c - std::panicking::rust_panic_with_hook
                                     at /rustc/be19eda0dc4c22c5cf5f1b48fd163acf9bd4b0a6/library\std\src\panicking.rs:841
        14:     0x7ffe3a7df693 - RINvNtNtNtNtCs3MCiVnbpLmK_4core5slice4sort6stable9quicksort9quicksortTjRNtNtCs1jPDIgjFhOu_12rustc_errors7snippet10AnnotationENCINvMNtCsaWMzd9r5RZj_5alloc5sliceSB15_11sort_by_keyTINtNtBa_3cmp7ReversejEbENCNCNvMs4_NtB1c_7emitterNtB3o_12HumanEmitter18render_s
        15:     0x7ffe3a7d3989 - std[2f1fb5b39e90df1f]::sys::backtrace::__rust_end_short_backtrace::<std[2f1fb5b39e90df1f]::panicking::begin_panic<rustc_errors[f5f9f53222ce4e8]::ExplicitBug>::{closure#0}, !>
        16:     0x7ffe3a7d36e8 - std[2f1fb5b39e90df1f]::panicking::begin_panic::<rustc_errors[f5f9f53222ce4e8]::ExplicitBug>
        17:     0x7ffe3a7ec145 - <rustc_errors[f5f9f53222ce4e8]::diagnostic::BugAbort as rustc_errors[f5f9f53222ce4e8]::diagnostic::EmissionGuarantee>::emit_producing_guarantee       
        18:     0x7ffe3a739ff9 - rustc_middle[2f4cf8cf20eab594]::util::bug::span_bug_fmt::<rustc_span[350f415f13b6f350]::span_encoding::Span>
        19:     0x7ffe3a71135d - <rustc_middle[2f4cf8cf20eab594]::ty::consts::Const>::walk
        20:     0x7ffe3a711126 - <rustc_middle[2f4cf8cf20eab594]::ty::consts::Const>::walk
        21:     0x7ffe3a739ef2 - rustc_middle[2f4cf8cf20eab594]::util::bug::bug_fmt
        22:     0x7ffe38edf079 - <rustc_middle[2f4cf8cf20eab594]::ty::context::TyCtxt>::item_name
        23:     0x7ffe25d1d812 - rustc_codegen_spirv::codegen_cx::declare::<impl rustc_codegen_spirv::codegen_cx::CodegenCx>::declare_fn_ext::hdfa263e4bd4a1f81
        24:     0x7ffe25d20a5f - rustc_codegen_spirv::codegen_cx::declare::<impl rustc_codegen_spirv::maybe_pqp_cg_ssa::traits::declare::PreDefineCodegenMethods for rustc_codegen_spirv::codegen_cx::CodegenCx>::predefine_fn::h29095e82dccb2d4a
        25:     0x7ffe25d66208 - <rustc_middle::mir::mono::MonoItem as rustc_codegen_spirv::maybe_pqp_cg_ssa::mono_item::MonoItemExt>::predefine::hacd7092f23f3ee0e
        26:     0x7ffe25cd6a51 - <rustc_codegen_spirv::SpirvCodegenBackend as rustc_codegen_spirv::maybe_pqp_cg_ssa::traits::backend::ExtraBackendMethods>::compile_codegen_unit::h11356bcce57b42dc
        27:     0x7ffe25cd5df9 - <rustc_codegen_spirv::SpirvCodegenBackend as rustc_codegen_spirv::maybe_pqp_cg_ssa::traits::backend::ExtraBackendMethods>::compile_codegen_unit::h11356bcce57b42dc
        28:     0x7ffe25d5faa2 - rustc_codegen_spirv::maybe_pqp_cg_ssa::base::codegen_crate::h8efc486f30f12fa6
        29:     0x7ffe25cd4a79 - <rustc_codegen_spirv::SpirvCodegenBackend as rustc_codegen_spirv::maybe_pqp_cg_ssa::traits::backend::CodegenBackend>::codegen_crate::ha0fa71136efa378c
        30:     0x7ffe33dea4d8 - <rustc_interface[3c536111ac0bcaa7]::queries::Linker>::codegen_and_build_linker
        ...
    

    I have a theory that backend tries to replace all the public functions usages inside of libm itself, which causes such an issue.
    I think so because via experimenting a bit I got this result:

    • when compiling libm:
      ...
    
      error: found libm intrinsic _RINvNtNtNtCsfUJYpeEtpQ8_4libm4math7generic5trunc5truncfEB8_, which is math::generic::trunc::trunc::<f32>, item name is trunc
    
      error: missing libm intrinsic _RINvNtNtNtCsfUJYpeEtpQ8_4libm4math7generic5trunc12trunc_statusdEB8_, which is math::generic::trunc::trunc_status::<f64>, item name is trunc_status
    
      error: missing libm intrinsic _RINvNtNtNtCsfUJYpeEtpQ8_4libm4math7generic5trunc12trunc_statusfEB8_, which is math::generic::trunc::trunc_status::<f32>, item name is trunc_status
    
      error: could not compile `libm` (lib) due to 495 previous errors
    
    • but when compiling glam (which has libm as dependency):
      error: found libm intrinsic _RNvNtNtCsfUJYpeEtpQ8_4libm4math6atan2f6atan2f, which is libm::atan2f, item name is atan2f
    
      error: found libm intrinsic _RNvNtNtCsfUJYpeEtpQ8_4libm4math7sincosf7sincosf, which is libm::sincosf, item name is sincosf
    
      error: found libm intrinsic _RNvNtNtCsfUJYpeEtpQ8_4libm4math4sqrt5sqrtf, which is libm::sqrtf, item name is sqrtf
    
      error: found libm intrinsic _RNvNtNtCsfUJYpeEtpQ8_4libm4math8copysign9copysignf, which is libm::copysignf, item name is copysignf
    
      error: found libm intrinsic _RNvNtNtCsfUJYpeEtpQ8_4libm4math5atan25atan2, which is libm::atan2, item name is atan2
    
      error: found libm intrinsic _RNvNtNtCsfUJYpeEtpQ8_4libm4math6sincos6sincos, which is libm::sincos, item name is sincos
    
      error: found libm intrinsic _RNvNtNtCsfUJYpeEtpQ8_4libm4math4sqrt4sqrt, which is libm::sqrt, item name is sqrt
    
      error: found libm intrinsic _RNvNtNtCsfUJYpeEtpQ8_4libm4math8copysign8copysign, which is libm::copysign, item name is copysign
    
      error: could not compile `glam` (lib) due to 8 previous errors
    

    Another proof is that local DefId has krate field defined as LOCAL_CRATE, or CrateNum::ZERO, which I guess is crate0

    Honestly, this feels like "suffering from success" energy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions