What’s that you say? You made a New Year’s resolution but
haven’t kept it? You vowed to sharpen your programming skills, write a cool
application, AND use cutting edge operating system technology? Look no further,
you have come to the right place. This article will get you started writing applications for
Haiku, the open source version of the advanced BeOS operating system.
cool is Haiku? Here’s a short list of cutting edge features that set it apart
from the rest of the pack:
- Object oriented micro-kernel operating system? Check.
- Advanced 64-bit, database-like, journaling filesystem? Check.
- Everything completely multi-threaded? Check.
- Elegant messaging system? Check.
- The cleanest programming API in the neighborhood?Check.
- POSIX compliant? Check.
- Plenty of coding samples. Check.
The last commercial release of BeOS was in 2001, and at that
time it was light years ahead of its peers: Windows 2000, Mac OS 9, or Linux
kernel V2.3. In many respects Haiku has features that are still years ahead
these OS’s. This article will lay out all the steps you need to get started writing applications in Haiku, and exploring it from a developer’s perspective. The intent here is to bring together information from
a variety of sources, and streamline your path to coding new apps in Haiku.
Install the Haiku Alpha Release
In October of 2009 the long awaited Alpha version of Haiku
was released. I’ve been using it for several weeks and I’m happy to say that it
is both reasonably stable and well maintained. Your first step to coding for
Haiku is to install it. Installations are available for CD ISO, VMWare,
and RAW for USB. Haiku is also compatible with QEMU and
Microsoft’s Virtual PC. Installation instructions are documented here. Haiku
runs nicely on older hardware. If you have an older PC or laptop that’s not up
for Vista or Win7, try installing Haiku. A
partial hardware compatibility list is here.
Download the Arora Web Browser
Before updating the Alpha R1 release to a nightly build
version, download and install the Arora web browser
from here.Installing the nightly build may or may not
cause issues with the standard Firefox/BeZilla
browser, which is under development. Arora is your
backup browser if there are issues. Download it to your desktop. Click on the
icon. The Installer will prompt you for the destination folder. Type in /boot,
then select Expand. Arora will be installed in
Update to a Recent Nightly Build
After you install the Alpha and verify that it runs on your
system, you may want to update to a recent nightly build. On the one hand, a
nightly build will get you the incremental fixes and patches made since the
Alpha release. Improvements are listed here.
On the other hand, nightly builds are not regression tested and are the very
definition of ‘a work in progress’. Just be aware that a nightly build could
have issues. The nightly builds can be
downloaded from here. To install, download
and copy the image to your CD or USB drive, boot from it, and run the installation.
Install it over your Alpha R1 installation. Any package installations or
setting changes you made to the Alpha installation will be preserved.
Check the Bug Log
Haiku development is ongoing and changes are made nightly. You
should check the bug log for issues that
might affect your development. This is where you can submit a bug ticket should
you encounter an issue. Create a login on the site,
and be sure to respond to the verification email when it comes. You will not be
able to submit a bug ticket until you respond to the verification email.
Haiku has a Command Line
Once you update to the nightly build you can start getting
acquainted with the Haiku operating system. Anyone with Linux/UNIX command line
experience will be comfortable getting started with Haiku command line tools.
Bring up a Terminal session from the Deskbar (upper
right corner with the Haiku feather logo) and you can use many familiar tools: cd, ls, ps,
top, vi, which, find, bash, awk,
The env command will list your
paths. BEINCLUDES, LIBRARY, BELIBRARIES, and PATH will be useful to know.
Getting Files Onto Your Dev System
The current Haiku distribution is slimmed down and contains
just the system essentials and basic development tools. You will want to be
able to copy files on to and off of your Haiku dev system. The Haikuware.com site has hundreds of
applications, games, and utilities to download. You can use Firefox or Arora to download source and libs
from other Haiku repositories. FTP is also available. Support for USB zip drives was a little shaky
at the time this article was being written. The issue may be resolved by the
time you read this. If not you can burn files onto a CD and copy them from the
CD to your Haiku system. Rsync is available as an external package.Samba is under development for a future
Old Skool Dev Tools
The usual coding tools are available for Haiku development
including: bash, GCC, BASIC,
Perl, Python, Eiffel,
OCaml, and even a version of SmallTalk. GCC, Perl, Python, and Vi
are installed on the Alpha release by default.
EMACS is in development.
Let’s download and compile a sample application. Literally
dozens of great sample applications can be downloaded from here.
Once you have downloaded sample-code.zip to your desktop you can unzip it to
your local folder. From the Terminal command line, type: unzip ~/Desktop/sample-code.zip. Then cd to sample-code/intro/HelloWorld. Type make to
build the example. Then type obj.x86/HelloWorld to run it. The HelloWorld window will display. Congratulations, you just
did your first compile/link/run cycle! Sure, it’s not fancy but it is an easy
starter. The other code samples provide great starting points for multimedia
projects, games, screen savers, openGL, networking,
even device drivers. You’ve already downloaded them, why not take a look? Use
to browse the folders and files. Right click on your Haiku filesystem
icon in the upper left corner, the file folders will automatically expand.
A lot of development for classic BeOS was done using BeIDE, a customized version of Metrowerks Codewarrior. You will see it mentioned in a lot of the BeOS
documentation. BeIDE is still available for download on
various mirrors but is no longer supported. Popular, supported IDEs for Haiku
SiSong, and Pe. Pe is very popular
with Haiku veterans and can be installed by typing at the command line: installoptionalpackage -a Pe . For a list of all
optional packages you can install, type: installoptionalpackage
-l. There is good stuff to be had.
Haiku is available in both GCC2 and GCC4 versions, called
hybrids. A GCC hybrid, has a main GCC and an
alternative GCC. The main GCC is the version that was used to compile Haiku.
The alternative GCC provides both a runtime time environment and a
cross-compiler for using and creating other-GCC objects.
The GCC2 hybrid is the OS compiled with gcc2, with
additional gcc4 libraries.
The GCC4 hybrid is the OS compiled with gcc4, with
additional gcc2 libraries.
“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, x86 is the only platform that a GCC Hybrid is usable.” For more details see this note.
Check Out the Libraries
Any serious development project
needs libraries. Haiku has lots of them available here. Some libraries are
still in development so be sure to check the bug
log for any issues that might affect your project. To install a library,
download it to your desktop, click on the library to launch the Installer, and
type /boot as your destination. Then select Expand.
Jam on Your Haiku?
Jam is very popular with the developers of Haiku and you
will see it mentioned in Haiku documentation. It is a program construction tool
like make. For more information look here: Jam man page, A little more Jam.
Porting Old BeOS Projects
Thinking about porting an old
BeOS project to Haiku? This question has come up before.
I want to port my BeOS
application/driver to Haiku. What do I need to do?
“Since Haiku R1 is mostly BeOS R5 binary and
source compatible, in most cases you don’t have to do anything. At the
application level API, there are only a few incompatibilities. There’s also a
new driver interface, but BeOS R5 drivers are still supported (small changes
might be needed). The filesystem add-on interface has
changed considerably, so you will need to port your old file system. For more
information, check out the document(s) listed below; or if you need further
help, please contact us through the Haiku mailing list.”
“Haiku has many API advantages
over BeOS and Zeta, which includes but is not limited to better POSIX
compatibility. These API advantages greatly improve the ease of porting
software to Haiku. Due to this, it is unreasonable to expect software that
compiles on Haiku to compile on BeOS or Zeta without additional effort. While
BeOS R5, BONE, and Zeta are still of importance, focus has shifted to Haiku.”
More application compatibility between Haiku and BeOS is
documented in this compatibility
The BeBook API
Want access to Haiku internals? No problem, the BeOS API is
well documented in the BeBook. It lays out the object structures that BeOS/Haiku
applications are written in and is available online. Another book, Programming
the Be Operating System is also available online. Additional BeOS/Haiku
programming references are available here.
Haiku is an advanced OS with well documented, mature
development tools. Getting started with Haiku development is very easy and the
Alpha release is a stable platform to work with. Haiku is a great platform to
explore. Your project might involve
coding for the micro kernel, or writing highly interactive multi-threaded GUIs,
cools multimedia, or even a game. Coding for Haiku is a rich experience, with
good tools and documentation.
Haiku is a programmer’s playground, so check it out and
About the Author
Andrew Hudson is a PMP certified technical project manager
living in Florida, USA. In his abundant spare time he analyzes
technology trends, listens to punk rock music, and watches Chinese kung fu