Building Servo

If this is your first time building Servo, be sure to set up your environment before continuing with the steps below.

To build servoshell for your machine:

$ ./mach build -d

To build servoshell for Android (armv7):

$ ./mach build --android

Sometimes the tools or dependencies needed to build Servo will change. If you start encountering build problems after updating Servo, try running ./mach bootstrap again, or set up your environment from the beginning.

You are not alone! If you have problems building Servo that you can’t solve, you can always ask for help in the build issues chat on Zulip.

Build profiles

There are three main build profiles, which you can build and use independently of one another:

  • debug builds, which allow you to use a debugger (lldb)
  • release builds, which are slower to build but more performant
  • production builds, which are used for official releases only
debug release production
mach option -d -r --profile production
optimised? noyesyes
debug info? yesnono
debug assertions? yesyes(!)no
maximum RUST_LOG level traceinfoinfo
SpiderMonkey debug build? no, unless you ./mach build --debug-mozjs
finds resources in
current working dir?
yesyesno

You can change these settings in a servobuild file (see servobuild.example) or in the root Cargo.toml.