[haiku-development] How to build Haiku under Windows Subsystem for Linux (WSL)

  • From: Olivier Coursière <olivier.coursiere@xxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Fri, 11 Nov 2016 22:27:24 +0100

Hi,

As reported by PulkoMandy in his BeGeistert 030 report (https://www.haiku-os.org/node/11134), you may know that i have tried to compile Haiku under the Windows Subsystem for Linux.

While this is probably useless to most of you (especially performance-wise in the I/O area, see http://www.phoronix.com/scan.php?page=article&item=windows-10-lxcore&num=6), this can lower the barrier for some people to build Haiku and start hacking.

Here is my HowTo !

It is a work in progress and the patch is currently a quick and dirty one, just to get things done.

While i tried to note everything i have done to get it build, i might have forgotten some steps. It would be nice if someone can reproduce my results (maybe as a GCI task ?).

How to build Haiku under Windows Subsystem for Linux

Requirement

 * a Windows 10 machine with the Windows Subsystem for Linux (WSL)
   installed
     o see https://msdn.microsoft.com/fr-fr/commandline/wsl/install_guide
 * this WSL must support case sensitive on Windows drive
     o https://github.com/Microsoft/BashOnWindows/issues/101
 * lots of time... (but you can do something else during the build)

Remarks : I am not sure if the WSL beta in the anniversary edition has the fix for case sensitive support as i am using the fast ring of the insider preview which was required when WSL was announced, six months ago (i am currently at build 14955).

Installing required dependencies in the WSL environment

Some required tools and libraries are not installed by default. The usual "sudo apt-get install <tool>" should do the dirty work

 * git and others tools in the required software in
   https://github.com/haiku/haiku/blob/master/ReadMe.Compiling.md ;(was
   not in my notes. Maybe some were already there as WSL is supposed to
   be a developer feature)
 * g++
 * libcurl4-gnutls-dev
 * mkisofs
 * <maybe some more tools/libraries missing here that i have forgotten>

Getting the source

No special requirements here : look at https://github.com/haiku/haiku/blob/master/ReadMe.Compiling.md

My current patch is here : http://www.nan.tf/download/WSL_QuickFixes.diff

Content of the patch :

     * an alternative AddFileDataResource rule : one tool
       (makebootable) use a three part resourceID separated by ":". A
       temporary file is generated with this name. This new rule accept
       three parameter for the resourceID and then generate a temporary
       file without ":" that are not supported on a Windows file
       system. This rule is used in the two makebootable jam files.
     * escape/deescape of ':' in filenames in the fs_attr_generic.cpp
       layer (for the same reason).
     * replacement of the original implementation of normalize_dir_path
       by a realpath call. I am not sure at all it fully replace the
       original intended behavior (comments are welcome in this area).
       But it avoid a huge number of file system calls in the mimeset
       tool (and maybe some others). This has a great impact on
       performance in WSL as I/O on a Windows file system are quite
       slow from the Linux environment.

Build instructions

Remarks : As WSL is supposed to be an Ubuntu environment, instructions for Linux are a good start. The only thing is to avoid to use --use-xattr-ref in the configure command. The reason is that there is no full attributes support on Windows file system (but you can vote to request it here : https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/15217680-bash-on-ubuntu-on-windows-must-support-extended-at).

As pointed out by PulkoMandy at BeGeistert, specifying nothing in the configure command activate a generic layer that use files as a fallback to store attributes. So, here is the command line i have used.

../configure --build-cross-tools x86_gcc2 ../../buildtools/ --build-cross-tools x86

then

jam -q @anyboot-image

Olivier




Other related posts:

  • » [haiku-development] How to build Haiku under Windows Subsystem for Linux (WSL) - Olivier Coursière