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

whisper_gretype mismatch under msvc build #147

Open
hlhr202 opened this issue May 5, 2024 · 1 comment
Open

whisper_gretype mismatch under msvc build #147

hlhr202 opened this issue May 5, 2024 · 1 comment

Comments

@hlhr202
Copy link
Contributor

hlhr202 commented May 5, 2024

toolchain:
stable-x86_64-pc-windows-msvc (default)
rustc 1.76.0 (07dca489a 2024-02-04)

clang:
clang version 17.0.6
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/msys64/mingw64/bin

cl:
Microsoft (R) C/C++ Optimizing Compiler Version 19.37.32824 for x64

when building whisper-rs with whisper-rs-sys, the type mismatched.

error[E0308]: mismatched types
  --> C:\Users\Lenovo\.cargo\git\checkouts\whisper-rs-c8b9fa7c09c8c913\4dca14d\src\whisper_grammar.rs:13:11
   |
13 |     End = whisper_gretype_WHISPER_GRETYPE_END,
   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`

error[E0308]: mismatched types
  --> C:\Users\Lenovo\.cargo\git\checkouts\whisper-rs-c8b9fa7c09c8c913\4dca14d\src\whisper_grammar.rs:15:17
   |
15 |     Alternate = whisper_gretype_WHISPER_GRETYPE_ALT,
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`

error[E0308]: mismatched types
  --> C:\Users\Lenovo\.cargo\git\checkouts\whisper-rs-c8b9fa7c09c8c913\4dca14d\src\whisper_grammar.rs:17:21
   |
17 |     RuleReference = whisper_gretype_WHISPER_GRETYPE_RULE_REF,
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`

error[E0308]: mismatched types
  --> C:\Users\Lenovo\.cargo\git\checkouts\whisper-rs-c8b9fa7c09c8c913\4dca14d\src\whisper_grammar.rs:19:17
   |
19 |     Character = whisper_gretype_WHISPER_GRETYPE_CHAR,
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`

error[E0308]: mismatched types
  --> C:\Users\Lenovo\.cargo\git\checkouts\whisper-rs-c8b9fa7c09c8c913\4dca14d\src\whisper_grammar.rs:21:20
   |
21 |     NotCharacter = whisper_gretype_WHISPER_GRETYPE_CHAR_NOT,
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`

error[E0308]: mismatched types
  --> C:\Users\Lenovo\.cargo\git\checkouts\whisper-rs-c8b9fa7c09c8c913\4dca14d\src\whisper_grammar.rs:23:27
   |
23 |     CharacterRangeUpper = whisper_gretype_WHISPER_GRETYPE_CHAR_RNG_UPPER,
   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`

error[E0308]: mismatched types
  --> C:\Users\Lenovo\.cargo\git\checkouts\whisper-rs-c8b9fa7c09c8c913\4dca14d\src\whisper_grammar.rs:25:26
   |
25 |     CharacterAlternate = whisper_gretype_WHISPER_GRETYPE_CHAR_ALT,
   |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`

For more information about this error, try `rustc --explain E0308`.
error: could not compile `whisper-rs` (lib) due to 7 previous errors

I m wondering the problem came from here

#[cfg_attr(all(windows, not(target_env = "gnu")), repr(i32))] // msvc being *special* again

we should align msvc special type just to be u32

#[cfg_attr(any(not(windows), target_env = "gnu"), repr(u32))] // include windows-gnu
#[cfg_attr(all(windows, not(target_env = "gnu")), repr(u32))] // msvc being *special* again
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum WhisperGrammarElementType {
    /// End of rule definition
    End = whisper_gretype_WHISPER_GRETYPE_END,
    /// Start of alternate definition for a rule
    Alternate = whisper_gretype_WHISPER_GRETYPE_ALT,
    /// Non-terminal element: reference to another rule
    RuleReference = whisper_gretype_WHISPER_GRETYPE_RULE_REF,
    /// Terminal element: character (code point)
    Character = whisper_gretype_WHISPER_GRETYPE_CHAR,
    /// Inverse of a character(s)
    NotCharacter = whisper_gretype_WHISPER_GRETYPE_CHAR_NOT,
    /// Modifies a preceding [Self::Character] to be an inclusive range
    CharacterRangeUpper = whisper_gretype_WHISPER_GRETYPE_CHAR_RNG_UPPER,
    /// Modifies a preceding [Self::Character] to add an alternate character to match
    CharacterAlternate = whisper_gretype_WHISPER_GRETYPE_CHAR_ALT,
}
@hlhr202 hlhr202 changed the title whisper_gretype mismatch under msvc/gnu build whisper_gretype mismatch under msvc build May 5, 2024
@astral-shpx
Copy link

astral-shpx commented Jul 20, 2024

I'm getting those errors but with the types the other way around with the stable-x86_64-pc-windows-gnu toolchain. No errors if I switch the toolchain to msvc.

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

No branches or pull requests

2 participants