Strict Standards: Redefining already defined constructor for class wpdb in /www/htdocs/w006f36b/wp-includes/wp-db.php on line 49

Deprecated: Assigning the return value of new by reference is deprecated in /www/htdocs/w006f36b/wp-includes/cache.php on line 35

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /www/htdocs/w006f36b/wp-includes/cache.php on line 400

Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl($output) in /www/htdocs/w006f36b/wp-includes/classes.php on line 534

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl($output) in /www/htdocs/w006f36b/wp-includes/classes.php on line 534

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el($output) in /www/htdocs/w006f36b/wp-includes/classes.php on line 534

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el($output) in /www/htdocs/w006f36b/wp-includes/classes.php on line 534

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el($output) in /www/htdocs/w006f36b/wp-includes/classes.php on line 553

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl($output) in /www/htdocs/w006f36b/wp-includes/classes.php on line 649

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl($output) in /www/htdocs/w006f36b/wp-includes/classes.php on line 649

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el($output) in /www/htdocs/w006f36b/wp-includes/classes.php on line 649

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el($output) in /www/htdocs/w006f36b/wp-includes/classes.php on line 649

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el($output) in /www/htdocs/w006f36b/wp-includes/classes.php on line 674

Deprecated: Assigning the return value of new by reference is deprecated in /www/htdocs/w006f36b/wp-includes/query.php on line 15

Deprecated: Assigning the return value of new by reference is deprecated in /www/htdocs/w006f36b/wp-includes/theme.php on line 505
MauriceK, caught between dev and drums » 2008 »

July 24, 2008

Building Haiku on Windows, Step by Step

Category: Development, Haiku — kaldor @ 12:23 am

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /www/htdocs/w006f36b/wp-includes/formatting.php on line 76

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /www/htdocs/w006f36b/wp-includes/formatting.php on line 83

Uhm… this topic sounds familiar, right? But wait, Windows? Yup, so far it was only possible to build Haiku from R5, Linux, FreeBSD, MacOS and sometimes (though these times seem to increase lately) Haiku itself. Karsten and I put some effort in the buildsystem and some other parts of the repository to get Haiku compiling from a Cygwin environment on Windows.

First some notes of what you need to take care about, before you start:

  • You need lots of packages from the Cygwin installer to have Haiku successfully build. Unfortunately I was too lazy and installed a complete package. Thus I suggest you to do the same.
  • On Windows Vista be sure to have the command prompt open as Administrator. Otherwise many operations will fail, you cannot even call ‘ping’ without needing admin rights.
  • Be sure to not have any special characters in your PATH environment like ‘(’ or such. Also spaces inside the path names are invalid on cygwin. Change your environment accordingly.
  • This will only create images for you, you cannot use it to create/update real partitions on your hard-drive.

Ok, after you have taken care of all above points, let us start.

1. Before you are able to checkout the source code, you will need a managed drive. Read here for further details, basically it is to have a case sensitive filesystem on Cygwin. Otherwise the compiler will horribly fail eg. Including string.h and String.h.

mkdir /managed-dir
mount -o managed c:/cygwin/managed-dir /managed-dir
cd /managed-dir/

2. Create the Haiku development directories and get the Haiku built tools source:

mkdir develop
cd develop
mkdir haiku
cd haiku
svn checkout svn://svn.berlios.de/haiku/buildtools/trunk buildtools

3. We will need to patch fileunix.c of jam inside the buildtools directory:

cd buildtools/jam

Index: fileunix.c
===================================================================
--- fileunix.c  (revision 26383)
+++ fileunix.c  (working copy)
@@ -57,6 +57,7 @@
 # include 
 # define STRUCT_DIRENT struct dirent
 # endif
+#include < unistd.h >

 # ifdef OS_COHERENT
 # include 

Note: Some might have seen that the jam Makefile/Jambase have a Cygwin option. Do not use these! The problem is that jam passes -D__cygwin__ to each target. This will break latest, when some 3rd party libraries are supposed to be build, which actually have Cygwin checks included.

4. Now build jam

make
./jam0 install
cd ../..

5. Get the Haiku source (this will take a while): For anonymous check-out:

svn checkout http://svn.berlios.de/svnroot/repos/haiku/haiku/trunk trunk

For an existing Haiku developer:

svn checkout https://developername@svn.berlios.de/svnroot/repos/haiku/haiku/trunk trunk

If there are any errors when checking out above, just cd into the trunk directory and type “svn up” to get any missed files. This also applies when updating the code in the future.

6. Build the cross compiler tool (GCC 4.x):

cd /managed-dir/develop/haiku/trunk
./configure  --build-cross-tools-gcc4 x86 ../buildtools/

Note: This only works with the GCC4 compiler. The GCC2 cross-compiler is generated in a wrong way and the build is broken for this version. Hybrid systems are untested so far.

7. Build the Haiku image:

jam haiku-image

To build for testing in VMWare:

jam haiku-vmware-image

As you can see, most of the steps are identical to the Ubuntu tutorial. The changes needed were more or less minimal, mostly related to minor things not working properly for the host tools. Finally, I’d like to mention that building Haiku takes much longer compared to Linux. My guess is that this is related to gcc being slower and also forking processes takes much longer on the Windows platform. But this is just a personal impression. By the way, you can also use multiple jobs to create the image with the -jx option, where x describes the amount of parallel jobs to run.

Update 1: Changed environment suggestions. You must not have spaces or special characters in your PATH variable

Update 2: Updated note that gcc2 is not supported.