Installing a supported Rust compiler

Azul (version 0.1.0) is supported on Rust 1.31 or newer. Please ensure that you have the right compilerversion, by running rustc -vV after installation to check the version number.

Installation on Windows

Note

If you get prompted to install the MSVC toolchain, please download both theVisual C++ tools (available from here)and install the Windows 8 or 10 SDK (which contains the actual linker) fromthe Visual Studio Tools installer.

Note

If you choose the MinGW toolchain on windows, 32-bit support is missing,due to problems with a C dependency. Because of this, we recommend you to usethe MSVC toolchain on Windows or use a 64-bit compiler.

  1. DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
  2. rustup-init -yv --default-toolchain stable --default-host x86_64-pc-windows-msvc

…or download the windows installer manually from https://win.rustup.rs/.

Installation on Linux / Mac

  1. curl https://sh.rustup.rs -sSf | sh

If you do not trust executing a remote script, download the script seperately, review it andthen execute it. You can also find the installation instructions for Rust on themain website.

Notes for users of the Haskell IDE "Leksah" (MSVC)

If you are using Leksah and you are experiencing crashes with exit code: 0xc0000139, STATUS_ENTRYPOINT_NOT_FOUND (meaning that the application expected a function thatwasn't there due to a DLL version mismatch), please uninstall Leksah first. For somereason, harfbuzz-sys prefers Leksahs version of HarfBuzz over Azuls version, so besure that your linker links to the right version of HarfBuzz.

System dependencies

You currently need to install CMake before you can use azul.This applies to all platforms, since CMake is used during the build process to compileservo-freetype and harfbuzz-sys.

Linux

On Linux, you additionally need to install libexpat-dev and libfreetype6-dev in orderto compile servo-freetype-sys(see #42).

For interfacing with the system clipboard, you also need libxcb-xkb-dev.Since azul uses the system-native fonts by default, you'll also needlibfontconfig1-dev (which includes expat and freetype2).

Your users will need to install libfontconfig andlibxcb-xkb1 installed (remember this for packaging rpm or deb packages).

Lastly, if there is no OpenGL available, azul will fallback and try to findlibEGL.so. Especially when testing inside of a VM, it is important to installlibgles2-mesa-dev - note that the software will compile if this libraryisn't present, it just won't run without it.

  1. sudo apt install \
  2. cmake libxcb-xkb-dev libfontconfig1-dev libgles2-mesa-dev \
  3. libfreetype6-dev libexpat-dev

Note for Arch Linux: On Arch, the package for libfontconfig1-devseems to be called fontconfig.

Other dependencies are statically linked in all binaries, you don't need toworry about managing them.

Creating a new project

Once you have Rust and Cargo installed, create a new project in thedirectory of your choice:

  1. cargo new --bin my_first_azul_app
  2. cd my_first_azul_app
  3. cargo run

Adding azul to your dependencies

Open the /my_first_azul_app/Cargo.toml file and paste the followinglines beneath the [dependencies] section:

  1. [dependencies]
  2. azul = { git = "https://github.com/maps4print/azul" }

WARNING: Azul has not yet been released on crates.io, therefore,there is no package available. This guide will be updated once thefirst stable version releases. It is recommended to version-lock yourdependency with { git = "…", rev = "the_last_commit_hash" }, sothat you know which commit you are using.

This will pull in the latest stable version of azul. Open the/my_first_azul_app/src/main.rs file and edit it to look like this:

  1. extern crate azul;
  2.  
  3. fn main() {
  4. println!("Hello world!");
  5. }

Ensure that azul builds correctly by running cargo run again. Azuldoes not require third-party dependencies (dynamic libraries), itshould build out-of-the-box. If that's the case, you are ready tomove on to the next page, starting to actually build your first GUIapp with azul. If not, please report this as a bug.