Compiling Haiku for x86

gcc2h / gcc13 hybrid builds

Haiku can be build as a hybrid image meaning that it contains gcc2 as well as gcc13 binaries. More information on this can be found on the gcc-hybrid page.

This configuration is the default and is required to run both BeOS legacy applications as well as modern one using the recent programming language features available in newer gcc versions.

Please ensure that you have obtained a copy of Haiku's source code as described in Get the Haiku Source Code if you have not already done so.

Building Haiku from Haiku

When building from Haiku, all the required tools are already installed in the release image, therefore you can run configure without any arguments:

(Note: Currently as of Aug-14-2021 the package “xorriso” must be installed from HaikuDepot before compiling the anyboot image.)

./configure

x86 Compiler Toolset for non-Haiku systems

When building from another operating system (Linux, for example), you need to compile the buildtools as well during the configure stage.

Building the x86 compiler toolset is quite easy and involves generating gcc binaries for your platform. For a complete list of flags for the configure script, see Haiku's Configure Options

From the Haiku source directory, run the following to compile the build tools (be sure to adjust the options to match your build environment):

Working in a clean build directory:

mkdir generated.x86; cd generated.x86
../configure --cross-tools-source ../../buildtools --build-cross-tools x86_gcc2 --build-cross-tools x86

Working in the top level:

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

Compiling raw nightly disk images

This is the default nightly image build target. This contains a complete system with an included compiler. Be sure to modify -j2 with the number of cpu cores on your build system to ensure the fastest build times.

jam -q -j2 @nightly-raw

Compiling anyboot nightly disk images

You can also choose to build an anyboot image (*.img) instead, which is generally more useful for virtualization software.

jam -q -j2 @nightly-anyboot