Setting up your development environment

This chapter will help you set your development environment for librsvg.

System requirements

  • A 64-bit installation of Linux.

  • 8 GB of RAM, or 16 GB recommended if you will be running the full test suite frequently.

  • Around 10 GB free of hard disk space.

  • You can either use podman to work in a containerized setup (this chapter will show you how), or you can install librsvg’s dependencies by hand.

  • Make sure you have git installed.

  • Your favorite text editor.

Downloading the source code

git clone

Setting up with podman

An easy way to set up a development environment is to use podman to download and run a container image. This is similar to having a chroot with all of librsvg’s dependencies already set up.

Install podman on your distro, and then:

cd librsvg      # wherever you did your "git clone"
sh ci/

In the librsvg source tree, ci/ is a script that will invoke podman pull to download the container image that you can use for development. It is the same image that librsvg uses for its continuous integration pipeline (CI), so you can have exactly the same setup on your own machine.

That script will give you instructions similar to these:

You can now run this:
  podman run --rm -ti --cap-add=SYS_PTRACE -v $(pwd):/srv/project -w /srv/project $image_name

Don't forget to run this once inside the container:
  source ci/

You can cut&paste those commands (from the script’s output, not from this document!). The first one should give you a shell prompt inside the container. The second one will make Rust available in the shell’s environment.

What’s all that magic? Let’s dissect the podman command line:

  • podman run - run a specific container image. The image name is the last parameter in that command; it will look something like This is an image built on on a base of the openSUSE Tumbleweed, a rolling distribution of Linux with very recent dependencies.

  • --rm - Remove the container after exiting. It will terminate when you exit the container’s shell.

  • -ti - Set up an interactive session.

  • --cap-add=SYS_PTRACE - Make it possible to run gdb inside the container.

  • -v $(pwd):/srv/project` - Mount the current directory as ``/srv/project inside the container. This lets you build from your current source tree without first copying it into the container; it will be available in /srv/project.

Finally, don’t forget to source ci/ once you are inside podman run.

You can now skip to Building and testing.

Setting up dependencies manually


Building and testing

Make sure you have gone through the steps in Setting up with podman or Setting up dependencies manually. Then, do the following.

Normal development: You can use cargo build and cargo test as for a simple Rust project; this is what you will use most of the time during regular development. If you are using the podman container as per above, you should do this in the /srv/project directory most of the time.

Doing a full build: You can use the following:

mkdir -p _build
cd _build
../ --enable-gtk-doc --enable-vala
make check

You should only have to do that if you need to run the full test suite, for the C API tests and the tests for limiting memory consumption.