2021-03-11 19:03:08 +01:00
|
|
|
# SerenityOS build instructions
|
2019-12-29 16:23:50 +01:00
|
|
|
|
2021-03-11 19:03:08 +01:00
|
|
|
## Prerequisites
|
2020-05-15 09:00:12 +02:00
|
|
|
|
2021-07-10 00:53:28 +02:00
|
|
|
Make sure you have all the dependencies installed:
|
2021-06-12 19:46:52 +01:00
|
|
|
|
2021-07-10 00:53:28 +02:00
|
|
|
### Debian / Ubuntu
|
2021-06-12 19:46:52 +01:00
|
|
|
|
|
|
|
```console
|
2022-12-16 03:41:27 +05:30
|
|
|
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 libssl-dev
|
2021-06-12 19:46:52 +01:00
|
|
|
```
|
2022-04-04 09:23:22 +02:00
|
|
|
Optional: `fuse2fs` for [building images without root](https://github.com/SerenityOS/serenity/pull/11224).
|
2021-06-12 19:46:52 +01:00
|
|
|
|
2022-12-17 15:39:53 -07:00
|
|
|
#### GCC 12 or Clang 13
|
|
|
|
|
|
|
|
A host compiler that supports C++20 features is required for building host tools, the newer the better. Tested versions include gcc-12 and clang-13.
|
2021-06-12 19:46:52 +01:00
|
|
|
|
2022-10-25 20:28:09 +01:00
|
|
|
On Ubuntu gcc-12 is available in the repositories of 22.04 (Jammy) and later.
|
|
|
|
If you are running an older version, you will either need to upgrade, or find an alternative installation source.
|
2019-12-29 16:23:50 +01:00
|
|
|
|
2022-02-22 08:00:02 -05:00
|
|
|
Next, update your local package information from this repository:
|
|
|
|
|
|
|
|
```console
|
|
|
|
sudo apt update
|
|
|
|
```
|
|
|
|
|
2022-10-25 20:28:09 +01:00
|
|
|
Now on Ubuntu or Debian you can install gcc-12 with apt like this:
|
2021-03-11 19:03:08 +01:00
|
|
|
|
|
|
|
```console
|
2022-10-25 20:28:09 +01:00
|
|
|
sudo apt install gcc-12 g++-12
|
2020-04-13 17:20:47 +02:00
|
|
|
```
|
|
|
|
|
2022-05-23 17:03:59 -04:00
|
|
|
#### QEMU 6.2 or later
|
2021-03-04 11:14:03 +00:00
|
|
|
|
2022-05-23 17:03:59 -04:00
|
|
|
Version 6.2 of QEMU is available in Ubuntu 22.04. On earlier versions of Ubuntu,
|
|
|
|
you can build the recommended version of QEMU as provided by the toolchain by running
|
|
|
|
`Toolchain/BuildQemu.sh`.
|
|
|
|
Note that you might need additional dev packages in order to build QEMU on your machine:
|
2021-03-11 19:03:08 +01:00
|
|
|
|
|
|
|
```console
|
2021-11-17 00:57:51 +01:00
|
|
|
sudo apt install libgtk-3-dev libpixman-1-dev libsdl2-dev libspice-server-dev
|
2020-07-04 11:51:16 +03:00
|
|
|
```
|
|
|
|
|
2022-12-17 15:40:08 -07:00
|
|
|
#### CMake version 3.25.0 or later
|
|
|
|
|
|
|
|
Serenity-specific patches were upstreamed to CMake in major version 3.25. To avoid carrying
|
|
|
|
patches to CMake, the minimum required CMake to build Serenity is set to that version.
|
|
|
|
If more patches are upstreamed to CMake, the minimum will be bumped again once that version releases.
|
|
|
|
|
2022-12-27 13:40:23 -05:00
|
|
|
To accommodate distributions that do not ship bleeding-edge CMake versions, the build scripts will
|
2022-12-17 15:40:08 -07:00
|
|
|
attempt to build CMake from source if the version on your path is older than 3.25.x.
|
|
|
|
|
2021-07-11 22:19:11 +02:00
|
|
|
### Windows
|
|
|
|
|
|
|
|
If you're on Windows you can use WSL2 to build SerenityOS. Please have a look at the [Windows guide](BuildInstructionsWindows.md)
|
|
|
|
for details.
|
|
|
|
|
|
|
|
### Arch Linux / Manjaro
|
2021-03-11 19:03:08 +01:00
|
|
|
|
|
|
|
```console
|
2022-05-20 09:54:46 +02:00
|
|
|
sudo pacman -S --needed base-devel cmake curl mpfr libmpc gmp e2fsprogs ninja qemu-desktop qemu-system-x86 qemu-system-aarch64 ccache rsync unzip
|
2019-12-29 16:23:50 +01:00
|
|
|
```
|
2022-04-04 09:23:22 +02:00
|
|
|
Optional: `fuse2fs` for [building images without root](https://github.com/SerenityOS/serenity/pull/11224).
|
2019-12-29 16:23:50 +01:00
|
|
|
|
2021-07-10 00:53:28 +02:00
|
|
|
### Other systems
|
2021-03-11 19:03:08 +01:00
|
|
|
|
2021-07-10 00:53:28 +02:00
|
|
|
There is also documentation for installing the build prerequisites for some less commonly used systems:
|
2019-12-29 16:23:50 +01:00
|
|
|
|
2021-08-29 16:10:21 +01:00
|
|
|
* [Other Linux distributions and \*NIX systems](BuildInstructionsOther.md)
|
2021-07-10 00:53:28 +02:00
|
|
|
* [macOS](BuildInstructionsMacOS.md)
|
2021-01-13 21:24:46 +01:00
|
|
|
|
2021-03-11 19:03:08 +01:00
|
|
|
## Build
|
|
|
|
|
2021-07-10 00:53:28 +02:00
|
|
|
In order to build SerenityOS you will first need to build the toolchain by running the following command:
|
2021-03-11 19:03:08 +01:00
|
|
|
|
|
|
|
```console
|
2021-07-14 10:34:29 -07:00
|
|
|
Meta/serenity.sh rebuild-toolchain
|
2020-05-06 18:40:06 +03:00
|
|
|
```
|
2020-05-15 09:00:12 +02:00
|
|
|
|
2021-07-10 00:53:28 +02:00
|
|
|
Later on, when you use `git pull` to get the latest changes, there's (usually) no need to rebuild the toolchain.
|
2021-04-10 07:34:11 +00:00
|
|
|
|
2021-07-10 00:53:28 +02:00
|
|
|
Run the following command to build and run SerenityOS:
|
2021-04-10 07:34:11 +00:00
|
|
|
|
|
|
|
```console
|
2021-07-14 10:34:29 -07:00
|
|
|
Meta/serenity.sh run
|
2020-05-06 18:40:06 +03:00
|
|
|
```
|
|
|
|
|
2022-12-16 22:30:00 +01:00
|
|
|
This will compile all of SerenityOS and install the built files into the `Build/x86_64/Root` directory inside your Git
|
2021-07-10 00:53:28 +02:00
|
|
|
repository. It will also build a disk image and start SerenityOS using QEMU.
|
2021-03-11 19:03:08 +01:00
|
|
|
|
2021-07-10 00:53:28 +02:00
|
|
|
Note that the `anon` user is able to become `root` without a password by default, as a development convenience.
|
2020-03-30 11:32:33 +02:00
|
|
|
To prevent this, remove `anon` from the `wheel` group and he will no longer be able to run `/bin/su`.
|
|
|
|
|
2021-10-19 11:56:16 -06:00
|
|
|
By default the `anon` user account's password is: `foo`
|
|
|
|
|
2021-07-10 00:53:28 +02:00
|
|
|
If you want to test whether your code changes compile without running the VM you can use
|
|
|
|
`Meta/serenity.sh build`. The `serenity.sh` script also provides a number of other commands. Run the script without
|
|
|
|
arguments for a list.
|
2021-06-20 15:07:21 +02:00
|
|
|
|
2021-03-11 19:03:08 +01:00
|
|
|
## Ports
|
2021-01-30 20:09:42 +01:00
|
|
|
|
2021-07-10 00:53:28 +02:00
|
|
|
To add a package from the ports collection to Serenity, for example curl, change into the `Ports/curl` directory and
|
|
|
|
run `./package.sh`. The source code for the package will be downloaded and the package will be built. The next time you
|
|
|
|
start Serenity, `curl` will be available.
|
2021-05-15 20:13:31 -06:00
|
|
|
|
2021-07-10 00:53:28 +02:00
|
|
|
## More information
|
2021-01-30 20:09:42 +01:00
|
|
|
|
2021-07-10 00:53:28 +02:00
|
|
|
At this point you should have a fully functioning VM for SerenityOS. The [advanced build instructions guide](AdvancedBuildInstructions.md)
|
|
|
|
has more information for some less commonly used features of the build system.
|