Setup:Main:Haiku

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, like creating symlinks from /usr/local/genode to the physical location of the built toolchain. Once ready, head 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. https://cgit.freebsd.org/src/tree/usr.bin/rpcgen and compile it.

Optional: edit tool/run/run to dodge a Haiku bug:

If you intend to use Genode's "run" scripts (like "make run/demo"), be aware that Haiku errors out with "The system has no more ptys".

My (half-baked) workaround is to edit the tool/run/run file, and comment 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.

Main setup: compiler path and tool paths:

The main thing to do on Haiku is to make the toolchain etc "appear" to be in their standard locations (/usr/bin/ and /usr/local/genode/tool/), so that they can be invoked by the Genode makefiles and the h-o-g Jamfiles. Therefore, add this rootfs (virtual fs) symlinking one-liner 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/ && cd /usr/local/genode/ && ln -s /path/to/physical/genode/tool )
	# the last part makes the "genode/tool/21.05" (and maybe 19.05) toolchain folder(s) available through linux-like /usr/local... path as required by the h-o-g and Genode build systems
	# "cpp" is required by "rpcgen" for making Genode's libc
	# "expect", "make", "tclsh" are needed by Genode's build system

Make sure to adapt the physical "genode/tool/" path.

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