-
Notifications
You must be signed in to change notification settings - Fork 0
Building on ARM desktop Linux
This page describes how to build a working Servo on ARM desktop Linux. It has been tested on an ODROID XU3-Lite, but should work on other boards such as the Raspberry Pi 2.
ARM desktop Linux is an attractive development platform because of the superior development tools (gdb
, gperftools
), access to many-core and heterogeneous processing boards, more featureful libc
(compared to Bionic), up-to-date systems and drivers, and the ability to run fully-native applications (i.e. applications without Java).
Building Servo on desktop ARM Linux involves bootstrapping Rust, building Rust from source, downloading a bootstrap Cargo, and then building Servo directly (without mach
). Each of these steps are outlined below.
The Rust compiler will not build under any compiler other than itself. This is ordinarily not a problem because the Rust toolchain will download a binary to bootstrap itself with, but the fact that desktop ARM Linux is not an officially supported platform complicates things for us. Fortunately, @japaric has compiled Rust binaries for ARM desktop Linux sufficient for bootstrapping the compiler for us to use.
Navigate to https://github.com/japaric/ruststrap and click on "Nightlies". This will take you to a Dropbox directory. Click on snapshots
and download the snapshot labeled (at the time of this writing) rust-stage0-2015-04-27-857ef6e-linux-arm
. (You can use head -n 20 src/snapshots.txt
in Servo's Rust checkout to see which snapshot you need.) Unpack this snapshot into a directory—say, ~/Applications/rust-snapshot-20150427
.
Servo uses a specific version of Rust and will not build under any other. Clone https://github.com/rust-lang/rust into a directory—say, ~/Source/rust
—and then run git checkout b301e02f && git checkout -b servo
. (This is accurate at the time of this writing; use cat rust-snapshot-hash
inside Servo to verify which revision of Rust you need.)
Caution: These and the following build steps will use quite a bit of memory—perhaps about 2 GB. On many ARM boards, you will need to create some swap space and mount it to avoid running out of memory. Using the swap will not generally grind your system to a halt, even on a slow backing store like an SD card, as much of the memory in the compilation process is cold.
Recall that there is no official Rust binary for desktop ARM Linux. To prevent the Rust configure script from attempting to download such a snapshot and failing, you will need to run Rust's configure script with a special option telling it to use the local installation you downloaded manually. ./configure --enable-local-rust --local-rust-root=~/Applications/rust-snapshot-20150427/rust-stage0
should do the job. You can then run make
(alternately make -jN
on an N
-core device—though watch your memory usage—and/or TIME_PASSES=1 VERBOSE=1 make
if you prefer to see the progress). This will take a good bit of time, perhaps 30 minutes to an hour depending on the speed of your board.
Servo does not currently depend on more advanced Cargo features, so relatively old versions of Cargo seem to be OK. From the "Nightlies" Dropbox directory linked to from https://github.com/japaric/ruststrap, download the file beginning with cargo-2015-06-02-34a52a4-arm-unknown-linux-gnueabihf
. Extract it somewhere, perhaps ~/Applications/cargo
.
First, check out the main branch of Servo from https://github.com/servo/servo. Be sure to check out the submodules as well.
Warning: These instructions won't actually work as described, because we have to apply a few patches to various Servo subprojects to get things to build at all. You have been warned…
We cannot use mach
because ARM desktop Linux is currently not supported by the standard Servo build infrastructure. Fortunately for us, mach
is a relatively thin layer over Cargo, so we can just use Cargo to do the heavy lifting. Change into the main Servo binary via cd components/servo
. Then use PATH=$PATH:/home/yourusername/Source/rust/arm-linux-gnueabihf/stage2/bin LD_LIBRARY_PATH=/home/yourusername/Source/rust/arm-linux-gnueabihf/stage2/lib ~/Applications/cargo/bin/cargo build
(adding --release
if you want an optimized—i.e. reasonably-performing—binary). The resulting build will take quite a bit of time and memory to complete, though not as much as Rust itself.
Once the build finishes, you can run Servo via target/debug/servo -G es2
(or target/release/servo -G es2
). The LD_LIBRARY_PATH
is not necessary, as the build should be statically linked.