Version 47 (modified by 16 years ago) ( diff ) | ,
---|
Table of Contents
An overview of the dependencies required for building with MingW
We would like use a simplified approach with pre-built libraries for all the GRASS dependencies but for the moment compiling many of the dependencies is required in order to have the proper files for grass. Still, a few steps are eliminated if compilation is done within the OSGeo4W directory structure.
Install the OSGeo4W directory structure
OSGeo4W has several of the required dependencies for compiling GRASS:
- Download the OSGeo4W installer from here.
- Run the installer.
- Select Advanced Install, and Next.
- Set the install directory to c:\OSGeo4W (other directories or fine if there are no spaces in the path but make sure to adjust the instructions below (?))
- Select grass from the desktop section (this is a binary but we'll compile from source later).
- Also select:
- avce00
- fftw-devel
- freetype-devel
- freetype-devel-mingw
- gpsbabel
- gsl-libs
- gsl-devel
- libxdr
- msys
- pdcurses-devel
- tcltk-devel
- mingw-libs (contains mingw-style libraries for VC build binaries and depends on gdal, libpq, libjpeg-devel, sqlite3, libtiff, zlib, proj)
- Click next, the selected packages and their required subpackages will be downloaded and installed automatically.
Install the environment for compilation (MingW)
- Run msys (there should be an icon on the desktop)
- type:
mkdir /c/osgeo4w/apps/msys/osgeo4w
- Copy c:\osgeo4w\apps\msys\etc\fstab.sample to c:\osgeo4w\apps\msys\etc\fstab (without .sample)
- Open c:\osgeo4w\apps\msys\etc\fstab
- At line 16, change:
c:/mingw /mingw c:/ActiveState/perl /perl
To:
c:/osgeo4w/ /osgeo4w
- Download the MinGW packages:
- Unpack all to c:\osgeo4w
Pre-built Binaries
Download:
- flex from here
- bison from here
- bison-deps from here
- regex from here
- gettext-bin from here
- gettext-lib from here
- libintl-bin from here
- libintl-lib from here
Unpack all to c:\osgeo4w
Compiling and Installing GRASS (6.4.0)
Without a fix for gdal, there will be several errors... help please
- Download the latest GRASS 6.4.0 source code from here.
- Unpack to c:\osgeo4w\usr\src
- Open c:\osgeo4w\usr\src\grass64\mswindows\osgeo4w\package.sh and at line 12:
Change:
--with-libs="/c/OSGeo4W/lib /c/MinGW/lib" \ --with-includes="/c/OSGeo4W/include /c/MinGW/include" \
to:
--with-libs=/c/OSGeo4W/lib \ --with-includes=/c/OSGeo4W/include \
- To compile, type in MSYS console:
export PATH="/osgeo4w/bin:$PATH" cd /osgeo4w/usr/src/grass-6.4xxx (change to dir of the version you downloaded) ./mswindows/osgeo4w/package.sh
When finished, you should have the following compilation log (c:\osgeo4w\usr\src\grass-6.4xxx\error.log):
GRASS GIS compilation log ------------------------- Started compilation: Mon Feb 16 10:11:17 GMT 2009 -- Errors in: /usr/local/src/grass-6.4.0/raster/r.li/r.li.daemon /usr/local/src/grass-6.4.0/raster/r.li/r.li.edgedensity /usr/local/src/grass-6.4.0/raster/r.li/r.li.patchdensity /usr/local/src/grass-6.4.0/raster/r.li/r.li.patchnum /usr/local/src/grass-6.4.0/raster/r.li/r.li.shape /usr/local/src/grass-6.4.0/raster/r.li/r.li.simpson /usr/local/src/grass-6.4.0/raster/r.li/r.li.shannon /usr/local/src/grass-6.4.0/raster/r.li/r.li.mps /usr/local/src/grass-6.4.0/raster/r.li/r.li.mpa /usr/local/src/grass-6.4.0/raster/r.li/r.li.padcv /usr/local/src/grass-6.4.0/raster/r.li/r.li.padsd /usr/local/src/grass-6.4.0/raster/r.li/r.li.padrange /usr/local/src/grass-6.4.0/raster/r.li/r.li.cwed /usr/local/src/grass-6.4.0/raster/r.li/r.li.richness /usr/local/src/grass-6.4.0/raster/r.li/r.li.dominance -- In case of errors please change into the directory with error and run 'make'. If you get multiple errors, you need to deal with them in the order they appear in the error log. If you get an error building a library, you will also get errors from anything which uses the library. -- Finished compilation: Mon Feb 16 10:11:17 GMT 2009 make: *** [default] Error 1
Currently r.li.* cannot be compiled on Windows.
Now GRASS should be installed in c:\osgeo4w\apps\grass-6.4.0\
Usage
The startup grass64.bat file should be in C:\OSGeo4W\apps\grass\bin Open it and replace the contents with:
@echo off SET OSGEO4W_ROOT=C:\OSGeo4W PATH %OSGEO4W_ROOT%\bin;%PATH% for %%f in ("%OSGEO4W_ROOT%"\etc\ini\*.bat) do call "%%f" rem ######################################################################### rem # rem # GRASS Initialization rem # rem ######################################################################### set WINGISBASE=%OSGEO4W_ROOT%/apps/grass/grass-6.4xxx (change to the appropriate grass version) "%WINGISBASE%"\etc\init.bat %*
If you want to be able to use the console from within grass, you'll need a different startup file: Create C:\OSGeo4W\apps\grass\bin\grass64 with the following contents:
#! /bin/sh ############################################################################# # # MODULE: GRASS Initialization # AUTHOR(S): Justin Hickey - Thailand - jhickey@hpcc.nectec.or.th # PURPOSE: The source file for this shell script is in # lib/init/grass.src and is the grass startup script. It # requires a source file because the definition of GISBASE # is not known until compile time and is substituted from the # Makefile. Any command line options are passed to Init.sh. # COPYRIGHT: (C) 2000-2005 by the GRASS Development Team # # This program is free software under the GNU General Public # License (>=v2). Read the file COPYING that comes with GRASS # for details. # ############################################################################# trap "echo 'User break!' ; exit" 2 3 9 15 # Set the GISBASE variable GISBASE=/c/OSGeo4W/apps/grass/grass-6.4xxx (change to the appropriate grass version) export GISBASE # Set the PATH variable PATH="/osgeo4w/apps/tcl-tk/bin:$PATH" export PATH # Set the PYTHONPATH PYTHONPATH="$GISBASE/etc/python:$PYTHONPATH" exec "$GISBASE/etc/Init.sh" "$@"
TODO
Describe installations of:
- other deps?
- fix GDAL build instructions
Building with MS Visual Studio
See also
- GRASS package page in OSGeo4W (including packaging notes)
- Develop your own GRASS modules on MS-Windows
- http://wiki.qgis.org/qgiswiki/BuildingFromSource by QGIS Team
- http://www.webalice.it/marco.pasetti/grass/BuildFromSource.html by Marco Pasetti
- http://www.webalice.it/marco.pasetti/qgis+grass/BuildFromSource.html by Marco Pasetti