wiki:CompileOnWindows

Version 53 (modified by cnielsen, 16 years ago) ( diff )

Fixed intro and headings

Dependencies required for building with MinGW

Compiling your own copy of GRASS is greatly simplified by using the OSGeo4W directory structure to install most dependencies and downloading the rest from a few other locations. Follow the steps below to set up the build environment for GRASS.

Install the OSGeo4W directory structure

OSGeo4W has several of the required dependencies for compiling GRASS:

  1. Download the OSGeo4W installer from here.
  1. Run the installer.
  1. Select Advanced Install, and Next.
  1. 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 (?))
  1. Select grass from the desktop section (this is a binary but we'll compile from source later).
  1. Also select:
    • avce00
    • fftw-devel
    • freetype-devel
    • freetype-devel-mingw
    • gpsbabel
    • gsl-libs
    • gsl-devel
    • libpng-devel
    • libpng-devel-mingw
    • libtiff-devel
    • libxdr
    • mingw-libs (contains mingw-style libraries for VC build binaries and depends on gdal, libpq, libjpeg-devel, sqlite3, libtiff, zlib, proj)
    • pdcurses-devel
    • tcltk-devel
    • zlib-devel
  1. Click next, the selected packages and their required subpackages will be downloaded and installed automatically.

Install the environment for compilation (MingW)

  1. Run msys (there should be an icon on the desktop)
  1. type:
     mkdir /c/osgeo4w/apps/msys/osgeo4w
    
  2. Copy c:\osgeo4w\apps\msys\etc\fstab.sample to c:\osgeo4w\apps\msys\etc\fstab (without .sample)
  1. Open c:\osgeo4w\apps\msys\etc\fstab
  1. At line 16, change:
    c:/mingw		/mingw
    c:/ActiveState/perl	/perl
    

To:

c:/osgeo4w/	/osgeo4w
  1. Download the MinGW packages:
  1. Unpack all to c:\osgeo4w

Pre-built Binaries

Download:

Unpack all to c:\osgeo4w

Compiling and Installing GRASS (6.4.0)

  1. Download the latest GRASS 6.4.0 source code from here.
  1. Unpack to c:\osgeo4w\usr\src
  1. 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 \
  1. 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, but grass will run fine without them.

  1. Because of these errors in the install script stops. To finish it type:
    make install
    

Now GRASS should be installed in c:\osgeo4w\apps\grass-6.4.0\

Usage

To start grass use the icon on the desktop.

OR, if you want to be able to use the command line from within grass, you'll need a different start-up file.

  1. Open C:\OSGeo4W\apps\grass\bin\grass64 and at line 24 add:
    # Set the PYTHONPATH
    PYTHONPATH="$GISBASE/etc/python:$PYTHONPATH"
    
  1. To start grass, type in MSYS console:
    /osgeo4w/apps/grass/bin/grass64
    

Or to use the new wxpython GUI:

/osgeo4w/apps/grass/bin/grass64 -wxpython

TODO

Building with MS Visual Studio

See also

Note: See TracWiki for help on using the wiki.