Building (a minimal) Haiku

I haven’t actually got as far as doing a full build of Haiku yet because my Haiku box seems to have given up mid way though building an x86-64 anyboot image, after spending hours building the toolchain.

I used this page as my guide to building Haiku:

I wanted to build Haiku for x64 under Haiku x64 so I ended up referring to this page:

That page says I need to run:

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

and

./configure --cross-tools-source ../buildtools --build-cross-tools x86_64

Running these two commands can easy take well over an hour each on an average (i5 class) laptop or PC. It might be a good idea to give an idea of the expected build/execution times relative to a certain class of CPU for each command on this page.

Is it really necessary to build a cross-compilation toolchain when you are trying to build Haiku x64 under Haiku x64? Are there not packages in the HaikuDepot for providing the OS build toolchain?

That same page only mentions two jam build targets, a nighly anyboot or a raw disk image. I would suspect that both these options build the entirety of Haiku inc. gcc (again!), its kernel, desktop, toolkits and all of the default userland apps. How long does it take an average i5 or i7 class CPU to do a full build of Haiku?

Are there other jam build targets to just build a minimal subset of Haiku for example just enough to run tracker?

Thanks!

This is twice the same command. You only need one. You have to decide if you want the generated files in the “generated” directory you create yourself (as in the first command) or for the configure script to create a directory named “generated” by itself (second command). Doing both just does all the work twice for no reason.

Yes, the compiler used for building a complete Haiku needs to be able to build a few pieces of code in 32 bit mode (for the bootloader), and the one provided in Haiku packages is not able to do that.

No, gcc is built only once during the configure step.

There is a “minimal” image but you will find a lot of things are missing there. No translators, most drivers are not built, etc. It is pretty limiting to use. The “nightly” image is a reasonable one to use (it includes less things than the “release” image we use for our beta versions already).

The full build only takes a few minutes anyway on modern hardware (it is shorter than the configure step which builds gcc). Also, after you’ve built everything once, the subsequent builds will rebuild only what’s needed, again saving a lot of time.

1 Like

Technically it can, but it does not have any 32-bit runtime libraries (libgcc, etc.) built specifically for the bootloader, which are only built as part of the cross-tools setup.

I’ve tried again but this time under Debian. I was surprised my laptop can build the nightly image in under 10 minutes after building the toolchain. That’s much faster than I was expecting and another reason to prefer Haiku over Linux. I’m sure it’d take my laptop much longer than 10 minutes to build just the Linux kernel and some of its modules.

3 Likes

Bumping up this topic for more questions about jam, only because I’m short on disk space:

  1. once I run jam to build the needed tools into a given directory, how can I ask jam the different targets it can compile?

or

  1. is there a target for jam telling it NOT to build the image? (I just need the binaries to be built)

minimal?
is it necessary?
i guess the current iso is so minimal.
so, is you mean to install into some special thin computer?
if using for normal computer, i guess we can add application or adjust setting into the current iso.
this is a quick way.

There are thousands of targets, I don’t think there is a way to list them, and the list would be so long it wouldn’t be very helpful anyways. You want to build just WebPositive? The target is WebPositive. You need the Appearance preferences? The target is Appearance. You need the Haku package? The target is haiku.hpkg.

I don’t think there is a target for “all the executables”. But building just haiku.hpkg may be good enough?

I’m trying to make progress on Checkfs output topic and get a binary for bfswhich, so I cloned the haiku repository and made a few attempts.
BUT I can’t just run ‘make’ or ‘jam’ into src/bin/bfs_tools/ as jam complains about missing ‘BuildConfig’ into …/…/…/generated/build
OTOH the usual haiku build using ‘jam @nightly-raw’ cannot complete due to disk full error, although should this end successful (in a 32 bit install inside a VM it’s ok), the needed BuildConfig file would appear into the proper dir (and let me build the BFS tools just calling ‘jam’).

You need bfswhich? Go in your generated directory and run “jam bfswhich”. It will build the needed dependencies, and then the executable.

The BuildConfig file is in the “generated” directory, and running jam from inside the source directory is not recommended anymore.

It worked like a charm! (and in a few seconds)
Thank you @PulkoMandy :+1: