Ada Compiler

Why isn’t the GNAT Compiler actually built with Haiku? As I understand it, the GCC that comes with Haiku contains the C and C++ compilers. I think Ada support should be included. Actually I think the full suite should be supported. While C++ is the Haiku language of choice for development, there’s nothing keeping people from developing applications in other languages. GCJ and G95 are relatively easy to add on once you’ve got an existing system. GNAT isn’t so easy, as large portions of the compiler are written in Ada, leaving two, unpleasant choices. Bootstrap a compiler… or cross-compile on a UNIX system, neither are incredibly fun.

I agree with this - Ada 2005 is an excellent language and would be great on the Haiku platform. Trouble is, I don’t personally have the time to maintain it… so if anyone else wants to see it included and has the time to do it, that would be great!

I would be more than happy to maintain it. I was just wondering why it wasn’t officially in Haiku. I have huge issues even trying to compile GCC with the C and C++ flags though, let alone anything else. Actually come to think of it I’ve had an easier time compiling most software on Interix… may be I missed some section of the documentation, haha.

Should the developers wish it, I’d also be more than happy to make a full binding of the Be API. Personally I think Haiku would gain from this, but then again I tend to view Ada as a sort of panacea.

[quote=kameo76890]I would be more than happy to maintain it. I was just wondering why it wasn’t officially in Haiku. I have huge issues even trying to compile GCC with the C and C++ flags though, let alone anything else. Actually come to think of it I’ve had an easier time compiling most software on Interix… may be I missed some section of the documentation, haha.

Should the developers wish it, I’d also be more than happy to make a full binding of the Be API. Personally I think Haiku would gain from this, but then again I tend to view Ada as a sort of panacea.[/quote]

Hi Patrick,

Most Haiku developers don’t follow the forums. Please, send an email to [haiku-development] mailing list instead; you are more likely to get a response there. If you have not joined this list yet, you can subscribe from here:

http://www.freelists.org/list/haiku-development

Good luck!

I also think Haiku would gain from this - there is a nice solidity about Ada that will help bring even more application developers to the platform. A lot of people that use Ada would be impressed to see native support and may even design and create some new applications.

I equally think Haiku should not get too heavy code-wise, and Ada may be seen by some as superfluous to the cleanliness of the system - but part of me feels that Ada fits in nicely with the whole “designed” feel of the platform.

1 Like

I have been using ADA in my University times and explored its features.

But I wonder where it is actually used outside Military/Space & Aeronautics Industry, industries which will not use Haiku as OS any time soon…

At least what I could see, is that it contains threads and synchronization support built in the language.

Will require bindings to the OS kits for making UI applications.

Therefore I guess the port to a new platform is not trivial.

It’s been used outside Military/NASA/Transportation systems for quite some time. One of the reasons for the 95 standard was to aid this. Look at the reasons for the 2005 standard and you can see more movement towards general purpose. Ada’s been used in a great deal of user-space programs (why else is there so many API bindings), ranging from calculators to music players to desktop environments. Heck there’s even web servers, and graphics libraries (with DirectX/OpenGl bindings).

While no where near as common as C/C++, Ada has proven itself to be more efficient than C/C++. Look around the web, you will find benchmarks.

Ada would not actually require bindings (although it would be a lot more convenient). Since the 95 spec, Ada compilers had to support bindings to C code. It makes reading the code a tad bit weird, but it’s a viable method.

One thing so many people overlook, Ada is a General Purpose language. There’s absolutely no reason what was written in C/C++ can’t be written in Ada. The idea that Ada is ‘micro-controller’/‘critical systems’ only really bothers me, so sorry about the rant.

I would like to revive this thread and see if new information is available (topic from 10 years ago) . If I remember correctly, there was a gnat compiler available under beos with the collection of tools"geekgadgets" (if not wrong). Seems Gcc has improved its support of gnat quite a lot within those 10 years, it might be easier to cross compile it.

If there is still interest one can adjust the gcc recipe in haikuports to enable ada support.

Exactly. I just wanted to ask if someone already tried and have any feedbacks. Will try it myself too. I am using mostly openbsd and it is more difficult to compile haiku on it. I might go linux in virtualbox though…

You don’t need to build Haiku, just install the current nightly, Clone the haikuporter and haikuports git repo, configure haikuporter, adjust the gcc recipe and let haikuporter build it for you.
Warning:

  • GCC is a beast, you probably don’t want to build it in a vm.
  • The GCC recipe is pretty complex.

to build gnat you need a basic version of an ada compiler to bootstrap it as some parts are written in ada. Therefore the easiest way to port it to haiku remains cross-compiling as gnat is already available on linux and bsds.

1 Like

You are right, do not need to build Haiku, just gcc with ada enabled

To experiment with gcc based ada you can add “ada” to this line:


You’ll have to generate separate subpackage for ada files, to keep the main gcc package small. For reference look how gfortran and objc subpackages was made (it is in the same recipe).
Then create a PR, so we can comment/merge it.

Ok, will try, but not very soon. Thanks for help :smile:

I am still reading documentation but I have a question. What about going the buildtools route? It would seem more direct. Then just adding ‘ada’ to “–enable-shared”?

Buildtools used to build Haiku on foreign system (or on 64 bit Haiku). It compiles a toolchain for a host system which targets Haiku. You however want a toolchain on Haiku host AFAIK, so if you want to have ADA compiler on Haiku then this is not the right way.

Just to be sure that we are on the same page. To build gnat (gcc based ada) we need to have a minimum version of Ada first. Therefore it is impossible to compile it directly under haiku for the moment (unless a subset of Ada is supported by I don’t know what).
“It compiles a toolchain for a host system which targets Haiku” : that’s what I want to do; I want to use a version of gcc on another platform which already has a support of ada and create directly a Haiku compiler which supports Ada. Then copy this version of Ada in Haiku.
That’s the chicken and egg issue…we need Ada to build Ada.

Oh, that was new for me.
The problem is the bootstrapping then, which will be a tough task to automatize for the buildbots…
I think your way could work in this case.

What we do usually in such case is have a package built from pre-existing binaries. Haskell, Rust and Pascal are made available this way.