Ada development einvironment on Windows

What is your preferred (command line) environment and why when you develop programs in Ada on a Windows computer? My editor of choice is either Emacs or sometimes Code

I see several alternatives:

  1. MSys / Mingw64
  2. MSys / UCRT64 (recommended by msys.org: “if you are unsure, go with UCRT64”)
  3. WSL 2 with Debian
  4. Full Debian in a VirtualBox

Most programming tools like git, grep, make or shells (zsh) are available in msys, too. Do I really still need a Linux environment?

I am using Windows. My environment is GNAT Studio + GNAT FSF + gprbuild. I take DLLs from MinGW when necessary, e.g. OpenSSL, GTK etc. They are fully compatible with the GNAT native environment.

Of course, never git, make, grep, emacs, sorry. Surely some mature repository (a project management system, actually) would be useful, but there is none available freely. gprbuild is quite capable to handle multiple interdependent projects, if used correctly.

When Windows 64-bit development is complete I perform testing on:

  • Windows 32-bit with an ancient GNAT GPL compiler.
  • Debian 32 and 64-bit native for x86 and ARM
  • Fedora 32 (legacy compiler) and 64-bit native for x86 and ARM
  • Ubuntu 32 (legacy compiler) and 64-bit native for x86 and ARM
  • CentOS 32 and 64-bit native for x86

For deployment I use Inno Setup for Windows, rpmbuild for Fedora/CentOS, dh_make for Debian/Ubuntu.

P.S.I really enjoyed ObjecAda as it was fully compatible with MS binary formats. I heard they are back in the business, but I am afraid they lost Ada community.

P.P.S. I would like to use Alire too, but it seems incapable to handle external/OS dependencies and multiple targets.

FWIW, it’s not that they are back in business, they are still in business. See PTC ObjectAda…

On my Windows machine I use MINGW64 (Git Bash) for command line, with VS Code as my main IDE. I use Alire too and it works well, though I’ve had problems in the past using it with PowerShell so I stick with using it in MINGW64.

Yes, I know and welcome it. But under “business” I meant following Ada standard, supporting other OSes and hardware. They lingered for too long with Ada 95-Windows-x86.

We successfully used ObjectAda for automation projects, but when it came to developing a real-time middleware we switched to GNAT Pro because we needed Ada 2005 and VxWorks.

I use the same setup on Windows 11 that I used on Windows 10 before I upgraded. I use latest Alire with MSys / Mingw64 and VS Code, started with alr edit. The VS Code integration is in a stellar place right now - all the previous issues I’ve had with it seem to have been solved for my use cases (not finding symbols, eating up all CPU, eating up all RAM, formatting not working correctly). Seriously, to all the folks who work on this, you’re doing awesome work.

I usually use the integrated terminal in VS Code, and build with alr build and run with alr run. I use git for windows added to path so that Windows powershell can find it. VS Code has regular expression search built in, and jump-to-symbol works just fine with Ada, and I don’t use many dependencies, so I don’t use grep too often.

When I need larger source code search I prefer a special tool I wrote in Ada called septum which does interactive neighborhood-based search instead of a simple command line-based one. Septum isn’t the most efficient in memory (~70 bytes/line), and isn’t optimized at all (e.g. it doesn’t use mmap for files or cache searches), but works with short search times (a few seconds or less) after initial startup in large (10+ million lines of code) code bases.

GNAT Studio does a funky thing with indenting where tab formats, not indents. I have “format on save” configured in VS Code, so you’d think it shouldn’t matter, but the tab key input not matching my expectations is like a speed bump for my brain since no other editor I’ve used behaves that way.

GNAT studio’s built-in debugger does work super well except that last time I used it a year or so ago, breakpoints in generic packages didn’t work, so I had to manually add breaks with manual assembly calls to int 3. I’ve never gotten the debugger to work with VS Code consistently, but I use lightweight “assert” style contracts enabled in development mode. When I find a bug, I’ll add more preconditions and postconditions to narrow it down.

You really can’t go wrong with either GNAT Studio or VS Code, and you can configure Alire to start whichever one you want with alr edit.

Do I really still need a Linux environment?

I have found cross-platform tool development in Ada to work consistently most of the time. The only issue I’ve had is Mac a few years ago not supporting a standard library call where it should report the number of available CPUs. Anecdotally, it has been easier to get Linux libraries to work for me. perf is also available on Linux which is a dream for optimizing programs.

2 Likes