GCC on Haiku

I wonder is it possible to install GCC on Haiku and probably compile Haiku on Haiku. I haven’t found any “how to”.

So, I’m going to remind you that the Haiku team has determined that Alpha status of Haiku will require that it can build itself (also known as “self-hosting”)… but due to stability and missing pieces, it hasn’t yet been declared possible. So in short, trying to get Haiku to build itself is probably an exercise in frustration unless you are a developer wishing to track down and fix whatever problems may arise (which would be extremely welcome!).

So, these issues aside…

You actually can take a BeOS/Zeta build of GCC 2.95.3 from bebits and use it in Haiku. This is not the same as having a native Haiku compiler ported to and built for Haiku, but since Haiku is binary compatible with BeOS R5, it does work.

You’re going to need some reasonably-complete public header files in order to compile much of anything useful. You can try grabbing the ones from Haiku’s public headers, but I’ve heard more people have luck using the BeOS R5 headers still (I did last time I tried to compile under Haiku, and was able to compile a few small projects). Since Haiku is binary and source compatible, this should work fairly well for many things.

You’ll first want to get the code onto your Haiku machine - you can try using subversion to do this, but I’m not sure how well that works. Probably easier to just mount another BFS partition with the code already on it. You might want to grab the “jam” directory from the buildtools branch also and attempt to compile a native jam rather than use the binary-compatible version from BeOS (you are trying to rebuild Haiku afterall, compiling jam should be easy by comparison).

Now you’ll likely run into some issues - although I haven’t tried this… running configure from the haiku trunk may work, or possibly the configure script doesn’t know how to build Haiku target using Haiku as the host yet. Not sure anyone has seriously made any attempt to do this yet due to instability when trying to compile large projects in Haiku still.

You’re sort of on your own, since the number of known issues in the Haiku kernel has prevented most people from making any serious attempts yet to coerce Haiku to build itself. But once it’s possible, Haiku is likely to be labeled as Alpha.

I’ll be curious to hear how far you get - I’m sure Haiku is much more stable than it was last time I tried…

Thanks for your answer. At first I would like to install R5 gcc 2.95.3 on Haiku and try to compile very small projects. Then I’ll try to compile jam and probably gcc. Now I don’t know where to get gcc 2.95.3 sources ported to BeOS. As far as I understand I need to fetch Haiku sources to get public headers. Recently I’ve tried to install R5 gcc 2.95.3 (from bebits) on Haiku but I don’t know how because there are install instructions only for R5 and Dano. Could you tell me how did you manage to install R5 gcc on Haiku and compile small projects?

or have a look at this image

That is exactly what I need. Thanks!