Cross-building from within Haiku

Cross-building Genode and haiku-on-genode from within Haiku (instead of from Linux) requires some extra work. You'll need to build the GCC-based toolchain yourself (Toolchain:Haiku_GCC), and address a few pre-requisites as follows, before heading back to the Main build instructions. Most of the below is one-time setup rather than repetitive.

Packages to install:

pkgman up isl-0.20-1-x86_64.hpkg  # this will install isl 19 (!) (otherwise genode-gcc can't compile code)
		# can't use isl-0.21 which comes with Haiku R1/b3, unless your toolchain was linked against that
pkgman up tcl  # for basic operation, right from the start i.e. linking ld-nova
pkgman up expect  # to launch "run" files
pkgman up gnupg   # to validate downloads with tool/depot/download
pkgman up xorriso # to create ISO images
pkgman up qemu    # to run/emulate ISO images (automatically installs qemu_x86 too)

Package to build:

Running "./tool/ports/prepare_port libc" requires a tool called rpcgen, which is completely absent from Haiku or its optional packages. So download its sources from e.g. and compile it.

Edit tool/run/run to dodge a Haiku bug, i.e. /bin/expect errors out with "The system has no more ptys":

Rem out the whole block with "set pid ...eval "spawn make $targets"..."... which is in charge of invoking gmake. You can instead invoke gmake with "make so-and-so" yourself, copy-pasting it from the tracing that is output into the terminal where you invoke the run file.

Add this rootfs symlinking to e.g. UserBootScript to make it available to all Haiku terminals:

(mkdir -p /usr/bin/ && cd /usr/bin/ && ln -s /bin/cpp && ln -s /bin/expect && ln -s /bin/make && ln -s /bin/tclsh  && mkdir -p /usr/local/genode/tool/21.05/ && cd /usr/local/genode/tool/21.05/ && ln -s /path/to/genode-gcc/bin )
	# that makes the "genode-gcc" folder available through linux-like /usr/bin path
	# "cpp" is required by "rpcgen" for making libc
	# "expect/make/tclsh" are needed by Genode's build system

Make sure to adapt the "genode-gcc/bin" path.

Yours truly has been using those tricks successfully for Haiku-host development of h-o-g ever since the Genode 18.05 days.