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://firstname.lastname@example.org/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:
To build for testing in VMWare:
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.