如何在 Windows 计算机上安装 GNAT (GNU Ada)?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8300006/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 18:33:01  来源:igfitidea点击:

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

windowsgccinstallada

提问by johnki

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.

好的,我正在考虑做一个多语言项目。我正在研究 Ada 中的一部分。我已经知道 AdaCore 包,但我需要单独链接每个文件,这意味着直接通过 GCC 可能最容易。

The only problem is that GNAT is apparently mostly written in Adaand I can't seem to find a guide on how to install it anywhere.

唯一的问题是 GNAT 显然主要是用Ada编写,我似乎找不到有关如何在任何地方安装它的指南。

MinGW took care of a few of the other languages for me, but apparently GNAT wasn't included in that.

MinGW 为我处理了一些其他语言,但显然 GNAT 没有包含在其中。

Thanks in advance!

提前致谢!

采纳答案by trashgod

If you later decide to install MinGWAda, you can update your existing installation using the mingw-getcommand, shown below, e.g. mingw-get install ada. More details may be found here.

如果您稍后决定安装MinGWAda,您可以使用mingw-get如下所示的命令更新您现有的安装,例如mingw-get install ada。可以在此处找到更多详细信息。

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 listthrough grepto pare the list.

附录:在 Windows XP 上,我mingw-get list通过管道greplist.

$ 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.
...

回答by ray_linn

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

我在 Mingw-w64 项目中的 SF.NET 上上传了64 位 GNU ada

回答by Simon Wright

Go to AdaCore's Libre site, download the installer and run it!

转到AdaCore 的 Libre 站点,下载安装程序并运行它!

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.

也就是说,我认为您的单独编译源文件的方案会有问题;Ada 代码必须支持细化,这不是您想要手动管理的。我自己没有检查过(如果可以的话,我不会在 Windows 上编程),但这里有一些关于在 Windows 上使用 GNAT 的信息;值得一看。

回答by OCTAGRAM

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.

像 Ada Web Server 这样的东西要求 Ada 开发人员即使在 Windows 上也有一个类 Unix 环境,所以我总是将 MSYS 与 GNAT GPL 一起安装。有几个关于如何将 MSYS 与 MinGW 一起使用的指南。唯一的问题是最近的 MSYS 自动安装程序默认配置为使用非 AdaCore MinGW,这不是我们想要的。

The latest normal (non-automated) installer of MSYS is here:

MSYS 的最新正常(非自动化)安装程序在这里:

http://sourceforge.net/projects/mingw/files/MSYS/Base/msys-core/msys-1.0.11/MSYS-1.0.11.exe/download

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).

安装后,系统会要求您提供 MinGW 位置。写入 c:/GNAT/2012 或任何用于 GNAT 的内容(不带 bin)。

On Windows Seven this script failed for unknown reason, but connecting MSYS and MinGW is as simple as writing

在 Windows 7 上,此脚本不明原因失败,但连接 MSYS 和 MinGW 就像编写一样简单

c:/GNAT/2012 /mingw

into C:\msys\1.0\etc\fstab

进入 C:\msys\1.0\etc\fstab