Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unexpected LinkageSpec error #527

Merged
merged 1 commit into from
Dec 17, 2023

Conversation

PaulWagener
Copy link

I encountered errors in a static release build of OpenCV on Windows. These changes fixed those errors.

@twistedfall
Copy link
Owner

Thanks for the PR! Before we merge that, can you please check if the version 0.88.2 of the crate doesn't fix the error you're getting? I have fixed the problem in walker.rs that was triggered by clang-17 a couple of days ago and my impression is that change in element.rs is not required at least for the issue that was reported initially (#519).

If version 0.88.2 works for you then I'd say let's keep it at this, otherwise I will merge this PR.

@PaulWagener
Copy link
Author

The problem indeed occurs in 0.88.2.

I triple check already because I saw that same issue and thought I was losing my mind on how I keep encountering an error that was supposedly already fixed.

Below is a backtrace of the kind of error that this PR fixes.
Note that this error orginates from walk_opencv_entities while the original fix was for visit_cv_namespace

 thread 'main' panicked at D:\Source\opencv-rust\binding-generator\src\walker.rs:57:33:
  internal error: entered unreachable code: Unsupported decl for file: Entity {
      kind: LinkageSpec,
      display_name: None,
      location: Some(
          SourceLocation {
              file: Some(
                  File {
                      path: "D:\\Source\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\opencv-0.88.2\\src_cpp\\ocvrs_common.hpp",
                  },
              ),
              line: 37,
              column: 8,
              offset: 1306,
          },
      ),
  }
  stack backtrace:
     0:     0x7ff639390063 - std::sys_common::backtrace::_print::impl$0::fmt
                                 at /rustc/de686cbc65478db53e3d51c52497685e852cc092/library\std\src\sys_common\backtrace.rs:44
     1:     0x7ff6393b200d - core::fmt::rt::Argument::fmt
                                 at /rustc/de686cbc65478db53e3d51c52497685e852cc092/library\core\src\fmt\rt.rs:142
     2:     0x7ff6393b200d - core::fmt::write
                                 at /rustc/de686cbc65478db53e3d51c52497685e852cc092/library\core\src\fmt\mod.rs:1120
     3:     0x7ff63938b3b1 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
                                 at /rustc/de686cbc65478db53e3d51c52497685e852cc092/library\std\src\io\mod.rs:1810
     4:     0x7ff63938fe6a - std::sys_common::backtrace::_print
                                 at /rustc/de686cbc65478db53e3d51c52497685e852cc092/library\std\src\sys_common\backtrace.rs:47
     5:     0x7ff63938fe6a - std::sys_common::backtrace::print
                                 at /rustc/de686cbc65478db53e3d51c52497685e852cc092/library\std\src\sys_common\backtrace.rs:34
     6:     0x7ff6393925c9 - std::panicking::default_hook::closure$1
                                 at /rustc/de686cbc65478db53e3d51c52497685e852cc092/library\std\src\panicking.rs:272
     7:     0x7ff63939228b - std::panicking::default_hook
                                 at /rustc/de686cbc65478db53e3d51c52497685e852cc092/library\std\src\panicking.rs:292
     8:     0x7ff639392ab4 - std::panicking::rust_panic_with_hook
                                 at /rustc/de686cbc65478db53e3d51c52497685e852cc092/library\std\src\panicking.rs:779
     9:     0x7ff639392985 - std::panicking::begin_panic_handler::closure$0
                                 at /rustc/de686cbc65478db53e3d51c52497685e852cc092/library\std\src\panicking.rs:657
    10:     0x7ff639390959 - std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                                 at /rustc/de686cbc65478db53e3d51c52497685e852cc092/library\std\src\sys_common\backtrace.rs:171
    11:     0x7ff639392694 - std::panicking::begin_panic_handler
                                 at /rustc/de686cbc65478db53e3d51c52497685e852cc092/library\std\src\panicking.rs:645
    12:     0x7ff6393ba0c7 - core::panicking::panic_fmt
                                 at /rustc/de686cbc65478db53e3d51c52497685e852cc092/library\core\src\panicking.rs:72
    13:     0x7ff638df62a4 - <I as core::iter::traits::collect::IntoIterator>::into_iter::hca1942f9d8e7cd23
    14:     0x7ff638df58e2 - <I as core::iter::traits::collect::IntoIterator>::into_iter::hca1942f9d8e7cd23
    15:     0x7ff63929ea2c - clang::Entity::visit_children::visit::h3ca34c698472c061

@twistedfall
Copy link
Owner

Thanks a lot for checking!

@twistedfall twistedfall merged commit 5dbeaca into twistedfall:master Dec 17, 2023
14 checks passed
@twistedfall
Copy link
Owner

This has been released in 0.88.4 crate version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants