How do you install GNAT (GNU Ada) on a Windows computer? - windows

Alright, I'm looking into doing a multi-language project. I'm looking at part of that being in Ada. I'm already aware of the AdaCore packages, but I would need to link each file separately, meaning it would probably be easiest to go straight through GCC.
The only problem is that GNAT is apparently mostly written in Ada and I can't seem to find a guide on how to install it anywhere.
MinGW took care of a few of the other languages for me, but apparently GNAT wasn't included in that.
Thanks in advance!

If you later decide to install MinGW Ada, you can update your existing installation using the mingw-get command, shown below, e.g. mingw-get install ada. More details may be found here.
An alternative compiler has its uses, as suggested in this related answer.
$ mingw-get --help
Manage MinGW and MSYS installations (command line user interface).
Usage:
mingw-get [OPTIONS] ACTION [package-spec ...]
mingw-get update
mingw-get [OPTIONS] {install | upgrade | remove} package-spec ...
mingw-get [OPTIONS] {show | list} [package-spec ...]
Options:
--help, -h Show this help text
--version, -V Show version and licence information
Actions:
update Update local copy of repository catalogues
list, show List and show details of available packages
install Install new packages
upgrade Upgrade previously installed packages
remove Remove previously installed packages
Package Specifications:
[subsystem-]name[-component]:
msys-bash-doc The 'doc' component of the bash package for MSYS
mingw32-gdb All components of the gdb package for MinGW
Use 'mingw-get list' to identify possible package names
and the components associated with each.
Addendum: On Windows XP, I piped mingw-get list through grep to pare the list.
$ mingw-get list | grep -i ada
...
Package: mingw32-gcc-v3-ada Subsystem: mingw32
The GNU Ada Compiler
This package provides the MinGW implementation of the GNU Ada language
written in the Ada language.
...
$ gnatmake --version
GNATMAKE 4.5.2
Copyright (C) 1995-2010, Free Software Foundation, Inc.
...

I uploaded the 64bit GNU ada on SF.NET within the Mingw-w64 project.

Go to AdaCore’s Libre site, download the installer and run it!
That said, I think you’re going to have a problem with your scheme of compiling your source files individually; Ada code has to support elaboration, which isn’t something you’d want to manage by hand. I haven’t checked it myself (I don’t program on Windows if I can help it), but here is some information on using GNAT with Windows; worth a look.

Stuff like Ada Web Server requires Ada developer to have a unix-like environment even on Windows so I always install MSYS together with GNAT GPL. There are several guides on how to use MSYS together with MinGW. The only problem is that recent MSYS automated installer is by default configured to use non-AdaCore MinGW which is not what we want.
The latest normal (non-automated) installer of MSYS is here:
http://sourceforge.net/projects/mingw/files/MSYS/Base/msys-core/msys-1.0.11/MSYS-1.0.11.exe/download
After installation you will be asked for MinGW location. Write c:/GNAT/2012 or whatever you use for GNAT (without bin).
On Windows Seven this script failed for unknown reason, but connecting MSYS and MinGW is as simple as writing
c:/GNAT/2012 /mingw
into C:\msys\1.0\etc\fstab

Related

Linux install command for mingw?

When trying to build a library from source using make and MinGW, I realized (from errors) that I don't have the install command, which I understand to be a combination of cp, chown, chmod, strip, and maybe some other stuff. I figured, hey, someone's got to have a copy of that out there, right? But unfortunately the name of the binary makes it near impossible to search for with any search engine.
Does anyone know of an existing MinGW-compatible version of install?
If you are running MinGW as a cross-compiler, hosted on Linux, (as your question title might be construed to imply), the native /usr/bin/install on the Linux host itself serves admirably; (FWIW, this is exactly how my own MinGW development platform is set up).
OTOH, if you really mean "where can I find a Linux-like install utility to accompany MinGW running on MS-Windows?", then (as Diego notes) you will find it among MinGW.org's MSYS tools; running mingw-get install msys-base will install it for you, (assuming you are using mingw-get to manage your MinGW installation).

How to use/install GNU binutils (objdump)

I need to use the objdump and readelf commands in my application that runs on windows. I know I can install cygwin in order to use them. The reason why I don't want to use cygwin is because I want to make it essay to deploy. Plus I don't know how to make a silent install of cygwin. As a result I believe that what I need is GNU Utilities For Win32 as the link states those libraries are serverless. "executables do only depend on the Microsoft C-runtime (msvcrt.dll) and not an emulation layer like that provided by Cygwin tools"
Anyways once I go to that link I don't know how to install it. Specifically I will like to use >this tool<
I will appreciate if someone can point me on the right direction of how I will be able to use objdump and readelf (binutils in cygwin) on my application.
they are already compiled and they can be downloaded from here!
Once downloaded they will be located in the bin directory:
and then you will use it the same way you use it on linux by passing the same args.

How can I setup linux to compile FORTRAN code into windows binaries?

I'm working on a FORTRAN project and I would like to build all of the binaries that I want to maintain on a linux machine that is dedicated for automated builds. I have successfully used mingw to build 32-bit and 64-bit binaries from C source for windows machines on the linux machine with the following packages on Ubuntu.
apt-get install mingw32
apt-get install mingw-w64
Then I run the following commands to actually compile:
gcc -b amd64-mingw32msvc -V 4.4.4 -o <...other options>
However, the mingw packages that I've obtained via apt-get do not include FORTRAN compilers.
Anybody got any ideas on what I can do?
if you got mingw32 and the Gnu C cross compiler is working for you ... when why not just get the Gnu Fortran cross compiler, too?
http://www.nber.org/sys-admin/mingw32-fortran-fedora.html
EXAMPLE apt-get install mingw32-gcc-fortran
I know this is an old thread but a few things seem to have changed and people might still be interested in the topic.
Problem: I want to use my linux machine to compile some code and create a .exe that I can send to people using Windows.
Solution: Essentially here: http ://mxe.cc/
What I did:
Check to see if your system has all the software you need here
run
git clone -b stable https://github.com/mxe/mxe.git
It will download a few small things and create the directory "mxe" (probably in your home folder)
cd into that mxe directory and run "make". HOWEVER: this would take hours and take up a few GB on your hard drive so instead run something like
make mpfr eigen opencsg cgal qt
For more ideas on how to shorten that all see this or the mxe tutorial or somewhere else ;)
The easiest way to compile stuff then seems to be something like:
~/mxe/usr/bin/i686-pc-mingw32-gfortran -c main.f95
~/mxe/usr/bin/i686-pc-mingw32-gfortran main.o -o outfile.exe
Of course you can chose something other than fortran, just consult the mxe/usr/bin to see what its called.
You can always download and install a prebuilt compiler from the MinGW(-w64) project itself:
Windows 64-bit: http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/rubenvb/4.6.2-1/
Windows 32-bit: http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/rubenvb/4.6.2-1/
Just unpack somewhere and add the cross*/bin directory to PATH.
I include (obj)c(++) and fortran.
On Ubuntu 18.04 I use
apt install gfortran-mingw-w64
Then use the compiler x86_64-w64-mingw32-gfortran in place of gfortran. If you're using cmake, you can configure the compiler from the build directory like so:
FC=x86_64-w64-mingw32-gfortran cmake ..

how to install cygwin and mingw under windows 7?

I want to use gcc ( and g++ ) under windows 7.
I download cygwin ( setup file: setup.exe )...
So, what is packages really needed?! It suggests to setup very many packages, but i think that for developing in C++ not all of these is really needed..
gcc4-g++ for Cygwin programs
mingw64-i686-gcc-g++ for 32-bit MinGW programs
mingw64-x86_64-gcc-g++ for 64-bit MinGW programs
Setup.exe will select their dependencies such as gcc-core or binutils for you.
You'll probably also want make, and don't forget to pick an editor. Other packages in my minimum install: cygutils, diffutils, util-linux, inetutils, openssh, mintty.
If you would like to use only gcc and g++, I'd receomend you MinGW Distro designed by Stephan T. Lavavej.
Here is a direct link: http://nuwen.net/mingw.html to the Distro's main page. It contains currently the most up to date gcc and boost (4.7.2 and 1.52.0 respectively in version 9.5). It also contains make, git and couple more of useful tools.
Installation is really simple, you need only to extract zip-archive.
So, if you need Cygwin only to use GCC, I'd recomment you this MinGW Distro instead of Cygwin.
Greetings,

Is it possible to install 2 different versions of GCC at the same time?

I am using Ubuntu 9.10
For a particular piece of code I require GCC 3.2 but I have a higher version. Is it possible to install multiple versions and use whichever one I want to ?
Have you searched the Ubuntu package archive for gcc ?
If gcc 3.3 is ok, you could download the gcc-3.3 and related .deb packages for dapper and I suspect it will install and happily co-exist with the gcc 4.4 you get with karmic. (You'll have to be sure to invoke it as gcc-3.3.)
Otherwise you would have to:
download the relevant gcc source bundle
build it yourself with an installdir some place out of the way like /opt/gcc-3.3
make sure to set your PATH correctly when you need it.
yes, you can have multiple installations. You can invoke specific version using gcc-3.2.
you can search repository using apt-cache search gcc-3 to find a package to install using apt-get install. quick search shows only gcc-3.3 in repository, if that version does not work for you, you have to dig a bit more or install by hand. Other poster gave more details
Consider accepting previous answers to questions you have been answered, otherwise you will not get responses.
It is possible to have more than one, but they need to be named differently and installed to different folders. See tutorials for building cross-compiling GCC but do not build for different architecture. However, note that compiling GCC yourself is rather difficult, so fixing the application that you need to compile might be easier.
It is possible to install several versions of gcc on the same machine, where the default version is located here:
/usr/bin/gcc
Then your alternate versions could be located here:
/usr/local/gcc
Certainly adding packages is a simpler way to do it, but if you are interested in installing from source you can download the specific version you want from here:
https://bigsearcher.com/mirrors/gcc/releases/
Then to easily distinguish the versions you can add a suffix or prefix:
./configure --prefix=/usr/local/gcc --program-suffix=-10
So in this case your alternate executable would become gcc-10. Then simply perform make and make install as usual.
Please note that if you get an error about GMP, MPFR or MPC files being missing then install them using:
./contrib/download_prerequisites
For details please see https://gcc.gnu.org/faq.html#multiple and Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+
Then you should have the new gcc program installed in /usr/local/gcc/bin instead of the default /usr/bin/gcc, so you have to add it to your PATH in your .bashrc file (this is how I did it for bash):
export PATH=$PATH/usr/local/gcc/bin
So now I can so that I have both the default gcc and the gcc-10 by doing:
$ which gcc
/usr/bin/gcc
$ which gcc-10
/usr/local/gcc/bin/gcc-10

Resources