Author Topic: ada: any Gnat-armv5tel-linux-gnueabi binary around?  (Read 2598 times)

DiTBho

  • Newbie
  • *
  • Posts: 29
    • View Profile
ada: any Gnat-armv5tel-linux-gnueabi binary around?
« on: January 10, 2021, 09:47:52 am »
In order to compile gnat you need a gnat compiler, it's the chicken and egg problem.

I have solved it for HPPA-v2(1) but it cost me one year of attempts (cross-compiling parts from x86 and somehow making them HPPA-native until everything was able to recompile itself autonomously) and before investing all this time for my old Zaurus C1K I'd like to hear if there is already around a gnat binary profiled as "armv5tel--linux-gnueabi".


(1) it's my daily RISC workstation. I know, I know ... x86/64 bit is better, faster, and cheaper, but I love my RISC workstation, especially now that's finally able to compile ada sources! And I also want my PDA to be able to compile ada sources  :D

greguu

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 432
    • View Profile
    • http://github.com/greguu
Re: ada: any Gnat-armv5tel-linux-gnueabi binary around?
« Reply #1 on: January 12, 2021, 02:49:18 am »
Hi there,

this package is not available for Arch Linux ARM ( or Void Linux for that matter). You will need to build it from source.
Older Slackware ARM builds have a binary here: https://slackware.pkgs.org/14.1/slackware-armv5/gcc-gnat-4.8.2-arm-1.tgz.html
This may help to bootstrap a newer build, you may need to use the older Slackware for that (in a chroot).

Hope that helps.

Cheers,

Greguu
Gemini-PDA (Sailfish X and Android) / LG Nexus 5 (Android 11) / Nokia N9 (MeeGo/Harmattan)
Sharp Zaurus C3100 (Borzoi) - Void Linux (voidz) Kernel 5.0.0 - Hardware (Buffalo CF LAN, DLink 660 CF WiFi, ASIX AX88772 USB Ethernet)

DiTBho

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: ada: any Gnat-armv5tel-linux-gnueabi binary around?
« Reply #2 on: January 12, 2021, 05:41:33 am »
this package is not available for Arch Linux ARM

The plan is to build it for Gentoo/armv5tel, and that binary helps a lot! Thanks  :D


DiTBho

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: ada: any Gnat-armv5tel-linux-gnueabi binary around?
« Reply #3 on: January 12, 2021, 06:03:37 am »
At the moment I have successfully built
  • Gnat for HPPA2/Linux
  • Gnat for PPC32be/Linux
  • Gnat for MIPS4be/Irix-6.5
  • Gnat for i686-32bit/Linux

In the near future, I will try to build
  • Gnat for Armv5tel/Linux
  • Gnat for MIPS32be/Linux

In the far future, I may consider to try to build
  • Gnat for MIPS32le/Linux (I don't own any MIPS32le platform, except my slow router)
  • Gnat for RISC-V/Linux (there is not yet any RISC-V platform able to run Linux)
  • Gnat for SH4/Linux (I don't own any SH4 platform, except my CASIO graphical calculator, which is not able to run Linux)


This was the most exciting moment because building this environment was entirely done on the workstation rather than on a fast i686 cross compiler

Code: [Select]
# catabuild dev-embedded/gnat-hppa2
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild     N  ] overaly::dev-embedded/gnat-test-minimal-1.0
[ebuild     N  ] overaly::dev-embedded/gnat-hppa2-4.3.4 test=minimal

56 hours later ... (being compiled and tested on a 550Mhz RISC machine)

Code: [Select]
2019-02-13--16-49-09---2019-02-13--16-59-56 - [ dev-embedded/gnat-hppa2 ] - success - @2.29.1/7.3.0

catabuild is like emerge, but lighter, it uses special ebuild classes (designed for gnat) and executes tests (in a chroot) before installing things on the final path and it only installs things if things have passed tests

DiTBho

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: ada: any Gnat-armv5tel-linux-gnueabi binary around?
« Reply #4 on: January 30, 2021, 08:40:19 am »
Code: [Select]
with Ada.Text_IO;
 use Ada.Text_IO;

procedure Hello is
  begin
    Put_Line ("Hello WORLD!");
end Hello;

Slakware, Debian, etc  have a completely different approach from Gentoo for their "ecosystem" tools. I extracted "gnat1", which is the real Ada compiler, and other useful libraries, and made a special package in /opt/gnat

There is still no "gcc" able to support gnat, and collect2, gnatmake, etc, still don't work.

Code: [Select]
# myinfo gcc languages
--enable-languages=c,c++

To have ada supported by gcc, the above line should look this way
Code: [Select]
# myinfo gcc languages
--enable-languages=c,c++,ada

Which is what I currently have on my macmini

Code: [Select]
macmini-intel # myinfo gcc-config languages
 [1] i686-pc-linux-gnu-4.9.4-gnat2016     --enable-languages=c,c++,ada
 [2] i686-pc-linux-gnu-6.5.0              --enable-languages=c,c++,fortran
 [3] i686-pc-linux-gnu-7.3.1-gnat2018     --enable-languages=c,c++,ada
 [4] i686-pc-linux-gnu-7.5.0              --enable-languages=c,c++,fortran
 [5] i686-pc-linux-gnu-8.3.1-gnat2019 *   --enable-languages=c,c++,ada
 [6] i686-pc-linux-gnu-8.4.0              --enable-languages=c,c++,fortran
 [7] i686-pc-linux-gnu-9.3.0              --enable-languages=c,c++,fortran
 [8] i686-pc-linux-gnu-10.2.0             --enable-languages=c,c++,fortran
 [9] i686-pc-linux-gnu-11.0.0-rust2020    --enable-languages=c,c++,rust

But in order to have it, you need an "ada-bootstrapper" to compile the ada support required by gcc.
In other words, GCC must be compiled by GCC, and since GNAT is mostly written in Ada, therefore,
native versions of GCC C and Ada compilers are necessary.

It is also recommended that the native versions should be at least the same versions as building cross compiler. Compilation with older versions of GCC may fail.

So, with just an existing gnat1, I have just created a wrapper to have things managed in wild way, and it seems working.

Code: [Select]
# gcc-ada-wrapper hello.adb
step1, ada compiling hello.adb ... done
step2, asm compiling hello.s ... done
step3, ada binding hello.adb ... done
step4, asm compiling b~hello.s ... done
step5, linking hello.o b~hello.o system.ada.libs ... done

Code: [Select]
# ./hello
Hello WORLD!

Not perfect, but hey? it's one step ahead ;D
« Last Edit: January 30, 2021, 09:27:45 am by DiTBho »