I'm trying to compile the tour example of iced, but it gives me the following error:
failed to run custom build command for `servo-fontconfig-sys v4.0.8`
Caused by:
process didn't exit successfully: `/home/fabian/git/iced/target/debug/build/servo-fontconfig-sys-d1a79e2a5442f475/build-script-build` (exit code: 101)
--- stdout
cd /home/fabian/git/iced/target/debug/build/servo-fontconfig-sys-897f4e149b715354/out && \
CC="gcc" \
AR="ar" \
FREETYPE_CFLAGS="" \
FREETYPE_LIBS="" \
CFLAGS=""" -fPIC" \
/home/fabian/.cargo/registry/src/github.com-1ecc6299db9ec823/servo-fontconfig-sys-4.0.8/configure \
--disable-docs \
--disable-shared \
\
--host=x86_64-unknown-linux-gnu --sysconfdir=/etc --localstatedir=/var &&
--- stderr
/bin/sh: 11: Syntax error: end of file unexpected
make: *** [makefile.cargo:83: /home/fabian/git/iced/target/debug/build/servo-fontconfig-sys-897f4e149b715354/out/Makefile] Fehler 2
thread 'main' panicked at 'assertion failed: Command::new("make").env("MAKEFLAGS",
env::var("CARGO_MAKEFLAGS").unwrap_or_default()).args(&["-R",
"-f",
"makefile.cargo"]).status().unwrap().success()', /home/fabian/.cargo/registry/src/github.com-1ecc6299db9ec823/servo-fontconfig-sys-4.0.8/build.rs:20:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
warning: build failed, waiting for other jobs to finish...
error: build failed
It seems to have something to do with fontconfig somehow?
I think this is related to #58. Do you have pkg-config installed?
Yes, pkg-config is installed.
pkg-config --version returns 0.29, but in here, I found the following code:
if let Ok(lib) = pkg_config::Config::new().atleast_version("2.11.1").find("fontconfig") {
println!("cargo:incdir={}", lib.include_paths[0].clone().into_os_string().into_string().unwrap());
return;
}
Is the atleast_version("2.11.1") related to this? I have no idea.
I have found a solution for the issue. The error is related to fontconfig, which is also used in Servo. Servo recommends the following command:
sudo apt install git curl autoconf libx11-dev \
libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \
gperf g++ build-essential cmake virtualenv python-pip \
libssl-dev libbz2-dev liblzma-dev libosmesa6-dev libxmu6 libxmu-dev \
libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \
libharfbuzz-dev ccache clang libunwind-dev \
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13 llvm-dev
After installing these libraries, the original error was resolved. However another error occured while compiling the tour example:
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/fabian/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-native-0.4.1/src/instance.rs:474
17: wgpu::Adapter::request
at /home/fabian/.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:418
20: iced_winit::application::Application::run
at ./winit/src/application.rs:129
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.
@fabianboesiger You should not need to build fontconfig from source in most environments. Is your fontconfig at least 2.11.1?
About the issue, this is most likely related to wgpu. Try any of the examples in the wgpu repository and see if the same issue happens there. Some people have fixed the issue by updating their graphics drivers.
fontconfig is version 2.13.1.
You are probably right about the relation with wgpu, because if I try running the examples they always panic with internal error: entered unreachable code. The graphics driver (Intel HD Graphics) is up to date.
Given the panic at the request_adapter function, which only happens if no supported devices are found, you either don't have the Vulkan drivers installed or your Intel HD Graphics doesn't support Vulkan.
Thank you so much for your help! Both the wgpu and the iced examples are now working after installing the mesa-vulkan-drivers package.
Maybe add a list of the required packages somewhere in the README.md?
Running into this as well; have no code other than iced = "0.1.0-beta", in Cargo.toml. How do you install pkg-config?
With apt, you can simply apt update && apt install pkg-config.
Thank you
Most helpful comment
Given the panic at the
request_adapterfunction, which only happens if no supported devices are found, you either don't have the Vulkan drivers installed or your Intel HD Graphics doesn't support Vulkan.