Ada on Windows without Alire

I’m building a new tool and I would like to compile on Windows as well.

I can’t find GNAT Community Edition anymore. I installed Alire toolchain with GNAT native and GPRBuild. When I build the project directly with gnatmake and gprbuild I get… an ELF binary. I guess some of my settings are wrong, but I’m lost.

The project is here: GitHub - tomekw/tada: Tomek's Ada tool

Use a release from this GitHub repo. Download the GNAT one and the gprbuild one, unzip them to separate directories, and then put the bin directory from each one into PATH. Then you can just use gcc, gnatmake and gprbuild like normal from CMD

2 Likes

Perfect, thank you! That worked :slight_smile:

As a side note, the msys2 environment also provides gnat and gprbuild. It emulates a linux environment on windows (it build windows binaries though, not linux ones). Gives you access to tools like make, vim, etc.

It uses the pacman package manager. You would install things like gnat and gprbuild from there. Whenever I do a fresh install, I generally snag make, gcc, gprbuild, and git using the following commands:

pacman -Sy make
pacman -Sy mingw-w64-x86_64-toolchain
pacman -Sy mingw-w64-x86_64-gprbuild
pacman -Sy git

The toolchain one is the one that installs gnat (if you tell it to install Ada when it asks. I just tell it to install everything).

Then add C:\msys64\mingw64\bin to PATH, because normally one would not use MSYS2 console or Linux stuff under Windows.

1 Like

MinGW and Cygwin are similar.