If I want to compile a program that is written in Ada, I have to use GNAT, of course.
As my Computer has Windows as its sole operating system, I cannot use GNAT, normally. Right? Thus I got Cygwin which enables me to use GNAT on Windows.
But the result is an executable that runs under Windows – not Linux. So how can I compile the Ada code for Linux although I only have Windows? (Please don’t think about the reasons …)
Is this possible with Cygwin? Do I have to install a virtual machine with Linux? Or is there another (easier) solution to this issue?
Not true; there are other Ada compilers. (GNAT is the only one I know of that’s free.)
Running GNAT under Cygwin gives you Cygwin executables, which are Windows executables that depend on
cygwin1.dll. They will not work on Linux. See the “What … isn’t it?” section on the Cygwin home page.There is a GNAT for Windows. The GNAT Pro version has a list of supported platforms here; it includes Linux and Windows, but it doesn’t show a Windows-to-Linux cross compiler.
Since GNAT is free software (GNAT Pro
isn’tis a little more complicated; I won’t get into that) there could well be a Windows-to-Linux GNAT cross-compiler — or, if you’re really ambitious, you could build one yourself (or hire someone to do it for you).But installing GNAT on a Linux system is the easiest approach. It doesn’t have to be a virtual machine. If you have the hardware, you can install some Linux system by itself, or you can set up a dual-boot system on your Windows box. Ubuntu has a Windows installer, Wubi, that installs an Ubuntu image as a Windows file; it doesn’t let you run Windows and Ubuntu concurrently, but it lets you dual-boot without having to repartition.
There are other options; these are just the ones I’m familiar with.