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

Compile/development issues on Windows with ffi #12259

Open
1 task done
CRossel87a opened this issue Nov 1, 2024 · 1 comment
Open
1 task done

Compile/development issues on Windows with ffi #12259

CRossel87a opened this issue Nov 1, 2024 · 1 comment
Labels
C-bug An unexpected or incorrect behavior O-windows OS: Windows

Comments

@CRossel87a
Copy link

CRossel87a commented Nov 1, 2024

Describe the bug

Hi,

Latest changes have made debugging & development very difficult on Windows. Is there a way to work with this?

cargo check:

error[E0308]: mismatched types
   --> crates\storage\libmdbx-rs\src\environment.rs:433:20
    |
433 |         if (mode & ffi::MDBX_RDONLY) != 0 {
    |                    ^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0277]: no implementation for `u32 & i32`
   --> crates\storage\libmdbx-rs\src\environment.rs:433:18
    |
433 |         if (mode & ffi::MDBX_RDONLY) != 0 {
    |                  ^ no implementation for `u32 & i32`
    |
    = help: the trait `BitAnd<i32>` is not implemented for `u32`
    = help: the following other types implement trait `BitAnd<Rhs>`:
              `&'a u32` implements `BitAnd<u32>`
              `&u32` implements `BitAnd<&u32>`
              `u32` implements `BitAnd<&u32>`
              `u32` implements `BitAnd`

error[E0308]: mismatched types
   --> crates\storage\libmdbx-rs\src\environment.rs:435:27
    |
435 |         } else if (mode & ffi::MDBX_UTTERLY_NOSYNC) != 0 {
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0277]: no implementation for `u32 & i32`
   --> crates\storage\libmdbx-rs\src\environment.rs:435:25
    |
435 |         } else if (mode & ffi::MDBX_UTTERLY_NOSYNC) != 0 {
    |                         ^ no implementation for `u32 & i32`
    |
    = help: the trait `BitAnd<i32>` is not implemented for `u32`
    = help: the following other types implement trait `BitAnd<Rhs>`:
              `&'a u32` implements `BitAnd<u32>`
              `&u32` implements `BitAnd<&u32>`
              `u32` implements `BitAnd<&u32>`
              `u32` implements `BitAnd`

error[E0308]: mismatched types
   --> crates\storage\libmdbx-rs\src\environment.rs:437:27
    |
437 |         } else if (mode & ffi::MDBX_NOMETASYNC) != 0 {
    |                           ^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0277]: no implementation for `u32 & i32`
   --> crates\storage\libmdbx-rs\src\environment.rs:437:25
    |
437 |         } else if (mode & ffi::MDBX_NOMETASYNC) != 0 {
    |                         ^ no implementation for `u32 & i32`
    |
    = help: the trait `BitAnd<i32>` is not implemented for `u32`
    = help: the following other types implement trait `BitAnd<Rhs>`:
              `&'a u32` implements `BitAnd<u32>`
              `&u32` implements `BitAnd<&u32>`
              `u32` implements `BitAnd<&u32>`
              `u32` implements `BitAnd`

error[E0308]: mismatched types
   --> crates\storage\libmdbx-rs\src\environment.rs:439:27
    |
439 |         } else if (mode & ffi::MDBX_SAFE_NOSYNC) != 0 {
    |                           ^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0277]: no implementation for `u32 & i32`
   --> crates\storage\libmdbx-rs\src\environment.rs:439:25
    |
439 |         } else if (mode & ffi::MDBX_SAFE_NOSYNC) != 0 {
    |                         ^ no implementation for `u32 & i32`
    |
    = help: the trait `BitAnd<i32>` is not implemented for `u32`
    = help: the following other types implement trait `BitAnd<Rhs>`:
              `&'a u32` implements `BitAnd<u32>`
              `&u32` implements `BitAnd<&u32>`
              `u32` implements `BitAnd<&u32>`
              `u32` implements `BitAnd`

Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `reth-libmdbx` (lib) due to 8 previous errors

Steps to reproduce

cargo check

Node logs

No response

Platform(s)

Windows (x86)

What version/commit are you on?

main, latest

What database version are you on?

main, latest

Which chain / network are you on?

eth

What type of node are you running?

Full via --full flag

What prune config do you use, if any?

No response

If you've built Reth from source, provide the full command you used

No response

Code of Conduct

  • I agree to follow the Code of Conduct
@CRossel87a CRossel87a added C-bug An unexpected or incorrect behavior S-needs-triage This issue needs to be labelled labels Nov 1, 2024
@DaniPopes DaniPopes added O-windows OS: Windows and removed S-needs-triage This issue needs to be labelled labels Nov 1, 2024
@mattsse
Copy link
Collaborator

mattsse commented Nov 2, 2024

could you please check what the generated type alias for MDBX_env_flags_t is?
in reth-mdbx-sys,

e.g.

pub type MDBX_env_flags_t = ::std::os::raw::c_uint;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug An unexpected or incorrect behavior O-windows OS: Windows
Projects
Status: Todo
Development

No branches or pull requests

3 participants