Ada Compiler

Ah Haskell. … I’ve been using 64 bit Haiku some lately, and first thing I tried to get Haskell (ghc) running there. Long time Haskell user, but I’ve had it, no more of this for me. What a nightmare. Eventually ground to a halt with some problem with relocatable symbols, that no one else has because other ELF platforms don’t link with the same shared object option … I forget the details, don’t want to remember. No more shall I be tempted by languages that have this chicken/egg dependency.

I am pleased to report that the latest OCaml (4.10) builds in a few minutes with no dependency whatever. I had to make one edit to the configure file, to get -lnetwork in there and -lm out. Automatically built and installed both native and bytecode compilers.

OCaml is in principle a distant relative of ADA, via Modula-2. Strict typing with a module system. It’s a functional programming language, with type inference (you rarely have to declare anything), runtime memory management (you don’t have to allocate or free anything.) I’ve been able to write to the Haiku (Be) API (though that isn’t as robust as it should be, no doubt I missed some runtime thread interlock.)

1 Like

This change was unnecessary.

Hello,

gnat-community-2019-20190517:

  • the GNAT compiler toolchain
  • the SPARK Ada verification and prover toolset
  • the GNAT Programming Studio IDE
  1. Need to port librsvg and GTK3 for the IDE.
  2. Toolset(s) - some dependencies for the entire GNAT framework exist in Haikuports. Need to test
    success of each port to minimize issues.

Notes:

  • May want to start with Haiku x86_64 versus Haiku x86 as build/dev platform.
  • Reviewing QtAda bindings w/ Qt Creator versus GNAT Studio IDE. GTK3 - no port for now.
  • Haiku has their own Debugger tool. GDB 8.3+ port is still a w-i-p.
  • SPARK to Haiku requires some build testing and verification.

Just some gotchas… but just depends on what YOU are trying to accomplish overall.

This comment is completely unrelated and contains no useful information, the toolchain have no special dependency except the circular dependency on ada. https://www.archlinux.org/packages/core/x86_64/gcc-ada/

Went with your proposed way and tried to build the buildtools with ada enabled on Linux with gnat installed, but the configure script bailed out with “c compiler doesnt work” or similar error.

“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.”

Serious Ada development with GNAT is a bit involved.

Ok, i gave up. My registration is 14 years old here, so i risk something writing this comment, consider this.
We were talking about porting the gcc-ada toolchain and you mentioned completely unrelated things and stuff. Why should we consider any spark dependency, if we first just want an ada compiler as first milestone? How is gdb a hard dependency? Why do you always need to derail a topic with nonsense? Why do you never write a complete sentence, just unrelated “quotes” picked carefully to make the thread unreadable? To seem like you know things, while it seems this is not the case? Why do you never reacts clearly? Why do you play this game all the time? How about being staright and telling what you want to say?
Dear @admins, please ban me.

Yeah, I know -lm has been rendered harmless, but oddly enough that one has been dealt with in the distribution sources - someone has sent --haiku* changes upstream. But they didn’t work - it was doing -lm anyway - for reasons I didn’t bother to figure out, and it did need -lnetwork.

Can you tell which command you used, I will have a try? If I am not wrong, you have to use the gcc version from gnat, not the default gcc in the PATH to compile, but maybe that’s what you did? I currently live in China and that is always a pain to download anything from Haiku sources and repositories…

In linux (used 64 bit Manjaro in this case):

  1. Check out Haiku and Buildtools repo according the documentation: https://github.com/haiku/haiku/blob/master/ReadMe.Compiling.md
  2. Install the dependencies as written in the documentation
  3. Install gnat package with your linux package manager
  4. Add ada to the languages list in this line: https://github.com/haiku/haiku/blob/10cd325cfafb80353704ef021205ff5e5523d3a3/build/scripts/build_cross_tools_gcc4#L285
  5. Configure buildtools as written in the documentation

In step 4 after plenty configuring and compiling it started to configure ada, which is failed. Hope you will have more luck.

I want to target gcc-8.3 which is the default version of gcc in the nightly x86_64 builds. Where is it coming from? Haikuports? In the buildtools, I see building gcc-4.5 and 2.95 only. Sorry, I have my answer by looking at your previous message about haikuports

Scratch that earlier comment about haikuports, you want to have a cross-compiler toolchain on a host OS, where GNAT already available. For that you can use the buildtools way. So basically you want the follwoing:

  • On Linux with native GNAT you want to build an ada-enabled crosscompiler toolchain (this runs on Linux but targets Haiku).
  • Then with this toolchain you should build GCC with ada to get binaries which can run on Haiku.
  • Then you will copy it over to Haiku, package them in a temporary package
  • Using this temporary-package build GCC from Haikuports with ada support

Last 3 pont is roughly written, we can help you later if you have already a working crosscompiler toolchain on linux.

Buildtools provides GCC8.3.0. Maybe it is referred as GCC4 in some documentation/scripts, but it means not the GCC version, but the GCC ABI version (important for the runtime loader).

Haiku provides 2 GCC ABI version:
-GCC2
-GCC4 (for everything which isn’t GCC2).

On x86_64 only the GCC4 ABI is available, while on x86 both available and usable.

Hope this is correct, if not: FIXME.

1 Like

To extend this:
I made a mistake as I tought Ada have no circular dependeny on itself, but I stand corrected, and I checked the facts with trying to build gcc with Ada enabled on Haiku, then tried to build a crosscompiler on Linux. I failed, but I checked the way to not give wrong hints anymore.
While you just threw in some list about optional extra tools which is for sure useful but not in this experimenting stage.
It is like telling to somebody who trying to get wine compiled on Haiku to make sure it runs Crysis.
Unrelated.

I have tried to build a cross-compiler under OpenBSD 6.6. Here what were my steps. Installed gnat which uses gcc 8.3 as haiku. set the environement CC =“egcc” (gnat is installed in OpenBSD under the symlink “egcc”) and added “–enable-languages=c,c++,ada” in the CFLAGS in “build-gcc4-optional-packages-Haiku.sh”
then as a first try to have a look, build the cross-compiler with “./configure --build-cross-tools x86_64 …/buildtools” .
Seems to work but stops at “ld: error: too many errors emitted …”: many symbols undefined.
Don’t really want to use Linux. By the way is it possible to disable C++ to accelerate compilation without impacting the next step (using the cross-compiler to build the haiku ada compiler) ?

Tested with only ada enabled, but gcc still built libc++, maybe it depends internally on it.
Nevertheless, build still fails, here is my config log: https://pastebin.com/raw/uXtWCCT1
It tries to link against libroot, which is obviously not available in this stage. No idea, maybe this way won’t work.
As OpenBSD is not the most well tested platform to build Haiku, i would first test if building an unchanged buildtools works or not.

I finally installed manjaro. I managed to compile the cross compiler and realized I did not know how to enable ada through the “./configure” at the top level in the haiku directory. How to pass it on the command line?

I think the only way is trough the build script what i linked earlier?

This way seems more difficult as we need to understand most of the parts of the process haha.

No one said this would be easy :slight_smile:
The scripts in Haiku buildsystem are your only reference to what we do to build a cross compiler (which is indeed not so simple). You can try to understand and modify that script, or you can decide to not look at it, and figure out all by yourself all that needs to be done. And in the end you’ll write a script that looks very similar to ours, I’d say (but if you find things that can be simplified, we’ll be happy to improve our script!)

Exactement :wink:. I was not expecting it to be easy too…but we can dream haha. That’s a good opportunity to understand the build system too.