Haiku Development from Linux
Introduction
Development directly on Haiku is very workable but some people prefer the use of another environment such as Linux to work in because familiar IDEs or other tooling may not be available on Haiku yet.
In this article I look at a possible setup for developing Haiku on Linux using VirtualBox as a means of running Haiku with the source synchronized from the Linux host to the Haiku virtual machine.
These instructions were written for VirtualBox 7 with Debian Bookworm 12.
Note that this article describes a means of allowing network communication between a Linux host and a Haiku virtual machine. You are advised to take your own precautions to ensure that the network setup in your scenario is implemented correctly and securely.
Network Setup
The first step is to configure a host-only network for your Linux host to communicate with the Haiku virtual machine.
You can find these options by clicking the button at A. Create a new host-only network using the button at B. The new network might have the following manual settings;
Tab | Setting | Value |
---|---|---|
Adapter | IPv4 Address | 192.168.66.1 |
Adapter | IPv4 Network Mask | 255.255.255.0 |
Adapter | IPv6 Address | |
Adapter | IPv6 Prefix Length | 0 |
DHCP Server | Enable Server | NO |
Note that the new network is called vboxnet0
.
Setup Haiku Virtual Machine
Follow the instructions here for standing up a new Haiku virtual machine in VirtualBox. An x86_64 architecture host is assumed.
Add an additional network adaptor to the virtual machine. The additional adaptor should have the follow settings;
Setting | Value |
---|---|
Enable Network Adapter | YES |
Attached To | Internal Network |
Name | vboxnet0 |
Adapter Type | Intel PRO/1000 T Server (82543GC) |
Promiscuous Mode | Deny |
Cable Connected | YES |
On the Haiku machine, run the following command to install additional packages;
pkgman install curl rsync
Configure the Networks and Perform Check
On the Linux host side, configure the network by issuing the following command into a shell;
sudo ip addr add 192.168.66.10/24 dev vboxnet0
On the Haiku virtual machine, configure the network by issuing the following command into a shell;
ifconfig /dev/net/ipro1000/0 192.168.66.20 24
You will need to run these commands each time the corresponding environment is restarted.
On the Linux host side, in a shell, run a temporary web server on the internal network to check the connection;
mkdir -p /tmp/test
echo "Working" > /tmp/test/index.txt
python3 -m http.server 8000 --bind 192.168.66.10 -d /tmp/test
On the Haiku side, in a shell, run a request to the web server on the Linux host system to check that it is possible to communicate from the Haiku virtual machine back to the Linux host system.
curl "http://192.168.66.10:8000/index.txt"
This will display Working
in the console.
Once you have confirmed the networking is functional, stop the temporary web server.
Setup an SSH Server on Linux
You will need an SSH server running on the Linux host for the source synchronization technique to work. Note that security and network configuration of an SSH service are out of scope for this article. You are advised to ensure a secure implementation for your particular scenario.
Setup Source & Build in Linux
Follow the instructions here to setup the source from the public git repositories on your Linux host. Perform an x86_64 cross-build on the Linux host.
Setup Source Transfer on Haiku
As an example, the Haiku source and the build tools source might be available at the following paths on the Linux host;
/x/y/z/haiku
/x/y/z/buildtools
It is suggested to create a new virtual disk on the Haiku virtual machine to contain the resources to build Haiku. In this example, the disk would be mounted at /build
.
cd /build
rsync --checksum \
--exclude "__pycache__" --exclude ".git" --exclude ".idea" --exclude ".DS_Store"
-r someuser@192.168.66.10:/x/y/z/haiku .
rsync --checksum \
--exclude "__pycache__" --exclude ".git" --exclude ".idea" --exclude ".DS_Store"
-r someuser@192.168.66.10:/x/y/z/buildtools .
This synchronization will take some time to complete and when it has completed, the source for the buildtools and the Haiku source will be synchronized onto your Haiku virtual machine.
Now follow the same instructions here to setup and compile Haiku but use the source that has been synchronized from the Linux host instead of obtaining it from the public git repositories.
When you subsequently make changes in the source code on the Linux host, you can re-run the commands above to synchronize the source to the Haiku virtual machine again. Because you will do this frequently, it would be convenient to assemble these commands into a script file.
Partial Synchronization
Synchronizing the source for Haiku and the build-tools will take some time because there are a large number of files. When you are working on Haiku, it is often the case that you are working on a specific area such as a single application; because of this, a performance enhancement would be to only synchronize the source for that specific Haiku component and not the whole of Haiku.
Workflow
The typical development cycle would be to edit the source on the Linux host, check the cross-build on Linux and then sync the source to the Haiku virtual machine, re cross-build on Haiku and then run / test on Haiku.