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.
Just how
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
/boot/common/apps.
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,
grep, etc.
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
release.
Old Skool Dev Tools
The usual coding tools are available for Haiku development
including: bash, GCC, BASIC,
Perl, Python, Eiffel,
make, Ruby,
OCaml, and even a version of SmallTalk. GCC, Perl, Python, and Vi
are installed on the Alpha release by default.
EMACS is in development.
Hello World?
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
the Tracker
to browse the folders and files. Right click on your Haiku filesystem
icon in the upper left corner, the file folders will automatically expand.
IDEs?
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
include: Paladin,
Niue,
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.
GCC
Hybrids?
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
note.
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.
Conclusion
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
start coding.
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
movies.
R1A1 (the first Alpha) is starting to age quite a bit. For better performance try one of the recent nightles. (however avoid any nightlies between Feb 1 – 20th 2010.. there was major kernel work going on which caused data corruption/etc… that stuff should be fixed now though)
I’d like to see a refreshed release as an ISO.
Plus, there’s been a lack of news on the Haiku site. I’d like to know what things have been fixed or added without going through the changlogs or devlist posting.
A once a month status report like ReactOS usually does would be helpful to us non-programmer types.
I may be a Beos/Haiku fans but even I would love to see a quarterly (4 times a year) review of the status of as many alternative OSes as possible.
Is anything going on with SkyOS for example?
…but as far as I can see, a few rather fundamental things missing. My system is hardly new – about two-three years old – but it doesn’t look like much of it will work. Multi-core processors, for example – recent forum posts indicate that even in 2010, that’s considered too new a feature to be well supported. WiFi support – standard on pretty much any laptop for the past five+ years – is dubbed experimental. My video card (nVidia, but ATI/AMD is in the same position) is supported only by a Vesa driver.
Seems to me that for all that it might have a great design and user interaction, that doesn’t matter so long as it’s so massively deficient in hardware support. I’d be happy to try it out, but as far as I can tell, I’d be doing well if it boots. And if it does, I won’t be able to do anything with it in the absence of an internet connection…
What are you blathering about?
Did you even try a build of Haiku on your hardware?
*posted from a Dell Latitude D620, Core DUO, that happily boots Haiku, and uses _both_ cores beautifully thank you very much*
No, because the information I can find on their website suggests there’s not much point. Perhaps it’s incorrect, but my comments were based on recent (i.e this year) posts in their forums indicating that while traditional SMP worked fine, multi-core didn’t. Likewise, my comments about WiFi or video support come from the Haiku site and forums.
If their hardware support is better than I thought, perhaps they need to make it clearer what the current state of things is…
No, not yet. Not for an alpha-quality OS. And precisely to avoid having a whole bunch of people with modern proprietary hardware lacking open specifications from whining about their hardware not working when they thought it would.
Haiku is in a state of heavy testing/development still. If you’re not willing to “try” it without getting an explicit written guarantee in advance that you’ll receive a certain “experience”, then I think it’s wrong for you. Please move along now.
Meanwhile, posting your “impression” based upon zero real-life experience, isn’t going to help. Perhaps you should consider silence, or -questions- instead of statements full of unfounded, sweeping generalizations.
Oh wait, this is the internet. Most of us are stupid.
Edited 2010-02-23 04:05 UTC
I agree. But that is still a real concern.
Two things I have said in the past about Haiku and OSNews: focus on the fundamentals and drop that extravagant advocacy.
If an OS hasn’t even reached one release, it can not be “mature” or “stable”. The status of “mature” is reached after years — and decades. Keep the alpha-status bravely and keep experimenting, but do not try to go fishing to areas which clearly are not the core strengths. You don’t need that much advocacy: those that want to code, find your system without it.
(And well, this is the destiny of any “alternative operating system”. You get a thousand and one Linux people — you know, those pretending to be “open-minded” — bitching about things that do not work compared to their system that is developed by corporate overloads; probably the same people who have never contributed code but think that contributing noise is the same thing.)
Well the information is probably very much on the safer side. I’ve successfully ran Haiku on a P4, Amd X2 4400+ (dual) and a Core i5 (quad).
Let’s see: I have a Intel Core 2 Quad Extreme at home where I run Haiku. I also have an 8 core (4 physical + 4 hyperthreading) laptop that runs it. All cores are used as expected. I guess you may want to get your facts straight.
BeOS supported ‘n’ CPUs, Haiku had the same aim.
Even BeOS can take advantage of however many CPU cores are available, provided it can support the chipset / memory.
From what I hear wireless works very well, but is not tested well enough to consider it anything more than experimental.
Also, before you judge a complex project such as an operating system, one should always consider how long it took the competition to attain the same level of completeness they are expecting.
For Windows, that would be 10 years for wireless, and then only because companies other than Microsoft did the work. Otherwise, you can move that all of the way up to 14 years ( XP ) – and that is with very poor inbuilt hardware support. But Microsoft need only worry about having the kernel boot and remain stable enough for 3rd party drivers to be installed.
For Linux, well… much longer.
Haiku has come an incredibly long way very fast thanks to ‘merely’ being, essentially, a reimplementation of a prior work – design decisions are mostly already made for you.
Think before you speak.
–The loon
Like I say, I’d be interested in trying it out. But based on the limited info on the Haiku website, it doesn’t seem like it’s really in a state where that’d be worthwhile yet – not being able to connect to the internet is a bit of a show-stopper, given this is a desktop OS…
Maybe in another year, it might be mature enough to be worth a closer look. But not right now…
Why not install it in something like VirtualBox or KVM?
So run it in a virtual machine – testing it there won’t even cost you the price of a black CDR
Limited info on the Haiku website? What info, specifically, are you looking for?
Not being able to connect to the Internet? Where did you get THAT idea? Sure, wireless connectivity is still limited to unprotected networks (no WEP or WPA/WPA2 yet), but Haiku will connect to the Internet just FINE, if you have a wired Ethernet connection! Web browsers include Firefox, Aurora, and NetSurf.
Need to know what hardware in your system is supported? Try a bootable CD image and see what happens.
Can’t get an .iso to burn to CD? I can make one for you… of the latest revision, if you like. You want GCC2 or GCC4?
Alpha1 is getting dated. A lot has improved since then.
Haiku is FAR more “usable” than you think, even at it’s current stage. You just need to give it a chance.
This is how the alpha runs videos in VESA mode on an NVidia ION, which the author claims he couldn’t manage in either Windows or Linux:
http://www.youtube.com/watch?v=W3dsDf_DkII
Btw, the alpha is really slow compared to the nightlies.
A little bird has informed me that a Haiku port of Nouveau and RadeonHD has recently started – expect an official announcement around BeGeistert time (April 10-11th).
Checkout:
http://dev.haiku-os.org/wiki/R1/ImprovementsSinceAlpha1
You may collaborate porting radeonhd driver from X to Haiku
Also, interested readers might find DarkWyrm’s “Learning to Program with Haiku”[1] blog posts interesting. Experienced programmers might find the first lessons too basic, but it’s an interesting read anyway.
[1] http://darkwyrm-haiku.blogspot.com/2010/01/calling-all-haiku-develo…
One of the most important resources missed by the original author is the BeOS R5 Sample code (download http://www.bebits.com/app/3019). The sample code has everything from Hello world, my first window, to device drivers. Most of this is still 100% valid for Haiku.
Another important set of tutorials is embedded in the legacy BeNewsletters (http://www.haiku-os.org/legacy-docs/benewsletter/index.html). Here you can read tutorials and explanations from the BeInc engineers who actually designed and implemented various components. This resources gives you the WHY as well as the HOW.
The author here. I didn’t miss it, it’s under the Hello World paragraph.
…when I ran BeOS… but I did contribute (I think it was ruby) a module to Pe ages ago. I also wrote an awesome website in Python, using the native db-file system for “blogging” back then… just drop an article into a folder and it became part of the site… and could also receive comments, again, written to the file system… it was neat to me anyway, back then.
BFS was so much fun! And I wish web servers could still be as simple as PoorMan was. I actually used another web server for more complex stuff… it began with an X I believe, but I forget the name. It may still be around today on Windows.
Does BeShare still have regulars on there? You used to be able to find all kinds of goodies.
LOL! Found one of my posts on BeBits looking for the “how to” for creating add ons for PE. Someone pointed me to some docs/example code and I was good from there:
-=-=-=-=-=-=-=-=-
How do you create…
By tuishimi – Posted on February 20, 2004 – 23:11:42 (#11162)
Current version when comment was posted: Nightly
…new syntax files?
-=-=-=-=-=-=-=-=-=-==-
…oh and check it out! My old account still works!
-=-=-=-=-=-=-=-=-=-=-
You are currently logged in as tuishimi.
If this is not your account, click here to relogin, or logout below.
So Would most of the software on bebits be compatible with Haiku? Seems to be quite a lot on there.
Most, if not all, of the software on BeBits is now over at HaikuWare (the new owners/maintainers of BeBits). BeBits really needs to be shuttered, since BeOS is at the end of it’s days.
“Object oriented micro-kernel operating system? Check. “
Which part? The micro-kernel part or the object oriented one?
Haiku, like BeOS, *is* an object oriented operating system.
Haiku, like BeOS, is *NOT* a micro-kernel operating system. It’s a modular kernel.
So, please half-uncheck. or half-check, depends if you’re a glass is half-empty or half-full guy 😉
it is monolithic/hybriid not a microkernel.
since qt4 already works quite fine in haiku, I started to use the editor “s.t.e 0.1.1” from http://www.qt-haiku.ru , and I alredy like it, even if it’s in an early development-stage. It would be nice to have a better IDE than the ide’s that were mentionated by the author of this article. Qt-Creator I don’t like that much for writing c++ code, because it pays too much attention on qt-projects, but not so much on normal c++ projects.
CodeBlocks I like more, but since wxwidgets is not ported to haiku, there is not hope for codeblocks on haiku.
But still I can not complain, s.t.e and PE and jam are quite enought for me at the moment.
I have basically zero knowledge about Haiku, and am curious about its “cleanest programming API in the neighborhood” (as well as the “elegant messaging system” and pervasive multithreading). Unfortunately, I don’t have the time to install the OS simply in order to learn about the API.
However, I am quite familiar with OPENSTEP and descendants — can anyone with experience in both compare and contrast the two?
Thank you!
A month ago I had zero knowledge about developing for Haiku (did some little programs for KDE earlier, so I had an idea).
Using Paladin and reading the BeBook, browsing some sample code it was not difficult to get my first little app in two weeks (its on Haikuware now).
I applaud the effort that is going into re-creating BeOS (in my mind the best OS in history) but what are the plans in regards to 64-bit mode?
Everyone is going 64-bit these days for the wider registers (and more of them) as well as access to more than 4GiB of RAM. Does the Haiku project have this on their roadmap? Can this even be added without breaking the older (binary only) applications?
-Ian
http://www.returninfinity.com
Well, the BFS file system was 64-bit back in 1997. So in that regard BeOS was way ahead of the crowd. As far as 64-bit kernel, I think the goal is to at least get to Beta before putting resources into that. There are only so many kernel hackers on the Haiku team, so it’s better to keep focused on the most important tasks.
But if you think about it, 64-bit for Haiku is not as important as 64-bit for Windows or Linux. Haiku is targeted to desktop applications, not server applications. Currently corporations are not running large server tasks like database, web serving, file serving that require lots of RAM. This could come in the future, but not just yet.
So currently it’s not the highest priority.
I thought this article would cover some basic BeAPI ( HAIPI ?) and compiling topics. So, I’m a bit disappointed, but neverthelesse, some good source of links to usefuls stuff.
I tried the alpha on my (AMD based) computers but it didn’t even boot. (Works in VMWare of course, but I dislike the speed there).
Hi electr0n,
The BeAPI is extremely well documented here in this reference: