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

Panic when running any of the examples under Linux Intel GPU #69

Closed
ancwrd1 opened this issue Nov 25, 2019 · 22 comments · Fixed by #74
Closed

Panic when running any of the examples under Linux Intel GPU #69

ancwrd1 opened this issue Nov 25, 2019 · 22 comments · Fixed by #74
Labels
bug Something isn't working
Milestone

Comments

@ancwrd1
Copy link

ancwrd1 commented Nov 25, 2019

Environment:

openSUSE Tumbleweed, kernel 5.3.11.
KDE Plasma 5.17.3
System font: Noto Sans
Mesa DRI Intel(R) HD Graphics 620 (Kaby Lake GT2)
Mesa 19.2.4
Vulkan Instance Version: 1.1.127

Running cargo run --example tour causes panic with the following stack trace (snipped):

  15: core::result::Result<T,E>::unwrap
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libcore/result.rs:933
  16: wgpu_glyph::builder::GlyphBrushBuilder<()>::using_fonts_bytes::{{closure}}
             at /home/dmitry/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu_glyph-0.6.0/src/builder.rs:44
  17: core::iter::adapters::map_fold::{{closure}}
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libcore/iter/adapters/mod.rs:694
  18: core::iter::traits::iterator::Iterator::fold::ok::{{closure}}
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libcore/iter/traits/iterator.rs:1813
  19: core::iter::traits::iterator::Iterator::try_fold
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libcore/iter/traits/iterator.rs:1694
  20: core::iter::traits::iterator::Iterator::fold
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libcore/iter/traits/iterator.rs:1816
  21: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libcore/iter/adapters/mod.rs:727
  22: core::iter::traits::iterator::Iterator::for_each
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libcore/iter/traits/iterator.rs:616
  23: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::spec_extend
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/liballoc/vec.rs:1966
  24: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/liballoc/vec.rs:1949
  25: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/liballoc/vec.rs:1836
  26: core::iter::traits::iterator::Iterator::collect
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libcore/iter/traits/iterator.rs:1478
  27: wgpu_glyph::builder::GlyphBrushBuilder<()>::using_fonts_bytes
             at /home/dmitry/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu_glyph-0.6.0/src/builder.rs:41
  28: iced_wgpu::text::Pipeline::new
             at wgpu/src/text.rs:36
  29: iced_wgpu::renderer::Renderer::new
             at wgpu/src/renderer.rs:64
  30: <iced_wgpu::renderer::Renderer as iced_native::renderer::windowed::Windowed>::new
             at wgpu/src/renderer.rs:417
  31: iced_winit::application::Application::run
             at ./winit/src/application.rs:115
  32: iced::application::Application::run
             at ./src/application.rs:140
  33: iced::sandbox::Sandbox::run
             at ./src/sandbox.rs:128
  34: tour::main
             at examples/tour.rs:10
@hecrj
Copy link
Member

hecrj commented Nov 25, 2019

Thanks for the report!

Could you provide the output of fc-match sans-serif and fc-match serif?

@ancwrd1
Copy link
Author

ancwrd1 commented Nov 25, 2019

Here is it:

fc-match sans-serif
arial.ttf: "Arial" "Regular"

fc-match serif
times.ttf: "Times New Roman" "Regular"

@hecrj
Copy link
Member

hecrj commented Nov 25, 2019

Thanks! I believe those fonts should work fine.

I forgot we are also currently loading a mono font for the overlay view. Sorry. Could you provide the output of fc-match monospace as well?

@ancwrd1
Copy link
Author

ancwrd1 commented Nov 25, 2019

Sure:

fc-match monospace
SourceCodePro-Regular.otf: "Source Code Pro" "Regular"

I guess that's where it breaks.

@ancwrd1
Copy link
Author

ancwrd1 commented Nov 25, 2019

I changed the preferred monospace font to something else (Noto Mono) and now it starts correctly.

@hecrj
Copy link
Member

hecrj commented Nov 25, 2019

@Dremon Glad to know! And yes, OpenType fonts are not completely supported by rusttype.

