aclysma / profiling

Provides a very thin abstraction over instrumented profiling crates like puffin, optick, tracy, and superluminal-perf.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

examples does not compile

gww-parity opened this issue · comments

After running copy&paste form examples section:

#cargo run --package profiling --example simple --features="profile-with-optick,profile-with-tracy,profile-with-puffin,profile-with-superluminal"

OR

#cargo run --package profiling --example puffin --features="profile-with-puffin"

Things does not compile.

Error for second "only puffing" example:

error[E0308]: mismatched types
   --> examples/imgui_support/mod.rs:114:57
    |
114 |                 platform.handle_event(context.io_mut(), &window, &event);
    |                                                         ^^^^^^^ expected struct `winit::window::Window`, found `&skulpin::winit::window::Window`
    |
    = note: expected reference `&winit::window::Window`
               found reference `&&skulpin::winit::window::Window`

error[E0308]: mismatched types
   --> examples/imgui_support/mod.rs:114:66
    |
114 |                 platform.handle_event(context.io_mut(), &window, &event);
    |                                                                  ^^^^^^ expected enum `winit::event::Event`, found reference
    |
    = note: expected reference `&winit::event::Event<'_, _>`
               found reference `&&skulpin::winit::event::Event<'_, T>`

error[E0308]: mismatched types
   --> examples/imgui_support/mod.rs:188:52
    |
188 |             .prepare_frame(inner.context.io_mut(), window)
    |                                                    ^^^^^^ expected struct `winit::window::Window`, found struct `skulpin::winit::window::Window`
    |
    = note: expected reference `&winit::window::Window`
               found reference `&skulpin::winit::window::Window`
    = note: perhaps two different versions of crate `winit` are being used?

error[E0308]: mismatched types
   --> examples/imgui_support/mod.rs:227:48
    |
227 |             inner.platform.prepare_render(&ui, window);
    |                                                ^^^^^^ expected struct `winit::window::Window`, found struct `skulpin::winit::window::Window`
    |
    = note: expected reference `&winit::window::Window`
               found reference `&skulpin::winit::window::Window`
    = note: perhaps two different versions of crate `winit` are being used?

error[E0308]: mismatched types
   --> examples/imgui_support/mod.rs:302:9
    |
302 |         &window,
    |         ^^^^^^^ expected struct `winit::window::Window`, found `&skulpin::winit::window::Window`
    |
    = note: expected reference `&winit::window::Window`
               found reference `&&skulpin::winit::window::Window`

error: aborting due to 5 previous errors

For more information about this error, try `rustc --explain E0308`.
error: could not compile `profiling`

