GRASS CVS source codeのコンパイル
以下は、私が管理するLinuxシステムでGRASSのソースをコンパイル&インストールを行ったときの手順です。
Fedora Core3及び4上で実行済みです。下記手順で問題が出た場合は、エラーメッセージで問題を確認して、各自で対処下さい(質問を頂いてもお答えしかねます)。
1.projライブラリのコンパイル&インストール
cd /opt
wget -nc ftp://ftp.remotesensing.org/proj/proj-4.4.9.tar.gz
tar xvfz proj-4.4.9.tar.gz
cd proj-4.4.9
CFLAGS="-O2 -mtune=i686 -Wall" LDFLAGS="-s" ./configure
make
make install
2.GEOSライブラリのコンパイル&インストール
cd /opt
wget -nc http://geos.refractions.net/geos-2.1.4.tar.bz2
tar jxvf geos-2.1.4.tar.bz2
cd /opt/geos-2.1.4
CFLAGS="-O2 -mtune=i686 -Wall" LDFLAGS="-s" ./configure
make
make install
3.AVCE00(Arc/Info (binary) Vector Coverage Read/Write用)のコンパイル&インストール
cd /opt
wget -nc http://avce00.maptools.org/dl/avce00-1.3.0.tar.gz
tar xvfz avce00-1.3.0.tar.gz
cd /opt/avce00-1.3.0
make
cp avcimport /usr/local/bin
cp avcexport /usr/local/bin
cp avcdelete /usr/local/bin
cp avctest /usr/local/bin
cp ex_avcwrite /usr/local/bin
cp avc.a /usr/local/lib
4.E00compr(Arc/Info Export (E00) file Read/Write用)のコンパイル&インストール
cd /opt
wget -nc http://avce00.maptools.org/e00compr/e00compr-0.5.tar.gz
mkdir e00compr-0.5
cp e00compr-0.5.tar.gz e00compr-0.5
cd /opt/e00compr-0.5
tar xvfz e00compr-0.5.tar.gz
make
cp e00compr.a /usr/local/lib
cp e00conv /usr/local/bin
5.共有ライブラリのパス設定
echo "/usr/local/lib" > /etc/ld.so.conf.d/local_lib.conf
ldconfig
6.gdalライブラリのコンパイル&インストール
cd /opt
wget -nc http://www.gdal.org/dl/gdal-1.3.0.tar.gz
tar xvfz gdal-1.3.0.tar.gz
cd /opt/gdal-1.3.0
CFLAGS="-O2 -mtune=i686 -Wall" LDFLAGS="-s" ./configure
make
make install
7.GRASSのCVS Codeの取得
1)リポジトリの環境設定とログイン
export CVSROOT=:pserver:grass-guest@intevation.de:/home/grass/grassrepository
cvs login
パスワードを聞かれるので「grass」と入力+ENTER
2)CVSソースの取得
cd /opt
mkdir experiment
mkdir stable
mkdir old
#grass5.4のCVSソースの取得
cd /opt/old
cvs -z3 checkout -r releasebranch_5_4 grass
mkdir /opt/old/grass-build
#grass6.1CVSのソースの取得
cd /opt/experiment
cvs -z3 checkout grass6
#grass6のCVSソースの取得
cd /opt/stable
cvs -z3 checkout -r releasebranch_6_0 grass6
8.GRASSのCVS Codeのコンパイル・インストール
#grass5.4のコンパイル&インストール
cd /opt/old
mkdir grass-build
cd /opt/old/grass-build
Fedora Core3の場合
CFLAGS="-O2 -mtune=i686 -Wall" ../grass/configure --with-glw --with-proj --with-motif --with-cxx --with-blas --with-lapack --with-freetype --with-freetype-includes=/usr/include/freetype2 --with-lapack --with-gdal=/usr/local/bin/gdal-config --with-nls --with-odbc --enable-largefile
Fedora Core4の場合(下位互換の開発環境もインストールする必要がある)
CC="gcc32" CXX="g++32" FC="g77" ../grass/configure --with-glw --with-proj --with-motif --with-cxx --with-blas --with-lapack --with-freetype --with-freetype-includes=/usr/include/freetype2 --with-lapack --with-gdal=/usr/local/bin/gdal-config --with-nls --with-odbc --enable-largefile
make
make install
下位互換の開発環境のインストール:yum install compat-gcc-32 compat-gcc-32-c++ compat-gcc-32-g77
#grass6のコンパイル&インストール
cd /opt/stable/grass6
CFLAGS="-O2 -mtune=i686 -Wall" ./configure --with-glw --with-proj --with-motif --with-cxx --with-blas --with-lapack --with-freetype --with-freetype-includes=/usr/include/freetype2 --with-lapack --with-gdal=/usr/local/bin/gdal-config --with-nls --with-odbc --with-lfs --with-mysql --with-mysql-includes=/usr/include/mysql --with-mysql-libs=/usr/lib/mysql --enable-largefile
make
make install
#grass6.1のコンパイル&インストール
cd /opt/experiment/grass6
CFLAGS="-O2 -mtune=i686 -Wall" ./configure --with-glw --with-proj --with-motif --with-cxx --with-blas --with-lapack --with-freetype --with-freetype-includes=/usr/include/freetype2 --with-lapack --with-gdal=/usr/local/bin/gdal-config --with-nls --with-odbc --with-lfs --with-mysql --with-mysql-includes=/usr/include/mysql --with-mysql-libs=/usr/lib/mysql --enable-largefile
make
make install
※Linuxインストール時に追加すべきライブラリ等(開発ライブラリ等も必要)
blas
lapack
unixODBC, unixODBC-devel
tcl, tcl-devel
tk, tk-devel
postogresql, postgesql-devel
fftw, fftw-devel(インストールCD内にはありません。FC3 or 4用はfedora extrasにあります。他はネットで探して下さい)
エラーメッセージでライブラリの不足が出た場合、yumコマンドなどでライブラリ等を追加して下さい。特に、*-devel関係は、殆んどOSのインストール時にはインストールされませんので、個別にインストールする必要があります。
※インストールメモ
1)Fedora Core上でnvizが起動しない(場合がある)。
Fedora CoreのMESAライブラリの問題のようです(グラフィックドライバの問題のようで、システムのチップにより必ずしも問題が発生する訳ではありません)。
依存関係から標準のライブラリは削除できないので、私が行った解決策は下記のとおりです。
��MESAのホームページ(
http://www.mesa3d.org/)
から
Stable Releaseの
ライブラリをダウンロード
�▲曄璽爛據璽犬�
Compilation/Installationに
従って、
解凍: tar xvfz MesaLib-6.2.tar.gz
コンパイル: make linux-x86
インストール: make install(デフォルトのライブラリインストール先:/usr/local/lib)
��GRASS5.4のスタートアップスクリプト(/usr/local/bin/grass54)に以下の行を加える
export
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
または、
/usr/local/libにインストールされるMESA関係のライブラリ全てを、GRASS5.4のインストールディレクトリ内のlibディレクトリ(/usr/local/grass54/lib)にコピーする。
2)Fedora Core3上でのgrass5.4のコンパイルエラー
1)grass-5.4.0/src/libes/dbmi/lib/alloc.c
void *db_malloc(n)関数がchar *db_store(s)関数の後ろにあるためです。void *db_malloc(n)関数全体をchar *db_store(s)関数の前にカット&ペーストします。
2)/opt/grass-5.4.0/src.contrib/SDTS/mapdev/v.out.sdts/control.c
248行目(char *malloc();)をコメントアウトまたは削除
以上です。
3)Fedora Core3上でのGUI動作の問題。
現象 :ダイアログボックス内のエディットボックスで、キーボードからの編集ができない。キー入力が無視される。
理由 :GRASSのGUI(tcltkgrass)がFedora Core3標準の入力メソッド(IIIMF)に対応していないため。
対処法:Fedora Core3をクリーンインストールした場合、入力メソッドが標準ではIIIMFになります。これをkinput2+Cannaの設定に変更すれば、上記の
問題は解決できます。実際には、メニューの【アプケーション】→【システム設定】→【入力メソッド選択】(rootパスワードがこの後必要です)、で
system-switch-imのダイアログを開き、有効な入力メソッドで【高度な設定(A)】をクリックし、アクティブになった言語の
【Japanese-日本語】をクリック後、入力メソッドの選択で【kinput2-canna】を選択し、【OK(O)】ボタンをクリックします。さら
に、この設定を反映するため、リブート(再起動)します。 以上。
4)Grass6.0のd.mで日本語が文字化け(Grassuj mailing listの水谷@仙台様より)
lib/form/form.c
main関数の初めの方に下記の行を追加してコンパイル
Tcl_FindExecutable(argv[0]);
この変更を加えた上で、
vectorの日本語の属性を表示、変更するには、
1. dbf中の日本語と同じエンコードにGRASS_DB_ENCODINGを設定
2. GRASSを起動後、LANGをdbfと同じエンコードに設定
※GRASS起動前のLANGの設定は、反映されない?
例えば、
dbfがutf-8なら
grass6.0> g.gisenv set=GRASS_DB_ENCODING=utf-8
grass6.0> export LANG=ja_JP.UTF-8
こうしておいて
grass6.0> d.mon start=x0
grass6.0> d.vect map
grass6.0> d.what.vect -e
でmapの日本語属性の表示、編集ができるようになります。