We may be able to fix this by contributing to font-kit and adding a method to request a list of matching fonts. Somewhat related is servo/font-kit#62. I will investigate further.

Thank you again for the report :)

@Karrq
Copy link

Karrq commented Nov 26, 2019

I also have this issues, as all my fonts are OpenType fonts, specifically NimbusSans for sans-serif, NimbusRoman for serif, and NimbusMonoPS for monospace.

I believe these fonts are from KDE which is my desktop environment on Arch Linux.

@hecrj hecrj added this to the 0.2.0 milestone Nov 26, 2019
@hecrj hecrj added the bug Something isn't working label Nov 26, 2019
@ironhouzi
Copy link

Same issue.

$ fc-match sans-serif
Vera.ttf: "Bitstream Vera Sans" "Roman"

$ fc-match serif
VeraSe.ttf: "Bitstream Vera Serif" "Roman"

$ fc-match monospace
DroidSansMono.ttf: "Droid Sans Mono" "Regular"

@hecrj
Copy link
Member

hecrj commented Nov 26, 2019

Sorry to hear that.

This is one of the main reasons I think having a renderer alternative is important. iced_wgpu still needs to mature quite a bit.

In the meantime, maybe we could avoid panicking in wgpu_glyph and embed a fallback font that is guaranteed to work for these cases.

@hecrj
Copy link
Member

hecrj commented Nov 26, 2019

I have opened #74, which should fix the issue.

@FuGangqiang
Copy link

when I use unicode text: 欢迎,get an render error, but the unicode title render right

impl<'a> Step {
   fn welcome() -> Column<'a, StepMessage> {
       Self::container("Welcome!")
           .push(Text::new(
               "欢迎, \
               This is a simple tour meant to showcase a bunch of widgets \
                that can be easily implemented on top of Iced.",
           ))
           .push(Text::new(
               "Iced is a cross-platform GUI library for Rust focused on \
                simplicity and type-safety. It is heavily inspired by Elm.",
           ))
           .push(Text::new(
               "It was originally born as part of Coffee, an opinionated \
                2D game engine for Rust.",
           ))
           .push(Text::new(
               "On native platforms, Iced provides by default a renderer \
                built on top of wgpu, a graphics library supporting Vulkan, \
                Metal, DX11, and DX12.",
           ))
           .push(Text::new(
               "Additionally, this tour can also run on WebAssembly thanks \
                to dodrio, an experimental VDOM library for Rust.",
           ))
           .push(Text::new(
               "You will need to interact with the UI in order to reach the \
                end!",
           ))
   }
}

DeepinScreenshot_select-area_20191127232227

@FuGangqiang
Copy link

FuGangqiang commented Nov 27, 2019

the unicode 欢迎(welcome) is CJK character

@hecrj
Copy link
Member

hecrj commented Nov 27, 2019

@FuGangqiang We do not support font fallback nor text shaping yet! This is being tracked in #33.

@FuGangqiang
Copy link

thanks for remind

@hanckmann
Copy link

I am really interested in using this UI library, but I the same (?) error as posted by dremon.
Is it useful to provide system details or more error logs?

λ ~/ fc-match sans-serif
DejaVuSans.ttf: "DejaVu Sans" "Book"
λ ~/ fc-match serif
DejaVuSerif.ttf: "DejaVu Serif" "Book"
λ ~/ fc-match monospace
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"

Does this mean that the DejaVu fonts are not supported?

@hecrj
Copy link
Member

hecrj commented Nov 28, 2019

@hanckmann fc-match produces the same output on my system. Overall, TrueType fonts should work. Does #74 fix the issue? If not, I'd appreciate it if you could provide a stack trace there.

@hanckmann
Copy link

I just checked out the latest version from master and tried to compile/run it.
I suppose that #74 did not fix the issue for me.
This is my stack trace:

