Yatekii / imgui-wgpu-rs

Dear imgui renderer for wgpu-rs.
MIT License
256 stars 86 forks source link

Windows build fails #85

Open eugenebokhan opened 2 years ago

eugenebokhan commented 2 years ago

Hi! I'm trying to run one of the examples on Windows platform, but it fails.

Description

Here's the build log:

   Compiling wgpu-core v0.13.2
   Compiling deflate v0.8.6
   Compiling miniz_oxide v0.3.7
   Compiling gpu-alloc v0.5.3
   Compiling imgui-sys v0.8.2
   Compiling windows-sys v0.36.1
   Compiling png v0.16.8
   Compiling aho-corasick v0.7.18
   Compiling spirv v0.2.0+1.5.4
   Compiling approx v0.4.0
   Compiling hashbrown v0.12.3
   Compiling regex v1.6.0
   Compiling winapi-util v0.1.5
   Compiling libloading v0.7.3
   Compiling atty v0.2.14
   Compiling gpu-descriptor v0.2.3
   Compiling parking_lot v0.12.1
   Compiling termcolor v1.1.3
   Compiling thiserror-impl v1.0.32
   Compiling bytemuck_derive v1.2.1
   Compiling d3d12 v0.5.0
   Compiling parking_lot v0.11.2
   Compiling codespan-reporting v0.11.1
   Compiling env_logger v0.9.0
   Compiling bytemuck v1.12.1
error[E0432]: unresolved import `crate::platform_impl::platform::event_loop::WindowLongPtr`
  --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.26.1\src\platform_impl\windows\window.rs:44:51
   |
44 |         event_loop::{self, EventLoopWindowTarget, WindowLongPtr, DESTROY_MSG_ID},
   |                                                   ^^^^^^^^^^^^^ no `WindowLongPtr` in `platform_impl::platform::event_loop`

error[E0412]: cannot find type `WindowLongPtr` in this scope
   --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.26.1\src\platform_impl\windows\event_loop.rs:654:58
    |
654 |             (winuser::WS_VISIBLE | winuser::WS_POPUP) as WindowLongPtr,
    |                                                          ^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `WindowLongPtr` in this scope
   --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.26.1\src\platform_impl\windows\event_loop.rs:676:26
    |
676 |             input_ptr as WindowLongPtr,
    |                          ^^^^^^^^^^^^^ not found in this scope

   Compiling thiserror v1.0.32
   Compiling imgui v0.8.2
   Compiling image v0.23.14
Some errors have detailed explanations: E0412, E0432.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `winit` due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
error[E0308]: mismatched types
   --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\clipboard.rs:137:67
    |
137 |                     set_clipboard_text_fn(io.clipboard_user_data, self.scratch_txt(text));
    |                     ---------------------                         ^^^^^^^^^^^^^^^^^^^^^^ expected `i8`, found `u8`
    |                     |
    |                     arguments to this function are incorrect
    |
    = note: expected raw pointer `*const i8`
               found raw pointer `*const u8`

error[E0308]: mismatched types
   --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\context.rs:205:44
    |
