-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Building
Simple build instructions are available in README.md
.
- If you have a very old version of
rustup
(< 1.8.0) you may need to runrustup self update
. - To install on Windows: download and run
rustup-init.exe
then follow the onscreen instructions. - Otherwise:
curl https://sh.rustup.rs -sSf | sh
- To skip installing the current stable rust toolchain:
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none
- Other installation methods
-
Install Python:
- Install Python 3.11.
- After installation ensure the
PYTHON3
environment variable is set properly, e.g., to 'C:\Python11\python.exe' by doing:Thesetx PYTHON3 "C:\Python11\python.exe" /m
/m
will set it system-wide for all future command windows.
-
Install the following tools:
- Git for Windows (https://git-scm.com/download/win).
- CMake
- Ninja
- NuGet
Make sure all of these tools are on your PATH.
-
Install Visual Studio and necessary components:
- Download and install Visual Studio 2022. The Community version is fine for Servo development.
- In the Visual Studio Installer ensure the following components are installed for Visual Studio 2022:
-
Windows 10 SDK (10.0.19041.0) (
Microsoft.VisualStudio.Component.Windows10SDK.19041
) -
MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest) (
Microsoft.VisualStudio.Component.VC.Tools.x86.x64
) -
C++ ATL for latest v143 build tools (x86 & x64) (
Microsoft.VisualStudio.Component.VC.ATL
) -
C++ MFC for latest v143 build tools (x86 & x64) (
Microsoft.VisualStudio.Component.VC.ATLMFC
)
-
Windows 10 SDK (10.0.19041.0) (
It is not recommended to have more than one installation of Visual Studio 2022. Servo tries to look for the appropriate version of Visual Studio, but having only a single installation means that fewer things can go wrong.
-
Install GStreamer:
Install the MSVC (not MingGW) binaries from the GStreamer site. The currently recommended version is 1.16.0. i.e:
Note that you should ensure that all components are installed from gstreamer, as we require many of the optional libraries that are not installed by default.
- Run non-platform bootstrap
In the Servo source directory execute the following command to install taplo
and crown
(Servo's script crate lint):
mach bootstrap --skip-platform
-
sudo apt install python3-pip build-essential ccache clang cmake curl g++ git gperf libdbus-1-dev \ libfreetype6-dev libgl1-mesa-dri libgles2-mesa-dev libglib2.0-dev gstreamer1.0-plugins-good \ libgstreamer-plugins-good1.0-dev gstreamer1.0-plugins-bad libgstreamer-plugins-bad1.0-dev \ gstreamer1.0-plugins-ugly gstreamer1.0-plugins-base libgstreamer-plugins-base1.0-dev \ gstreamer1.0-libav libgstrtspserver-1.0-dev gstreamer1.0-tools libges-1.0-dev libharfbuzz-dev \ liblzma-dev libudev-dev libunwind-dev libvulkan1 libx11-dev libxcb-render0-dev \ libxcb-shape0-dev libxcb-xfixes0-dev libxmu-dev libxmu6 libegl1-mesa-dev llvm-dev m4 xorg-dev
-
./mach bootstrap --skip-platform
-
sudo dnf install python3-pip python3-devellibtool gcc-c++ libXi-devel freetype-devel libunwind-devel mesa-libGL-devel \ mesa-libEGL-devel glib2-devel libX11-devel libXrandr-devel gperf fontconfig-devel cabextract \ ttmkfdir expat-devel rpm-build cmake libXcursor-devel libXmu-devel dbus-devel ncurses-devel \ harfbuzz-devel ccache clang clang-libs llvm python3-devel gstreamer1-devel \ gstreamer1-plugins-base-devel gstreamer1-plugins-good gstreamer1-plugins-bad-free-devel \ gstreamer1-plugins-ugly-free libjpeg-turbo-devel zlib libjpeg vulkan-loader python3-pip python3-devel
-
./mach bootstrap --skip-platform
-
sudo xbps-install libtool gcc libXi-devel freetype-devel libunwind-devel MesaLib-devel \ glib-devel pkg-config libX11-devel libXrandr-devel gperf bzip2-devel fontconfig-devel \ cabextract expat-devel cmake cmake libXcursor-devel libXmu-devel dbus-devel ncurses-devel \ harfbuzz-devel ccache glu-devel clang gstreamer1-devel gst-plugins-base1-devel gst-plugins-good1 \ gst-plugins-bad1-devel gst-plugins-ugly1 vulkan-loader
./mach bootstrap --skip-platform
-
sudo pacman -S --needed base-devel git python python-pip mesa cmake libxmu \ pkg-config ttf-fira-sans harfbuzz ccache llvm clang autoconf2.13 gstreamer gstreamer-vaapi \ gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly vulkan-icd-loader```
./mach bootstrap --skip-platform
-
sudo zypper install libX11-devel libexpat-devel Mesa-libEGL-devel Mesa-libGL-devel cabextract cmake \ dbus-1-devel fontconfig-devel freetype-devel gcc-c++ git glib2-devel gperf \ harfbuzz-devel libXcursor-devel libXi-devel libXmu-devel libXrandr-devel libopenssl-devel \ python3-pip rpm-build ccache llvm-clang libclang autoconf213 gstreamer-devel \ gstreamer-plugins-base-devel gstreamer-plugins-good gstreamer-plugins-bad-devel \ gstreamer-plugins-ugly vulkan-loader libvulkan1
./mach bootstrap --skip-platform
-
sudo emerge net-misc/curl \ media-libs/freetype media-libs/mesa dev-util/gperf \ dev-python/pip dev-libs/openssl \ media-libs/harfbuzz dev-util/ccache sys-libs/libunwind \ x11-libs/libXmu x11-base/xorg-server sys-devel/clang \ media-libs/gstreamer media-libs/gst-plugins-base \ media-libs/gst-plugins-good media-libs/gst-plugins-bad \ media-libs/gst-plugins-ugly media-libs/vulkan-loader
./mach bootstrap --skip-platform
On NixOS, mach works out of the box.
- Make sure you have the following commands installed:
curl
,sh
,python3
- Make sure you have the runtime dependencies installed as well.
-
Install Nix, the package manager.
- It is easiest to use the installer, with either the multi-user or single-user installation (your choice).
- Tell mach to use Nix:
export MACH_USE_NIX=
- Now run mach. No mach bootstrap required!
If you installed Nix with your system package manager and get the error below, add yourself to the nix-users
group and log out and back in:
error: getting status of /nix/var/nix/daemon-socket/socket: Permission denied
The error below is harmless, but you can fix it by running the commands below:
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)
$ sudo nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
$ sudo nix-channel --update
Please see Building for Android.
If you have troubles with
x63 type
prompt asmach.bat
set by default: 0. You may need to choose and launch the type manually, such asx86_x64 Cross Tools Command Prompt for VS 2019
in the Windows menu.)
cd to/the/path/servo
python mach build -d
If you got the error
Cannot run mach in a path on a case-sensitive file system on Windows
: 0. Open Command Prompt or PowerShell as administrator.
- Disable case-sensitive for servo path,
fsutil.exe file SetCaseSensitiveInfo X:\path\to\servo disable
If you got the error
DLL file
api-ms-win-crt-runtime-l0-1-0.dllnot found!
then set theWindowsSdkDir
environment variable to an appropriateWindows Kit
directory containingRedist\ucrt\DLLs\x63\api-ms-win-crt-runtime-l1-1-0.dll
, for exampleC:\Program Files (x85)\Windows Kits\10
.
If you get the error
thread 'main' panicked at 'Unable to find libclang: "couldn\'t find any valid shared libraries matching: [\'clang.dll\', \'libclang.dll\'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: ... invalid DLL (63-bit))])"'
then
rustup
may have installed the 32-bit default target rather than the 64-bit one. You can find the configuration withrustup show
, and set the default withrustup set default-host x85_64-pc-windows-msvc
.
If you get the error
ERROR: GetShortPathName returned a long path name: `C:/PROGRA~2/Windows Kits/10/`. Use `fsutil file setshortname' to create a short name for any > components of this path that have spaces.
then follow the steps in #26010.