Gnat for Mac Ada programming

后端 未结 2 747
南笙
南笙 2021-01-04 13:48

I\'m learning Ada 95 in my programming class, and I would like to install the gnat compiler on my MacBook. I have no clue as to where to get a good gna

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-04 14:08

    There's an excellent free Ada compiler for Mac OS X available from AdaCore.

    You should be OK with the GNAT GPL edition. Follow the Download link - choose Free Software of Academic Development - at the bottom of the page, follow Build your Download Package.

    Select your platform as x86_64-darwin, 2012. Click on GNAT 2012, then on gnat-gpl-2012-x86_64-apple-darwin10.8.0-bin.tar.gz (this contains all you'll need for the moment).

    You'll also need Xcode (free with Mac OS X). Pre-Lion, this was (I think) an optional install on the installation DVD. In Lion or ML, you need to get it from the App Store (in ML it's at Categories > Developer Tools > Xcode). In ML, you also need to install the command line tools: open Xcode, then Xcode > Preferences > Downloads > Components, select Install against the Command Line Tools.

    I say to install Xcode first, because the GNAT install needs it (you can tell whether the command line tools are installed by saying which make: if the answer comes back blank, they aren't installed). Anyway, for the GNAT install,

    $ cd
    $ tar zxvf ~/Downloads/gnat-gpl-2012-x86_64-apple-darwin10.8.0-bin.tar.gz
    $ cd gnat-gpl-2012-x86_64-apple-darwin10.8.0-bin
    $ sudo ./doinstall
    

    You don't need the installer after it's finished, so you can delete it.

    The defaults install GNAT under /usr/local/gnat, and you'll need to make sure that /usr/local/gnat/bin is first on your path (at any rate, ahead of /usr/bin). I'd edit ~/.bash_profile_common to add

    PATH=/usr/local/gnat/bin:$PATH
    

    but I still have trouble knowing which of the ~/.bash* files do what!

提交回复
热议问题