λ ~/Projects/rust/iced/ master export RUST_BACKTRACE=1
λ ~/Projects/rust/iced/ master cargo run --example tour
    Finished dev [unoptimized + debuginfo] target(s) in 0.66s
     Running `target/debug/examples/tour`
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:378:21
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:76
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:60
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1030
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1412
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:64
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:196
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:210
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:473
  11: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:380
  12: rust_begin_unwind
             at src/libstd/panicking.rs:307
  13: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  14: core::panicking::panic
             at src/libcore/panicking.rs:49
  15: core::option::Option<T>::unwrap
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libcore/macros.rs:12
  16: wgpu_request_adapter
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-native-0.4.0/src/instance.rs:474
  17: wgpu::Adapter::request
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.4.0/src/lib.rs:545
  18: iced_wgpu::renderer::Renderer::new
             at wgpu/src/renderer.rs:51
  19: <iced_wgpu::renderer::Renderer as iced_native::renderer::windowed::Windowed>::new
             at wgpu/src/renderer.rs:417
  20: iced_winit::application::Application::run
             at ./winit/src/application.rs:115
  21: iced::application::Application::run
             at ./src/application.rs:140
  22: iced::sandbox::Sandbox::run
             at ./src/sandbox.rs:128
  23: tour::main
             at examples/tour.rs:10
  24: std::rt::lang_start::{{closure}}
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/rt.rs:64
  25: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:49
  26: std::panicking::try::do_call
             at src/libstd/panicking.rs:292
  27: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:80
  28: std::panicking::try
             at src/libstd/panicking.rs:271
  29: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  30: std::rt::lang_start_internal
             at src/libstd/rt.rs:48
  31: std::rt::lang_start
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/rt.rs:64
  32: main
  33: __libc_start_main
  34: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

My system info:
ArchLinux [Linux version 5.3.13-arch1-1 (linux@archlinux) (gcc version 9.2.0 (GCC)) #1 SMP PREEMPT Sun, 24 Nov 2019 10:15:50 +0000]
DE: xfce4 4.14
WM: i3-wm 4.17.1-1
lspci video: 00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 0b)

If there is any more info you need, just let me know!

@hecrj
Copy link
Member

hecrj commented Nov 29, 2019

@hanckmann Thanks for the trace.

This is not exactly the same issue, as it's not font related. wgpu cannot seem to find a suitable graphics adapter, as per this line:

16: wgpu_request_adapter
at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-native-0.4.0/src/instance.rs:474

I am aware the panic message does not help much (the issue for that is gfx-rs/wgpu#368).

I would try to make sure your Vulkan drivers are installed correctly: Vulkan - ArchWiki. Even if that does not fix the issue, I am working on a renderer alternative that should be able to fallback to software mode in these cases.

@hanckmann
Copy link

You are right, it is indeed due to not having installed the vulkan driver. Thanks for the hint, but yes... the error message is not very helpful at all.

@dessalines
Copy link

dessalines commented Nov 30, 2019

I'm getting this also on linux. The error message tells nothing, but the extended stack says its wgpu :

  15: core::option::Option<T>::unwrap                                                                             
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libcore/macros.rs:12                          
  16: wgpu_request_adapter                                                                                        
             at /home/aaa/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-native-0.4.1/src/instance.rs:474 
  17: wgpu::Adapter::request                                                                                      
             at /home/aaa/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.4.0/src/lib.rs:545             
  18: iced_wgpu::renderer::Renderer::new
             at /home/aaa/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_wgpu-0.1.0/src/renderer.rs:51
  19: <iced_wgpu::renderer::Renderer as iced_native::renderer::windowed::Windowed>::new
             at /home/aaa/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_wgpu-0.1.0/src/renderer.rs:417

Edit: okay the fix for arch linux is to install vulkan-intel

@zhangchunlin
Copy link

Also run into this problem with latest source code

~/sandbox/iced/iced/target/debug$ fc-match sans-serif
NotoSansCJK-Regular.ttc: "Noto Sans CJK SC" "Regular"
~/sandbox/iced/iced/target/debug$ fc-match serif
uming.ttc: "AR PL UMing CN" "Light"
~/sandbox/iced/iced/target/debug$ fc-match monospace
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"

@zhangchunlin
Copy link

After read #422 , I can run with this kind of command: cargo run --features glow --package todos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants