In order to run SerenityOS under Windows, you'll need to use the Windows Subsystem for Linux (WSL) version 2, so you need Windows 10 (v2004 or higher) or Windows 11. WSL lets you run Linux binaries in Windows, so you can have a full Linux distribution available without needing a virtual machine or another computer.
To install it you need an administrator command prompt - you can get to one by going to start, typing cmd, then selecting Run as administrator in the options for Command Prompt.
wsl --install to start the install process. The default distribution is Ubuntu, but you can change it if you like. Check the list of available distributions with
wsl --list --online and then install the one you want with
wsl --install -d <Distro Name>. It can take a while to install - at some point it will tell you to reboot and then finish up, prompting you to create a user account.
Now that you have WSL2, you can start a terminal with the new Ubuntu (or other distro) shortcut in the start menu. Time to build!
First you'll need QEMU for Windows, you can get it at: https://www.qemu.org/download/#windows. Follow the link for the 64-bit installer and get the qemu-w64-setup-YYYYMMDD.exe file. Install at least the Tools and x86_64 System emulation.
Back in WSL2 land we can install the prerequisites to build SerenityOS.
sudo apt install build-essential cmake curl libmpfr-dev libmpc-dev libgmp-dev e2fsprogs ninja-build qemu-system-gui qemu-system-x86 qemu-utils ccache rsync unzip texinfo
Next we need GCC 11. The default Ubuntu install in WSL2 doesn't have it, so we can add it using these steps:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-11 g++-11
SerenityOS uses QEMU version 5 and will build it on its own but it needs a few libraries:
sudo apt install libgtk-3-dev libpixman-1-dev libsdl2-dev libspice-server-dev
All set! Now we can grab the SerenityOS repository.
git clone https://github.com/SerenityOS/serenity.git
And now build QEMU:
Next build the toolchain:
And finally SerenityOS itself!