Using GNOME Builder for Vala development

Vala programing language is, let say, misunderstood most of the time. May this explain, why there are few support for IDEs, like GNOME Builder, at least at beginning.

In 3.20.4, GNOME Builder has improved and stabilized its support for Vala development, proven to be stable enough for daily usage. Even I started to use it for GXml upstream development. But it was a little difficult, because I want to stay in a stable long term supported OS, like Debian 8.

Debian 8, has been discarded by GNOME wiki, to install and develop using jhbuild, making hard for me to develop upstream. In order to solve this, I started to test Builder from xdg-app and nightly builds, because, it suppose to be in sync with master (upstream) versions of basic Platform, for upcoming 3.22. While I rather happy with Builder running this way, you need some extra configuration to develop any Vala project under xdg-app sanboxed environment.

While Vala 0.32 is available in org.gnome.Sdk 3.20, the one I’m using to develop GXml, no libgee is installed and you can’t simple compile and install it, because in the Builder sanboxed environment, /usr is mounted read-only. So I first:

  1. Get libgee sources
  2. Set “Installation Prefix” to /home/yourusername/.local
  3. Disable instrospection (–disable-introspection), by setting “Configure Options”
  4. Use “Host operating system”

This will make the trick to compile and install libgee in your home directory. Libgee doesn’t requires other dependencies. But for GXml, we need a few more work, because you should setup it to find pc files for libgee and more important, to find its VAPI file.

To configure GXml on Builder, in sanboxed environment:

  1. Get sources
  2. Set “Installation Prefix” to /home/yourusername/.local
  3. Disable instrospection (–disable-introspection), by setting “Configure Options”
  4. Use “Host operating system”
  5. Set “Environment” variables for VALAFLAGS and PKG_CONFIG_PATH
  6. In your Makefile.am make sure you add –vapidir=/home/yourusername/.local/share/vala-0.32/vapi to your Vala compile flags.

VALAFLAGS is useful for code completion in Builder, add most of your project Vala flags. PKG_CONFIG_PATH should be set to /home/yourusername/.local/lib/pkgconfig in order to find pc files of your locally installed dependencies.

You’ll find Builder complaint by reporting some warnings, most of them coming from libgee usage.

Building your Vala project in Builder, is no jet really integrated, because most errors are shown in terminal “Build Output”, but not in build messages, no other than the libgee ones. Fortunately, you have color output from valac, making more easy to find errors and warnings.

Most of you may will use a distribution, to use Builder and jhbuild, making easy to develop upstream. I can’t do that, because some other activities requires me to have an stable system, avoid interruptions because my unpaid contributions to GNOME.

Author: despinosa

Linux and GNOME user, full time, since 2001. Actual maintainer of GXml and contributor to other projects mainly on GObject Introspection support.