205 |         let data = unsafe { CStr::from_ptr(sys::igSaveIniSettingsToMemory(ptr::null_mut())) };
    |                             -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i8`, found `u8`
    |                             |
    |                             arguments to this function are incorrect
    |
    = note: expected raw pointer `*const i8`
               found raw pointer `*const u8`
note: associated function defined here
   --> C:\Users\eugenebokhan\.rustup\toolchains\stable-aarch64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\ffi\c_str.rs:247:19
    |
247 |     pub unsafe fn from_ptr<'a>(ptr: *const c_char) -> &'a CStr {
    |                   ^^^^^^^^

error[E0308]: arguments to this function are incorrect
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\draw_list.rs:305:13
     |
305  |             sys::ImDrawList_AddText_Vec2(self.draw_list, pos.into(), col.into().into(), start, end)
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                -----  --- expected `u8`, found `i8`
     |                                                                                         |
     |                                                                                         expected `u8`, found `i8`
     |
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:3723:12
     |
3723 |     pub fn ImDrawList_AddText_Vec2(
     |            ^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: arguments to this function are incorrect
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\input_widget.rs:868:9
     |
868  |         sys::ImGuiInputTextCallbackData_InsertChars(
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
871  |             start as *const c_char,
     |             ---------------------- expected `u8`, found `i8`
872  |             end as *const c_char,
     |             -------------------- expected `u8`, found `i8`
     |
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:3260:12
     |
3260 |     pub fn ImGuiInputTextCallbackData_InsertChars(
     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: arguments to this function are incorrect
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\stacks.rs:464:21
     |
464  |                     sys::igPushID_StrStr(start, end)
     |                     ^^^^^^^^^^^^^^^^^^^^ -----  --- expected `u8`, found `i8`
     |                                          |
     |                                          expected `u8`, found `i8`
     |
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:1924:12
     |
1924 |     pub fn igPushID_StrStr(str_id_begin: *const cty::c_char, str_id_end: *const cty::c_char);
     |            ^^^^^^^^^^^^^^^

error[E0308]: arguments to this function are incorrect
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\widget\text.rs:23:13
     |
23   |             sys::igTextUnformatted(start as *const c_char, end as *const c_char);
     |             ^^^^^^^^^^^^^^^^^^^^^^ ----------------------  -------------------- expected `u8`, found `i8`
     |                                    |
     |                                    expected `u8`, found `i8`
     |
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:1948:12
     |
1948 |     pub fn igTextUnformatted(text: *const cty::c_char, text_end: *const cty::c_char);
     |            ^^^^^^^^^^^^^^^^^

error[E0061]: this function takes at least 1 argument but 2 arguments were supplied
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\widget\text.rs:42:18
     |
42   |         unsafe { sys::igTextWrapped(fmt_ptr(), self.scratch_txt(text)) }
     |                  ^^^^^^^^^^^^^^^^^^ --------- argument of type `*const u8` unexpected
     |
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:1960:12
     |
1960 |     pub fn igTextWrapped(fmt: *const cty::c_char, ...);
     |            ^^^^^^^^^^^^^
help: remove the extra argument
     |
42   |         unsafe { sys::igTextWrapped(self.scratch_txt(text)) }
     |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes at least 2 arguments but 3 arguments were supplied
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\widget\text.rs:48:18
     |
48   |         unsafe { sys::igLabelText(ptr_one, fmt_ptr(), ptr_two) }
     |                  ^^^^^^^^^^^^^^^^          --------- argument of type `*const u8` unexpected
     |
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:1963:12
     |
1963 |     pub fn igLabelText(label: *const cty::c_char, fmt: *const cty::c_char, ...);
     |            ^^^^^^^^^^^
help: remove the extra argument
     |
48   |         unsafe { sys::igLabelText(ptr_one, ptr_two) }
     |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes at least 1 argument but 2 arguments were supplied
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\widget\text.rs:53:18
     |
53   |         unsafe { sys::igBulletText(fmt_ptr(), self.scratch_txt(text)) }
     |                  ^^^^^^^^^^^^^^^^^ --------- argument of type `*const u8` unexpected
     |
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:1966:12
     |
1966 |     pub fn igBulletText(fmt: *const cty::c_char, ...);
     |            ^^^^^^^^^^^^
help: remove the extra argument
     |
53   |         unsafe { sys::igBulletText(self.scratch_txt(text)) }
     |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes at least 3 arguments but 4 arguments were supplied
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\widget\tree.rs:259:21
     |
259  |                     sys::igTreeNodeEx_StrStr(id, self.flags.bits() as i32, fmt_ptr(), label)
     |                     ^^^^^^^^^^^^^^^^^^^^^^^^                               --------- argument of type `*const u8` unexpected
     |
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:2549:12
     |
2549 |     pub fn igTreeNodeEx_StrStr(
     |            ^^^^^^^^^^^^^^^^^^^
help: remove the extra argument
     |
259  |                     sys::igTreeNodeEx_StrStr(id, self.flags.bits() as i32, label)
     |

error[E0061]: this function takes at least 3 arguments but 4 arguments were supplied
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\widget\tree.rs:261:40
     |
261  |                 TreeNodeId::Ptr(id) => sys::igTreeNodeEx_Ptr(
     |                                        ^^^^^^^^^^^^^^^^^^^^^
...
264  |                     fmt_ptr(),
     |                     --------- argument of type `*const u8` unexpected
     |
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:2557:12
     |
2557 |     pub fn igTreeNodeEx_Ptr(
     |            ^^^^^^^^^^^^^^^^
help: remove the extra argument
     |
261  ~                 TreeNodeId::Ptr(id) => sys::igTreeNodeEx_Ptr(id, self.flags.bits() as i32, match self.label {
262  +                         Some(v) => ui.scratch_txt(v),
263  +                         None => ui.scratch_txt(""),
264  ~                     }),
     |

error[E0308]: arguments to this function are incorrect
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\window\child_window.rs:265:21
     |
265  |                     sys::igGetID_StrStr(start, end)
     |                     ^^^^^^^^^^^^^^^^^^^ -----  --- expected `u8`, found `i8`
     |                                         |
     |                                         expected `u8`, found `i8`
     |
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:1939:12
     |
1939 |     pub fn igGetID_StrStr(
     |            ^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\lib.rs:99:36
    |
99  |         let bytes = CStr::from_ptr(sys::igGetVersion()).to_bytes();
    |                     -------------- ^^^^^^^^^^^^^^^^^^^ expected `i8`, found `u8`
    |                     |
    |                     arguments to this function are incorrect
    |
    = note: expected raw pointer `*const i8`
               found raw pointer `*const u8`
note: associated function defined here
   --> C:\Users\eugenebokhan\.rustup\toolchains\stable-aarch64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\ffi\c_str.rs:247:19
    |
247 |     pub unsafe fn from_ptr<'a>(ptr: *const c_char) -> &'a CStr {
    |                   ^^^^^^^^

error[E0308]: arguments to this function are incorrect
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\lib.rs:305:21
     |
305  |                     sys::igGetID_StrStr(s1, s2)
     |                     ^^^^^^^^^^^^^^^^^^^ --  -- expected `u8`, found `i8`
     |                                         |
     |                                         expected `u8`, found `i8`
     |
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:1939:12
     |
1939 |     pub fn igGetID_StrStr(
     |            ^^^^^^^^^^^^^^

error[E0308]: mismatched types
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\lib.rs:569:17
     |
566  |             sys::igListBox_Str_arr(
     |             ---------------------- arguments to this function are incorrect
...
569  |                 items_inner.as_ptr() as *mut *const c_char,
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `i8`
     |
     = note: expected raw pointer `*const *const u8`
                found raw pointer `*mut *const i8`
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:2615:12
     |
2615 |     pub fn igListBox_Str_arr(
     |            ^^^^^^^^^^^^^^^^^

error[E0308]: arguments to this function are incorrect
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\lib.rs:664:13
     |
664  |             sys::igCalcTextSize(
     |             ^^^^^^^^^^^^^^^^^^^
665  |                 &mut out,
666  |                 start as *const c_char,
     |                 ---------------------- expected `u8`, found `i8`
667  |                 end as *const c_char,
     |                 -------------------- expected `u8`, found `i8`
     |
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:3069:12
     |
3069 |     pub fn igCalcTextSize(
     |            ^^^^^^^^^^^^^^

Some errors have detailed explanations: E0061, E0308.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `imgui` due to 16 previous errors

System Information

Platform: Windows 10 ARM64

Dependencies:

[dependencies]
bytemuck = "1"
imgui = "0.8"
log = "0.4"
smallvec = "1"
wgpu = "0.13"

[dev-dependencies]
bytemuck = { version = "1.4", features = ["derive"] }
cgmath = "0.18"
env_logger = "0.9"
image = { version = "0.23", default-features = false, features = ["png"] }
imgui-winit-support = { version = "0.8", default-features = false, features = ["winit-26"] }
pollster = "0.2"
raw-window-handle = "0.4"
winit = "0.26"
cwfitzgerald commented 2 years ago

This seems like something upstream from us. Is your rustc up to date and all your caches cleared?

eugenebokhan commented 2 years ago

@cwfitzgerald I've cleared the cache and updated everything, but the result is the same