Haiku Hybrids

What is a Haiku Hybrid?

Haiku hybrid images are Haiku releases which can compile and execute programs built for incompatible ABIs. This may mean different architectures like x86-64 and x86, or different, incompatible compilers like gcc2.95 and gcc8.x for x86. Currently only the latter case is supported. gcc2.95 gives Haiku binary compatibility with native legacy applications written for the BeOS.

In a Haiku Hybrid, there is the primary GCC or architecture and the secondary GCC or architecture. The primary GCC is the version that was used to compile Haiku. The secondary GCC provides both a runtime time environment and a cross-compiler for using and creating other-GCC objects.

The architecture name used in the build system and in Haiku for x86 gcc2 is "x86_gcc2" and for x86 gcc8 "x86". In a Haiku Hybrid one can find subdirectories named like the secondary architecture in */lib/, */bin/, and other directories. They contain files specific to the secondary architecture portion of the Hybrid.

Since x86 is the only platform for which BeOS R5 binary compatibility is possible, no other target platforms need to be built with gcc2. Thus, until x86-64 Haiku has grown 32 bit support, x86 is the only platform that a Haiku Hybrid is usable.

Which GCC should I use?

In short, a gcc2 Hybrid. For R1 and earlier releases, gcc2 Hybrid is the official release style. As such you can expect the least amount of issues on it. Later we will likely switch to gcc8 Hybrids and eventually phase out the gcc2 part completely.

Why not gcc8?

For R1 and earlier releases, only the gcc2 ABI can be considered stable and future proof. Once R1 is released, binaries built with gcc8 will need to be recompiled (and more than likely have their sources updated for new API).

How are GCC Hybrids built?

Hybrids are built pretty much the same way as non-Hybrids. The only difference is that when configuring the build the secondary architecture respectively the secondary compiler needs to be specified.

Setting up directories

Your working directory (also called a folder) may look like this:

  sourcecode/haiku/buildtools/
  sourcecode/haiku/haiku/
  sourcecode/haiku/haiku/generated.x86gcc2

You have created sourcecode/haiku/ and from there cloned the Haiku repo (which created the haiku subfolder). If you're not building under Haiku, you also cloned the Buildtools repo (which created the buildtools subfolder). Now create the folder sourcecode/haiku/haiku/generated.x86gcc2.

Configuring the directories

Be sure to consult the various configure options, such as `--use-gcc-pipe`, `--use-xattr-ref`, and `-j`

...within Haiku

  cd generated.x86gcc2
  ../configure --target-arch x86_gcc2 --target-arch x86

...from another OS

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

Jamming inside one of the generated folders

Be sure to consult the various jam options.

In order to build a raw Haiku image, run the following:

  cd generated.x86gcc2
  jam -q @nightly-raw

Alternatively, you may be interested in building an anyboot image instead:

  cd generated.x86gcc2
  jam -q @nightly-anyboot

If you have set up multiple generated.* directories, the builds won't affect each other. In each generated.* directory you can only build the exact Haiku configuration it has been configured for.