Compiling GRASS 5.0 on Win32 with Cygwin

(arch i686-pc-cygwin)

$Date: 2003/02/11 09:15:37 $


I describe here what i did to compile the recent CVS tree of GRASS 5.0.0 on Windows with the cygwin tools on a Windows 2000, Windows NT 4.0 or Windows XP machine.

Note that GRASS 5.0 on Win32 is still experimental, so expect some functionality missing or not working.

You need:

This text was written by Andreas Lange. Most of the text was taken out of the description from John Huddleston. Thanks to Malcolm Blue for corrections and the cygwin lists. All errors and mistakes are of course mine.

1. Get the Cygwin tools

Get the latest version from http://sources.redhat.com/cygwin/download.html.

Download the file setup.exe to a local disk, run it and follow the instructions. The setup.exe program will prompt you for one of three choices, if you never have loaded the Cygwin software, select download from internet. If you have a previous version you should know what to do. If you have never done this, it will prompt you for a directory to install the files.

If you are new to cygwin, you should look at some of the documentation available at this site.

When installing the Cygwin tools, please select all available packages, or at least:

If you install all available packages it will save you from much hassle later when you need these libraries for GRASS.

Please select for the install directory a local drive on your computer with enough space for the entire cygwin distribution (150 MB without X11R6.4), the X11R6.4 installation (additional 65 MB), the grass source code (100 MB), the object files and libraries (around 100 MB) and the grass binaries (programs, 100 MB to 150 MB)). If you want to do real work, you need at least another 500 MB for GRASS data storage.

NOTE: When selecting the root install directory, make sure that the "Default Text File Type" is set to Unix.

You need Perl for the manpage-generation with g.html2man. Perl 5.6 now is part of the contrib section, so install it with the main installation.

Now start CYGWIN (double-click the cygwin.bat). A new window will open.

2. Get the latest source code for GRASS

Get the source code from: http://grass.itc.it/grass5/source/.
Checkout either from the CVS repository (if you have CVS installed already), download the weekly snapshot or the release source packet. Or you connect to the GRASS CVS server using the cygwin cvs tool (unpack and move within cygwin to /usr/bin/).

Store the GRASS source code within the Cygwin environment (you can do that even from outside the Cygwin within the Explorer software).

Unpack the source code in any directory of your choice, e. g. in your home directory:

cd $HOME
mkdir grass.src
cd grass.src
tar xzf /path/to/file/grass5.0*_src.tar.gz

3. Install the X11 libraries and the X Server

For compiling the GRASS XDRIVER (monitors for graphical output), you need the X11 libraries. Get them from http://sources.redhat.com/cygwin/xfree/. Download at least the following packages (you find them on ftp://mirrors.rcn.net/pub/sourceware/cygwin/xfree/xc-4-binaries/4.0.3/): devel, DLLs, fonts, Prog, twm, Xterm, Xwin and updates.

Please refer to the XFree install guide for further details.

Please check out yourself the actual version and source as this changes frequently.

4. Get the tcl/tk 8.x libraries

Download the actual precompiled tcl/tk 8.x libraries and executables from
http://grass.itc.it/grass5/binary/windows_cygnus/.

Go to the root directory (cd /) and unpack this file:

  tar xzf /where/ever/you/saved/this/xtcltk-*.tar.gz

5. Some additional changes to do

Create a softlink from less to more:
ln -s /bin/less /bin/more
Otherwise the grass shell will not run correctly.

Move the ash and shell binary out of the way and create a softlink from bash to sh:

cd /bin
mv ash.exe ash.old
mv sh.exe ash.exe
ln -s bash.exe sh.exe
This fixes a problem with g.manual.

Sometimes 'libz.dll' is not found. Copy it over from /usr/X11R6/lib/libz.dll to /lib/libz.dll.

Do 'export MAKE_MODE=unix' from the command shell (sh, bash). This is usually the default, but it does not hurt to export it.

Add /usr/local/bin and /bin to your path if they are not included (echo $PATH to check, export PATH=/usr/local/bin:/usr/bin:$PATH to add). Please start the compile (see paragraph 7) from within the cygwin shell, not from a DOS/cmd shell under Windows.

For sure i have forgotten something. If a module doesn't compile, get back here and check.

6. Check the REQUIREMENTS file

Check the file REQUIREMENTS in the GRASS distribution root directory for any missing libraries and get and compile them if needed.

7. And now FINALLY to the GRASS compilation

Open a cygwin command window (cygwin shell, started with the desktop icon created by setup). From there change to the directory with the source code and start the configuration and compilation steps with the following commands:
  cd /to/source/code/of/grass
  ./configure --with-postgres=no \
    --x-includes=/usr/X11R6/include \
    --x-libraries=/usr/X11R6/lib \
    --with-tcltk-libs=/usr/local/lib \
    --with-tcltk-includes=/usr/local/include
  make
  make install
All libraries and modules that do not build correctly are listed in the file error.log. Read this file and fix the errors in the source code. Re-run make from the top source directory or proceed from the according directory of the source code with:
  gmake5
if you already installed GRASS.

Please report any problems, errors and solutions to the GRASS developers mailing list at grass5@grass.itc.it.

8. Header file creation

If you ran into compiling errors after configure'ing and make'ing (see paragraph 7), check the header file src/CMD/head/head.i686-pc-cygwin. This file was created from the template in the file src/CMD/head/head with the make command. You can find a sample header file under src/CMD/head/os-specific/head.i686-pc-cygwin.

Under some circumstances the X11 header files and libraries are not found. The X11 headers are in /usr/X11R6/include, but some stray files are in /usr/include/X11. You should rename or delete this directory, so that it is not found by configure. Please remember that you have to rename or delete this directory each time you update your cygwin installation. The lines in the GRASS header file should read:

XLIBPATH = -L/usr/X11R6/lib
XINCPATH = -I/usr/X11R6/include
and/or
XCFLAGS = -I/usr/X11R6/include

9. Running GRASS

Please read the paragraph "Starting GRASS 5" in the binary installation document.

10. This build was compiled with Cygwin 1.1.8

Read about Unix running under Windows here:

Changes to the last build/cygwin version

Perl is now part of the contrib section of cygwin. No need to create a link from /usr/local/bin/perl.exe to /usr/bin/perl with
ln -s /usr/local/bin/perl.exe /usr/bin/perl.

No need to create a shell script /bin/yacc with the contents:
#!/bin/sh
bison --yacc $@
and do a chmod a+x /usr/bin/yacc.
Configure now checks for bison too.

The ipc setup and the ipc-daemon are no longer needed, as sockets are now the default transport mechanism.

The netbpm header files are now part of the GRASS source, but netpbm-9.8 is very userful, so i recommend to install it.

The following libraries are now included in the contrib section for cygwin:

g77 is part of gcc now, so no need to install anything manually.

ncurses 5.0 is part of the cygwin distribution now (under contrib).

The check that the #define CURSORS_MAXY is not NONE and the definition of #define HAVE_CURSORS in the file src/include/config.h is already done with configure.

General problems with my build:
see sections PROBLEM in the above text,
g.html2man needs Perl, but Perl is not included in the standard Cygwin distribution (and i have only installed a Windows port of Perl).
src/fonts/for_grass: PROBLEM with the program that converts the fonts to the GRASS internal binary format (only with Win 9x, not with NT 4.0/2000).


Andreas Lange $Date: 2003/02/11 09:15:37 $