T.Y's Room   研究室

トップページへ | 研究室 目次へ | Ada95 | CSP

GNAT をインストールしてみよう( Solaris 2.5.1 バイナリパッケージ版 )

GNAT の入手

 まずは,GNAT を入手しなければなりません.私は怠け者なので,一番簡単なバイナリ版を入手します.
 しかしながら,ソースコード版をセットアップすることをお勧めします. gcc が既にインストールしてある人はソースコード版を参考にしてください.

ftp://wuarchive.wustl.edu/languages/ada/compiler/gnat/

ftp://ftp.cdrom.com/pub/languages/ada/compiler/gnat/

ftp://cs.nyu.edu/pub/gnat/

 ここからダウンロードしましょう.このディレクトリから distribに移動し,(移動しなくていい場合もあります)gnat-3.11p-sparc-sun-solaris2.5.1-bin.tar.gz(バージョン番号は最新のものに置き換えてください)をダウンロードします.ファイルサイズが約 7MB ですから,空いているときにダウンロードしましょう.


ファイルを解凍する

 まず,ダウンロードしてきたファイルは圧縮ファイルなので,解凍します.
 ここでは gzip, gunzip など圧縮関連のソフトウェアがインストールされていることを前提とします.インストールされていないなら,インストールしましょう.方法は WWW 検索で容易に見つけることが出来ます.

% su

 最初にスーパーユーザになります.

# gtar -xzvf gnat-3.11p-sparc-sun-solaris2.5.1-bin.tar.gz

 gtar は GNU tar です./bin/tar と区別するためにコマンド名を変更しています.もし,GNU tar がインストールされていないのであれば,以下のコマンドで代用できます.

# gunzip -cd gnat-3.11p-sparc-sun-solaris2.5.1-bin.tar.gz | tar xvf -

 gnat-3.11p-sparc-sun-solaris2.5.1-bin というディレクトリが作成され,その中にインストールするファイルがあります.

doconfig を実行する

 次にカレントディレクトリをgnat-3.11p-sparc-sun-solaris2.5.1-bin に移し,doconfig スクリプトを実行します.

# cd gnat-3.11p-sparc-sun-solaris2.5.1-bin
# ./doconfig


 最初に以下のメッセージが表示されます.
  This script is provided to simplify the installation of the sparc-sun-solaris2.5.1
  binary version of the GNAT Ada 95 compiler which is now maintained by
  Ada Core Technologies. For information on commerical support please
  contact sales@gnat.com.

  This script asks a few questions about how you want GNAT configured
  and then creates a file in this directory which can then be invoked
  to do the actual installation.  Running this configuration script will
  not modify anything anywhere else in your system.  You can break
  out of it or run it multiple times before doing the actual installation.

  Hit RETURN to continue.
 このメッセージの要点は

  • バイナリ版の GNAT は現在 Ada Core Technologies によって維持されている
  • 商用サポートに関する情報は sales@gnat.com に連絡する
  • このスクリプトはGNATの形成に関して,いくつか質問をする
  • このスクリプトはあなたのシステムを変更しない( doinstall スクリプトを生成する以外は何もしません)
  • このスクリプトは実際のインストール前に何度でも終了,実行できる

 このメッセージを読んだら RETURN キーを押して,次のステップに進みます.


インストールタイプの選択

 次にインストールタイプの選択をするメッセージが表示されます.

 There are basically 3 options for installation:

  1) Install GNAT-specific files on top of an existing GCC 2.8.1
     installation (must be in standard locations -- will likely
     require root permission).

  2) Install GCC C compiler and GNAT files in the standard  GCC locations.
     (Note: This includes directories under /opt/gnu.  On most
      systems, this requires root permission).

  3) Install GCC C compiler and GNAT files in non-standard locations
     that you will specify.


  Options 1 and 2 provide simplest and most flexible use of GNAT.
  Option 3To install GNAT is a non-standard location you need to specify a
    base directory.  All the files will be installed in subdirectories
    that are created under this directory.

    Specify the base directory you want to use for installation:
 requires users to set some environment variables.

Type 1, 2, or 3 (then RETURN) to choose an option:

 各インストールタイプについて説明します.

  1.  既にある gcc 2.8.1 に GNAT 用のファイルを追加インストールします.
     ただし,gcc 2.8.1 は /opt/gnu 下にインストールされていなければなりません.

  2.  gcc 2.8.1 と GNAT 用のファイルを標準の gcc インストールパス( /opt/gnu 下)にインストールします.
     gcc がインストールされていない環境向けです./opt/gnu 下にインストールされるので,/opt/gnu を使ってないとか,他のパスにしたい場合は 3 を選択してください.

  3.  指定した場所に gcc 2.8.1 と GNAT 用のファイルをインストールします.
     この場合,インストール後にインストールパスを環境変数に追加する必要があります.

 1, 2, 3 のどれかを入力し,先へ進みます.ここでは 3 を選択しました.


インストール先の入力

 以下のメッセージが表示されるので,インストールする場所を指定します.

 To install GNAT is a non-standard location you need to specify a
    base directory.  All the files will be installed in subdirectories
    that are created under this directory.

    Specify the base directory you want to use for installation:

 /usr/local 下にインストールしたいので,/usr/local と入力します.

 すると次の確認メッセージが表示されます.

     The base directory is /usr/local
     To accept this choice enter RETURN.
     Otherwise type a new name.

インストールパスが /usr/local であることを確認します.違うようなら,正しいインストールパス(この場合は /usr/local)を入力し直してください.確認できたなら,RETURN キーを押して,先へ進みます.


doinstall スクリプトの生成

 以下のメッセージが表示され,今までの選択内容に合わせた doinstall スクリプトが生成されます.

     The installation of GNAT will install:
      In /usr/local/bin :
          gcc gnatbind gnatbl gnatchop gnatfind gnatkr gnatls gnatlink gnatmake
          gnatmem gnatprep gnatpsta gnatpsys gnatxref

      In /usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.8.1 :
          gnat1 cc1 cpp ld libgcc.a specs
          and libgthreads.a

      In /usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.8.1/adainclude :
          The source files of the RTL

      In /usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.8.1/adalib :
          The object & ali files of the RTL
          and libgnat.a

    The files env-vals & env_vals.sh have been created.  they contain
    the commands to set the environment variables you need to use GNAT
    in csh syntax (env-vals) or in sh syntax (env-vals.sh).  These
    commands should be placed in your .cshrc (or equivalent) file.

Configuration complete. Run doinstall to do the installation.
DO NOT FORGET: put /usr/local/bin at the front of your PATH

 GNAT のファイルがどこにインストールされるのかを表示しています.

 doinstall と一緒に env-vals と env-vals.sh ファイルも生成されます.
 これらは GNAT 用の環境変数を設定するコマンドが列挙されています.env-vals は C シェル用で,env-vals.sh は sh(ただのシェル)用です.
 使っているシェルが C シェルである前提で話を進めます..cshrc に env-vals の内容をコピーします.加えて,/usr/local/bin つまりインストールパス下の bin を PATH 環境変数(の一番目)に追加します.これで GNAT に関連する環境変数の設定が完了します.


インストール開始

 では doinstall スクリプトを実行して,ファイルのインストールを開始しましょう.

# ./doinstall

 これでインストールは完了です.


トップページへ | 研究室 目次へ | Ada95 | CSP