Evaluating Rust's Azul Crate

2021-02-21 // 3 minutes


As part of the effort to survey Rust's current desktop GUI crate offers, I opted to evaluate each target as a separate blog post. I originally had them all in one blog post, but that got very long, very fast.

After the disappointing effort with Azul, I picked the next crate alphabetically - basalt. Let's skip the preamble and head straight in to seeing if the starter code will compile.

Testing Starter Code

Once again, we're hitting issues right from the jump. The starter code provided in the README doesn't compile. For posterity, here's the code and error I received.

extern crate basalt;

use basalt::{
	interface::bin::{self, BinPosition, BinStyle},
use std::sync::Arc;

fn main() {
			.window_size(300, 300)
		Box::new(move |basalt_res| {
			let basalt = basalt_res.unwrap();

			let background = basalt.interface_ref().new_bin();

			background.style_update(BinStyle {
				pos_from_t: Some(0.0),
				pos_from_b: Some(0.0),
				pos_from_l: Some(0.0),
				pos_from_r: Some(0.0),
				back_color: Some(bin::Color::srgb_hex("f0f0f0")),

			let button = basalt.interface_ref().new_bin();

			button.style_update(BinStyle {
				position: Some(BinPosition::Parent),
				pos_from_t: Some(75.0),
				pos_from_l: Some(75.0),
				width: Some(75.0),
				height: Some(30.0),
				back_color: Some(bin::Color::srgb_hex("c0c0c0")),
				border_size_t: Some(1.0),
				border_size_b: Some(1.0),
				border_size_l: Some(1.0),
				border_size_r: Some(1.0),
				border_color_t: Some(bin::Color::srgb_hex("707070")),
				border_color_b: Some(bin::Color::srgb_hex("707070")),
				border_color_l: Some(bin::Color::srgb_hex("707070")),
				border_color_r: Some(bin::Color::srgb_hex("707070")),
				text: String::from("Button"),
				text_height: Some(14.0),
				pad_t: Some(10.0),
				pad_l: Some(10.0),
				text_color: Some(bin::Color::srgb_hex("303030")),

				Arc::new(move |_button, event_data| {
					println!("{:?}", event_data);

λ cargo run
   Compiling miniz_oxide v0.4.3
The following warnings were emitted during compilation:

warning: System installed library not found.  Falling back to build from source

error: failed to run custom build command for `shaderc-sys v0.6.3`

Caused by:
  process didn't exit successfully: `D:\Projects\rust-gui-survey\basalt-test\target\debug\build\shaderc-sys-8bfa33387fdfb646\build-script-build` (exit code: 101)
  --- stdout
  cargo:warning=System installed library not found.  Falling back to build from source

  --- stderr
  thread 'main' panicked at '

  couldn't find required command: "ninja"

  ', C:\Users\JR\.cargo\registry\src\github.com-1ecc6299db9ec823\shaderc-sys-0.6.3\build\cmd_finder.rs:50:13
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed

There's two issues here. One is simple to fix: I just needed to install ninja on my Windows machine as I forgot that I only had it installed in on my Macbook. The other is the custom build command failing for shaderc-sys. The GitHub issue tracker has nothing listed for that yet. I'll fix that. But first, let's try to get this running on my macbook.

Well, there are a smattering of different errors including the auspicious "could not compile 'curl'". If you're build process involves compiling curl, and you are not yourself curl, I suspect something funky is going on. It also caused my build to hang indefinitely.

Last thought, will this compile if we switch the toolchain to nightly? Well, it gets past shaderc-sys (yay) but then fails on compiling something else because it couldn't find the crate for metal, among other issues. I think it's time to move on.