for first example :

   Compiling profiling v0.1.7 (/btrfs/home/testuser/github/aclysma/profiling)
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-Wl,--eh-frame-hdr" "-L" "/home/testuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.1haqn4o6nn7k0480.rcgu.o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.1ojv56zshxrfrmj4.rcgu.o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.1qi9gfv1byf93lu8.rcgu.o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.1u24kd9yibba252c.rcgu.o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.28woe0t89snx439e.rcgu.o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.2hnhjx1tm1ou7mb1.rcgu.o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.2yiwojav0sh7m462.rcgu.o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.30xfkmnp6xgevey1.rcgu.o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.3o00ynmrtrqh58xh.rcgu.o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.3sdupolod0l4mci0.rcgu.o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.3sz14lax7xyj5jty.rcgu.o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.47f4lv6rghdq11k7.rcgu.o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.49g8p9ge7o9e5j1d.rcgu.o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.4avf0iqk35m3rg1h.rcgu.o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.4g4lu30463wapgfm.rcgu.o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.4owigmaikltzsdax.rcgu.o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.4wgkszjfvjg5p6v7.rcgu.o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.559b1kfwegytnd1c.rcgu.o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.5e9p4f9k2m1zsk4p.rcgu.o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.kqbmrs74hsnqdh0.rcgu.o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.s6lv7b596ypilc7.rcgu.o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.wuhbaljab05u6gw.rcgu.o" "-o" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/examples/simple-14b9195160294b65.2gdunzfqlthwzt7d.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/deps" "-L" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/build/imgui-sys-6c67f0b79cd7f569/out" "-L" "/home/testuser/.cargo/registry/src/github.com-1ecc6299db9ec823/optick-1.3.4/external/lib/x64/" "-L" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/build/tracy-client-sys-b4af29277b3604dd/out" "-L" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/build/skia-bindings-9da88e56bbf59c81/out/skia" "-L" "/home/testuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/deps/libprofiling-20d520e5e019db34.rlib" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/deps/libtracy_client-a3b4a07a66a79a9a.rlib" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/deps/libtracy_client_sys-f986751c1e580f34.rlib" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/deps/libsuperluminal_perf-ecf4c2d069db2e0a.rlib" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/deps/liboptick-9cd0ebc7ecd371d0.rlib" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/deps/libpuffin-aeacb78b387851c0.rlib" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/deps/libonce_cell-a83801c9d7d83c9c.rlib" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/deps/libparking_lot-c4f36c16d478d421.rlib" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/deps/libparking_lot_core-cac4c65bf7e9b51c.rlib" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/deps/liblibc-519fc18f2f982120.rlib" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/deps/libsmallvec-b8a123a94d6d8a35.rlib" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/deps/liblock_api-2af5b40d40e1da75.rlib" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/deps/libscopeguard-e88af027ec0d8c57.rlib" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/deps/libinstant-1ed5457d6eed82cb.rlib" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/deps/libcfg_if-c1b17704da0d8978.rlib" "/btrfs/home/testuser/github/aclysma/profiling/target/debug/deps/libbyteorder-685b7428d2bcaad1.rlib" "-Wl,--start-group" "/home/testuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-93cbfed54dd1bac8.rlib" "/home/testuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-db33fe383d9e671a.rlib" "/home/testuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-4afe0e223ea50f9d.rlib" "/home/testuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-76d88ad8c833f039.rlib" "/home/testuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-762cea37cccf8abe.rlib" "/home/testuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-8de1e75656157df8.rlib" "/home/testuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-76f54e5a49eca8e8.rlib" "/home/testuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-d7aed80bcad8813a.rlib" "/home/testuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-a3916e8afa60a160.rlib" "/home/testuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-eaacce9b176ef080.rlib" "/home/testuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-81e497cd060f0dda.rlib" "/home/testuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-949464f6d582f46f.rlib" "/home/testuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-1ffc094785c92121.rlib" "/home/testuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-f19c324859e53f08.rlib" "/home/testuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-0b82195f1020bf42.rlib" "/home/testuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-4f2339b0071e1016.rlib" "-Wl,--end-group" "/home/testuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-774a5f30b27a1f9c.rlib" "-Wl,-Bdynamic" "-lstdc++" "-ldl" "-lOptickCore_MD" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-ldl" "-lutil"
  = note: /usr/bin/ld: cannot find -lOptickCore_MD
          collect2: error: ld returned 1 exit status
          

error: aborting due to previous error

error: could not compile `profiling`

Using:

rustc 1.48.0 (7eac88abb 2020-11-16)
   stable-x86_64-unknown-linux-gnu unchanged - rustc 1.48.0 (7eac88abb 2020-11-16)
  nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.50.0-nightly (11c94a197 2020-12-21)

It happens when using +stable and +nightly

Please note that it works for:

  • profile-with-tracy
  • profile-with-tracing
  • profile-with-superluminal

The optick crate only provides windows binaries, so the error when running the first command on linux is expected.

For the second error, I'm not certain, but my guess is that this change (imgui-rs/imgui-rs@7e2293b#diff-f54c36ae82d7f23d02ea587211a3211db799fabe7b22c4eb5bad39bcc8fcfa7d) has caused imgui_winit_support to use winit 0.24 and everything else to use 0.23, leading to these errors. You can try running:

cargo update --package imgui_winit_support --precise 0.6.0

to confirm if this is the correct issue.

Or something like this:

  • cargo update --package winit --precise 0.23
  • or maybe cargo update --package winit:0.24.0 --precise 0.23

"multiple versions of winit at once" seems to happen a lot sadly

Therefore maybe it's god to block optick code by adding something like?

// Optick is Windows Only?
#[cfg(target_os = "windows")]

Or maybe use some macros to get on Linux more meaningful error message? (or comment in build file too?)

I've added clearer messaging to the readme on platform support, so hopefully that helps!

The other build error can be fixed with cargo update -p winit:0.24.0 --precise 0.23. It's very unfortunate, but it's caused by imgui-rs being updated in a non-semver-compatible way, and I don't see an out-of-the-box alternative that will force it to use the intended version of winit by default. Thankfully this only affects the example, not the published crate. The best fix for this might be to update the upstream dependencies to also use winit 0.24, but I'm not sure exactly when I'll get around to doing it.

(It's also worth noting that winit 0.24 is required for apple silicon support)

Fixed it by forcing imgui_winit_support = "=0.6.0"

Added issue here: imgui-rs/imgui-rs#412 - I'm hoping we can find a better long term solution than pinning an exact version