Compile and Install/id: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
Line 3: Line 3:
Di sini akan dijelaskan prosedur untuk melakukan kompilasi GRASS dari CVS, yang juga dapat digunakan untuk rilis resmi GRASS 6.
Di sini akan dijelaskan prosedur untuk melakukan kompilasi GRASS dari CVS, yang juga dapat digunakan untuk rilis resmi GRASS 6.


''Untuk instalasi paket biner, lihat halaman [[Petunjuk Instalasi]].''
''Untuk instalasi paket biner, lihat halaman [[Panduan Instalasi]].''


Untuk informasi detil mengenai kompilasi, silakan lihat berkas [http://grass.itc.it/grass61/source/INSTALL INSTALL] dalam kode sumber.
Untuk informasi detil mengenai kompilasi, silakan lihat berkas [http://grass.itc.it/grass61/source/INSTALL INSTALL] dalam kode sumber.

Revision as of 06:35, 4 July 2008

Bagaimana melakukan kompilasi dan instalasi GRASS 6?

Di sini akan dijelaskan prosedur untuk melakukan kompilasi GRASS dari CVS, yang juga dapat digunakan untuk rilis resmi GRASS 6.

Untuk instalasi paket biner, lihat halaman Panduan Instalasi.

Untuk informasi detil mengenai kompilasi, silakan lihat berkas INSTALL dalam kode sumber.

Syarat

GRASS membutuhkan paling tidak dua buah pustaka ekstra : PROJ dan GDAL/OGR

Catatan : Jika Anda ingin ada dukungan DBMS dalam GDAL (juga dalam GRASS), Anda harus melakukan langkah opsional seperti berikut.


  • PROJ4 untuk pengelolaan proyeksi (dengan dukungan proj-datumgrid-1.3.zip)
  • Opsional: GEOS
  • Opsional: PostgreSQL, mySQL, unixODBC, SQLite (SQLite dibutuhkan untuk QGIS)
  • GDAL/OGR untuk membaca dan menulis beragam format data GIS (interoperability)

Anda harus melakukan instalasi dua pustaka ini terlebih dahulu.

Cara yang paling mudah adalah mendapatkan pustaka ini dalam bentuk paket seperti .rpm, .deb untuk sistem operasi yang Anda gunakan dan menjalankan proses instalasi yang sesuai (misalnya., rpm -Uhv namapaket.rpm; apt-get) dari terminal (console). Lakukan secara seksama jika Anda akan melakukan instalasi pustaka ini dari paket pengembangannya (paket ..-devel). Jika tidak ada paket yang siap untuk diinstal, maka Anda harus melakukan pengunduhan dahulu kode sumbernya (lihat tautan berikut, paket kode sumber biasanya berakhiran .tar.gz atau .zip), kemudian lakukan kompilasi (Anda harus memiliki sebuah program kompilasi C dalam sistem operasi Anda). Tahapan untuk melakukan kompilasi dan instalasi pustaka tersebut dapat dilihat di website.

Pustaka lain yang diperlukan untuk menjalankan GRASS ada dalam list berikut : REQUIREMENTS. Untuk melakukan kompilasi, Anda juga membutuhkan paket pengembangannya (paket "..-devel").

Prosedur kompilasi dan instalasi generik

  • Periksa GRASS 6.x dari SVN (lihat: http://trac.osgeo.org/grass/wiki/DownloadSource)
  • Akan lebih bagus jika proses kompilasi dilakukan sebagai normal user, bukan root. Jika Anda menginginkan kode sumber tersebut diletakkan di direktori dimana Anda memiliki hak (misalnya /usr/local/src/cvs) cukup ikuti prosedur berikut:
     cd /usr/local/src/cvs 
     su -c 'mkdir grass6'
     su -c 'chown yourlogin:yourgroup grass6'
  • Lakukan checkout (co) dari repository
     cvs -z3 co grass6
  • in the grass6 directory, you will find the precious INSTALL file, open it with your favourite pager/editor and read it carefully!
  • run configure with parameters to adapt the compile process to your own system. To see what options can be passed to it, run configure --help. The minimum set of configure parameters is (refers to GRASS 6 from CVS, not to 6.x release):
     ./configure ### It may (!) look like this:
     ./configure \
         --with-cxx \
         --with-sqlite \
         --with-postgres-libs=/usr/include/pgsql/libpq \
         --with-postgres-includes=/usr/include/pgsql \
         --with-freetype \
         --with-freetype-includes=/usr/include/freetype2 \
         --with-motif \
         --with-glw \
         --with-proj-share=/usr/share/proj

You may have to explicitly state the path for certain packages (i.e., gdal). The Unix 'locate' command will come in handy for finding the path of the package you need (you may have to run locate as root ex: sudo locate gdal-config).

Please note that the paths mentioned may widely vary due to the distribution used. At the end of configuration process you should get report not much different from this:

GRASS is now configured for: i686-pc-linux-gnu

Source directory:            /usr/src/grass6
Build directory:             /usr/src/grass6
Installation directory:      /usr/local/grass-6.3.svn
Startup script in directory: ${exec_prefix}/bin
C compiler:                  gcc -g -O2 
C++ compiler:                c++ -g -O2
FORTRAN compiler:            
Building shared libraries:   yes
64bit support:               no

 NVIZ:                       yes

 BLAS support:               no
 C++ support:                yes
 DWG support:                no
 FFMPEG support:             no
 FFTW support:               yes
 FreeType support:           yes
 GDAL support:               yes
 GLw support:                no
 JPEG support:               yes
 LAPACK support:             no
 Large File Support (LFS):   no
 Motif support:              no
 MySQL support:              no
 NLS support:                no
 ODBC support:               no
 OGR support:                yes
 OpenGL(R) support:          yes
 PNG support:                yes
 PostgreSQL support:         yes
 Readline support:           no
 SQLite support:             no
 Tcl/Tk support:             yes
 TIFF support:               yes
 X11 support:                yes
 
  • Let's compile it (takes a little while...)!
     make
  • At the end, you should get report not much different from this:
----------------------------------------------------------------------
Following modules are missing the 'description.html' file in src code:
----------------------------------------------------------------------
GRASS GIS compilation log
-------------------------
Started compilation: Ne kvě 28 13:18:43 CEST 2006
--
Errors in:
--
Finished compilation: Ne kvě 28 13:43:40 CEST 2006
(In case of errors please change into the directory with error and run 'make')
  • If there is any error, change directory to directory with error and run "make" again. Report occuring bug to grass mailing list
  • Once the installation process is finished, you're ready to install GRASS system wide.
     su -c 'make install'
  • enjoy GRASS:
     grass63

What else?

If you want to use QGIS, then also compile the GRASS-GDAL/OGR plugin. This is also useful to access your GRASS-data from other application using GDAL/OGR like thuban.

Platform Specific Notes

Linux

Debian
  # first install PROJ, then GDAL.
  cd grass63/
  # follow instructions in debian/README.debian
  fakeroot buildpackage
  svn co svn://svn.debian.org/svn/pkg-grass/packages/grass/branches/<GRASS Version>
Ubuntu

The above Debian notes will probably work with Ubuntu as well.

Ubuntu 6.06, 7.10
  • makegrass.sh is script designed to automate most of the download, configuration and compilation of GRASS 6.x-CVS
    • it is advised use checkinstall (sudo apt-get install checkinstall) instead of make install to keep track of installed software
    • Think twice before using this script. Some users experienced problems such as disabled XGL etc.
  • Here is another of these scripts, it's homemade so probably you'll find the above more useful for production sites.
Ubuntu 7.10 64-bit
  • Compiling latest GRASS source code on a 64-bit machine (with an ATI graphic card) under Ubuntu 7.10 64-bit with support for: 64-bit, SQLite, OpenGL, PYTHON, FFMPEG

(Based on "Ubuntu 6.06 LTS - GRASS 6.1 Compilation Script" by David Finlayson) Assuming it is the first time attempting to compile GRASS' source code & installing SVN, PROJ, GDAL/OGR

Preparation

sudo apt-get update && sudo apt-get upgrade
  • install dependencies for compiling (in general) and dependencies for GRASS: PROJ, GDAL/OGR
sudo apt-get install grass build-essential flex bison libncurses5-dev zlib1g-dev \
libjpeg62-dev libgdal1-dev libtiff4-dev libgcc1 bpng12-dev tcl8.4-dev tk8.4-dev fftw3-dev \
libfreetype6-dev libavcodec-dev libxmu-dev gdal-bin libreadline5 libreadline5-dev \
make
  • install SQLite
sudo apt-get install sqlite3 libsqlite3-dev
  • install SVN
sudo apt-get install subversion
  • create a directory as a simple user where source code(s) are going to be stored (in our example we use a directory called src under /usr/local)
sudo mkdir /usr/local/src
  • grant rwx (read-write-execute) permissions for our userid/ groupid on the directory (replace words userid and groupid with real userid):
sudo chown userid:groupid /usr/local/src
sudo chmod ug+rwx /usr/local/src
  • download latest source code from GRASS SVN repository in a directory on the system (e.g. /usr/local/src)
svn checkout https://svn.osgeo.org/grass/grass/trunk grass_trunk
  • Above command places GRASS' source code in /usr/local/src/grass_trunk. In case of a subsequent update use the command: svn up from within the grass_trunk directory

Before attempting to compile GRASS, READ section (C) in the INSTALL file located in the main directory of GRASS source code entitled: (C) COMPILATION NOTES for 64bit platforms


  • installing FFTW3 if not already on system
sudo apt-get install fftw3 fftw3-dev
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
  • install dependencies
sudo apt-get install liblame-dev libfaad2-dev libfaac-dev libxvidcore4-dev liba52-0.7.4 liba52-0.7.4-dev libx264-dev libdts-dev checkinstall build-essential subversion
  • guide to ffmpeg directory
cd ffmpeg

if necessary: make distclean before configuration (look at notes below)

  • configuration (note: the configuration parameter "--enable-pp" does not work anymore)
./configure --enable-gpl --enable-libvorbis --enable-libtheora \
            --enable-liba52 --enable-libdc1394 --enable-libgsm \
            --enable-libmp3lame --enable-libfaad --enable-libfaac \
            --enable-libxvid --enable-pthreads --enable-libx264 \
            --enable-shared
  • compilation
make
  • installation on /usr/local/bin -- important to remember when configuring GRASS' source code for compilation
sudo checkinstall

go for GRASS!

  • in our example we used the /usr/local/src directory to store GRASS' source code, so:
cd /usr/local/src/grass_trunk
  • configuration
 CFLAGS="-g -Wall" ./configure --enable-64bit \
       --with-libs=/usr/lib64 --with-cxx --with-freetype=yes \
       --with-postgres=no --with-sqlite=yes --enable-largefile=yes \
       --with-tcltk-includes=/usr/include/tcl8.4 \
       --with-freetype-includes=/usr/include/freetype2 \
       --with-opengl-libs=/usr/include/GL --with-readline \
       --with-python=yes --with-ffmpeg=yes \
       --with-ffmpeg-includes=/usr/local/include/ffmpeg
  • if OpenGL fails then maybe it is necessary to link glxATI.h with glx.h and re-run the configuration
cd /usr/include/GL
sudo ln glxATI.h glx.h
  • compilation
make
  • compilation is expected to end with a statement similar to the following:
Started compilation: Wed Feb 27 00:24:36 CET 2008
--
Errors in:
No errors detected.
  • installation
sudo make install
  • launch 64-bit GRASS.6.3.svn
grass63

Notes

  • in case of errors in future compilation attempts, remember to remove program binaries with
make clean
  • and the files created with the "configuration" from previous compilations with
make distclean
RPM SPEC files
Zaurus

... see here for instructions


Mac OSX

... see here for instructions

... or this other way


Solaris

10 SPARC/i86pc
  • get gcc compiler and tools. There are several sources: Solaris Companion CD (SFW pkg, installs in /opt/sfw/), Blastwave ([1], CSW pkg, installs in /opt/csw/) or Sunfreeware ([2], SMC pkg, installs in /usr/local/).

Needed Packages from Sunfreeware: SMCbinut, SMCbison, SMCcoreu, SMCfindu, SMCflex, SMCgawk, SMCgcc, SMCgrep, SMCgzip, SMCless, SMClibt, SMClicon, SMCmake, SMCncurs, SMCproj, SMCsed, SMCtar, SMCtcl, SMCtiff, SMCtk, SMCunzip, SMCzlib.

  • compile and install fftw-library ([3]). You need to re-compile the library with:
     ./configure --with-pic --enable-shared; make ; make install. 

The pre-built packages don't work.

  • compile and install gdal library (see documentation of gdal, [4]).
  • compile and install any additional libraries (e. g. GEOS, [5]).
  • set compiler flags and path. e. g.:
     # on ultra-sparc machine:
     CFLAGS="-O3 -mcpu=v9"
     CXXFLAGS="-O3 -mcpu=v9"
     PATH="/usr/local/bin:/opt/sfw/bin:/usr/ccs/bin:/usr/bin:/usr/sbin"
     export CFLAGS CXXFLAGS PATH

Path has to be changed for the packages (Sunfreeware: /usr/local/bin, Solaris Companion: /opt/sfw/bin, Blastwave: /opt/csw/bin).

  • Next configure, e. g.:
     ./configure --with-postgres-includes=/usr/include/pgsql/ \
     --with-postgres-libs=/usr/lib --with-postgres=yes \
     --with-includes=/usr/local/include/ncurses

If you use n(ew)curses, you have to include the path /usr/local/include/ncurses.

then:

     make
     su
     make install

If the shared libraries are not found at runtime of the modules, use 'crle' to add the paths of the libraries for the dynamic linker, e. g. as root:

     crle -l /lib:/usr/lib:/usr/local/lib:/opt/sfw/lib:/usr/X11/lib

Be careful not to omit a library path, the system may be unusable if you forget the /lib path.

MS-Windows

MS-Windows/Cygwin

... see here (should be moved to the Wiki)

MS-Windows/native

See new GRASS Windows Native Binary Building Guide

See also WinGRASS Current Status for latest updates.

... or see here incl. QGIS compilation (with MinGW)

Common problems and solutions

During compilation, error can occur if certain packages are not installed. Here a list of problems with solution:

  • error: X11/Xlib.h: No such file or directory
    • this suggests that you don't have the X headers installed
    • Solution: Install the libx11-dev package

Configure options and their meanings

For configure there are many options and some GRASS modules are built only if some options are set. Here are listed common configuration options with short explanation.

  • --prefix=/path - Sets path where GRASS will be installed. GRASS will reside in /path/grass-version.
  • --enable-largefile - Enables large (>2Gb on 32bit systems) support. For current large file support status look at Large File Support page.
  • --with-cxx - Enables compilation of C++ code. Required for r.terraflow module.
  • --with-readline - Enables readline support. If readline is enabled, you can use its history/editing facilities when entering r.mapcalc expressions on stdin.
  • --with-glw - Enables GLw support. The GLw library provides OpenGL "canvas" widgets for Athena and Motif.
That switch is unnecessary for normal compilation. It's only
required for r3.showdspf, which isn't normally built; if you 
want it, you have build it manually 
(e.g. "make -C raster3d/r3.showdspf").
As similar functionality is now provided by NVIZ, r3.showdspf
is deprecated.
r3.showdspf uses the Motif widget (so you also need a 
Motif library, e.g. Lesstif or OpenMotif).
Glynn Clements at GRASS-user mailing list