Serenity: build on Windows Subsystem for Linux

Created on 19 May 2020  ·  20Comments  ·  Source: SerenityOS/serenity

hi,
have somebody achieved successful build of Serenity on Windows?

I have tried to do it with WSL but failed due old CMake:

make[1]: Leaving directory '/mnt/c/severak/serenity/Toolchain/Build/gcc/i686-pc-serenity/libgcc'
XXX serenity libc and libm
/mnt/c/severak/serenity/Build /mnt/c/severak/serenity/Toolchain/Build/gcc /mnt/c/severak/serenity/Toolchain/Build /mnt/c/severak/serenity/Toolchain
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
  CMake 3.16 or higher is required.  You are running version 3.10.2


-- Configuring incomplete, errors occurred!

(this is result of running Toolchain/BuildIt.sh)

Most helpful comment

Filesystem issues. There is a dedicated page describing the procedure of building serenity on WSL.
https://github.com/SerenityOS/serenity/blob/master/Documentation/NotesOnWSL.md

All 20 comments

Update cmake. As the error suggests, you are running version 3.10.2 and the minimum requirement for building serenity is version 3.16.

Update cmake.

how to do it? I tried sudo apt-get upgrade cmake but I got the same version. 👎

Follow the guidelines here: https://askubuntu.com/a/829311

followed this guideline and it worked - https://askubuntu.com/a/1205458

stuck on this:

severak@DESKTOP-M8L892L:/mnt/c/severak/serenity/Build$ make
[  0%] Building CXX object Meta/Lagom/CMakeFiles/LagomCore.dir/__/__/AK/Base64.cpp.o
c++: error: unrecognized command line option ‘-std=c++2a’; did you mean ‘-std=c++03’?
Meta/Lagom/CMakeFiles/LagomCore.dir/build.make:82: recipe for target 'Meta/Lagom/CMakeFiles/LagomCore.dir/__/__/AK/Base64.cpp.o' failed
make[2]: *** [Meta/Lagom/CMakeFiles/LagomCore.dir/__/__/AK/Base64.cpp.o] Error 1
CMakeFiles/Makefile2:2375: recipe for target 'Meta/Lagom/CMakeFiles/LagomCore.dir/all' failed
make[1]: *** [Meta/Lagom/CMakeFiles/LagomCore.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

as it seems that build instructions is somewhat out of date (see #2225 and #2226 ), I will wait till somebody else tries this on Windows.

It looks like GCC doesn't recognize c++2a, which means you need to update GCC too. It'a good idea to update binutils and gcc to their latest versions before trying to build the os. If you are running Ubuntu 18.04, you will need to add a different repository to get latest updates. Further information can be found here: https://askubuntu.com/questions/1140183/install-gcc-9-on-ubuntu-18-04

Perhaps you can try building it in Docker? It works great for me (IIRC WSL has docker?)
I'm actually writing a Dockerfile now (setting up Serenity on another PC, so I'll just record whatever I do for others to use as well)

@Jongy only WSL 2.0 supports docker, which is in beta right now, so no

@8infy You cannot build serenity on WSL 1 anyway.

@8infy You cannot build serenity on WSL 1 anyway.

Why is that?

Filesystem issues. There is a dedicated page describing the procedure of building serenity on WSL.
https://github.com/SerenityOS/serenity/blob/master/Documentation/NotesOnWSL.md

That link says:

WSL Version 1 is not supported since Version 1 does not support ext2, which is needed for the setup.

I'll take "does not support ext2" as "doesn't have the kernel driver for ext2", which was tackled in https://github.com/SerenityOS/serenity/pull/2138 - the image building scripts will "downgrade" to genext2fs instead of direct mounting, if the latter fails. genext2fs should work anywhere.

I can confirm building/running Serenity on WSL 2 works without a hitch 👍

I have a problem, I can build the OS/image but then I can"t start the qemu. I am running vcxsrv.

~It is probably some network thing but I can't figure it out.~
Never mind, fixed it by removing the not working rule from run.sh

theazgra@DellG5:~/serenity/Build$ make run
qemu-system-i386: -netdev user,id=breh,hostfwd=tcp:127.0.0.1:8888-10.0.2.15:8888,hostfwd=tcp:127.0.0.1:8823-10.0.2.15:23,hostfwd=tcp:127.0.0.1:8000-10.0.2.15:8000,hostfwd=tcp:127.0.0.1:2222-10.0.2.15:22: Could not set up host forwarding rule 'tcp:127.0.0.1:2222-10.0.2.15:22'
CMakeFiles/run.dir/build.make:57: recipe for target 'CMakeFiles/run' failed
make[3]: *** [CMakeFiles/run] Error 1
CMakeFiles/Makefile2:2306: recipe for target 'CMakeFiles/run.dir/all' failed
make[2]: *** [CMakeFiles/run.dir/all] Error 2
CMakeFiles/Makefile2:2313: recipe for target 'CMakeFiles/run.dir/rule' failed
make[1]: *** [CMakeFiles/run.dir/rule] Error 2
Makefile:175: recipe for target 'run' failed
make: *** [run] Error 2

(as I currently have WSL1 on my work computer and I am not going to update it (and broke configuration), I will currently not trying to compile Serenity here)

Hello severak!
Your unwillingness to update WSL is understandable. As an alternative to that, I suggest you to install a Linux distribution (preferably a debian derivative) on VirtualBox and try to build Serenity there. In my personal experience, building Serenity on VirtualBox has always been faster (and less irritating) than doing it on WSL.

( A friend compiled Serenity for me. Now I have Serenity build to test and it's awesome already! )

Consider closing this issue then :)

(built without a single issue on WSL2 with everything current as of July 25 2020)

Hi,

I've tried to build and run on Ubuntu 20.04 on WSL2 according to the docs. I've setup Vcxsrv with Display number to 0, and Disable access control. Compile and building the image worked, but I can't get it running. I can't make much sense of the message. Any hints for how to resolve this?

~/.../serenity/Build (master)$ ls
AK/            Demos/     Kernel/       Meta/      Shell/          CTestTestfile.cmake  cmake_install.cmake
Applications/  DevTools/  Libraries/    Root/      Userland/       Makefile             install_manifest.txt
CMakeFiles/    Games/     MenuApplets/  Services/  CMakeCache.txt  _disk_image
~/.../serenity/Build (master)$ export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
~/.../serenity/Build (master)$ echo $DISPLAY
172.23.224.1:0
~/.../serenity/Build (master)$ make run
Unable to init server: Could not connect: Connection refused
qemu-system-i386: multiboot knows VBE. we don't
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5181:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize DAC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5181:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize DAC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
audio: Failed to create voice `pcspk'
pcspk: Could not open voice
gtk initialization failed
make[3]: *** [CMakeFiles/run.dir/build.make:57: CMakeFiles/run] Error 1
make[2]: *** [CMakeFiles/Makefile2:2751: CMakeFiles/run.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:2758: CMakeFiles/run.dir/rule] Error 2
make: *** [Makefile:240: run] Error 2

Update: I got it working by configuring another ip address. The WSL readme says

export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0

which seems to be the ip address that shows in the interface

Ethernet-Adapter vEthernet (WSL):

But if I use the one from the interface

Ethernet-Adapter Ethernet:

I can run gui programs in wsl (tested Firefox), and also make run works now.

I must admit I don't understand why that is.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nibblebits picture nibblebits  ·  4Comments

Quaker762 picture Quaker762  ·  6Comments

nvella picture nvella  ·  6Comments

bgianfo picture bgianfo  ·  6Comments

MWGuy picture MWGuy  ·  4Comments