[GRASS-dev] Re: [GRASS-windows] Compile r.example for GRASS6.4 in Windows

Glynn Clements glynn at gclements.plus.com
Wed Nov 18 11:15:43 EST 2009

António Rocha wrote:

> ERRORLOG        = /c/grass6

Note: this needs to refer to a file, not a directory. The default is

> 5- Then I was getting this error, with a few other small
> *** No rule to make target `/c/grass6/lib/libgrass_gis.dll', needed by
> 6- Markus suggested me to make a copy of libgrass_gis.6.4.0svn.dll with 
> the name libgrass_gis.dll.

Ah. On Unix, the libraries include the version number, and symlinks
are created without the version number. Windows doesn't have symlinks,
so MSys' "ln -s ..." simply copies the file. Presumably the OSGeo4W
installer omits the unversioned files to save space. This will prevent
you from being able to build modules against the libraries, so you
will need to manually make copies without the version number.

We need to come up with a solution for this. Options include:

1. Omitting the version number altogether on Windows.
2. Creating linker scripts[*] on Windows, in place of the symlinks.
3. Creating import libraries on Windows, in place of the symlinks.
4. Including both versioned and unversioned DLLs in the Windows installer.
5. Including the version number in the -l switch.

[*] I don't know whether MinGW actually supports linker scripts.

> 7- And after this I got this error:

> gcc.exe: c:/grass6/lib/gis/OBJ./fmode.o: No such file or directory

Does fmode.o exist anywhere in c:/grass6?

If it does, you can override the location with e.g.:

	make ... FMODE_OBJ=/path/to/fmode.o

If it doesn't, you'll need to create it first. The source file
(fmode.c) is just:

	#include <stdlib.h>
	#include <fcntl.h>
	#undef _fmode
	int _fmode = _O_BINARY;

You can compile it with "gcc -c fmode.c".

In 7.0, the fmode.o file is created as $(GISBASE)/lib/fmode.o, so it
should be included in binary packages.

> make: *** [/c/grass6/bin/r.example.exe] Error 1
> make: Leaving directory `/c/grass6/tests/r.example'
> At C:/grass6/tests/r.example a new folder was created "OBJ "  with the 
> file main.o.

This indicates that the source code compiled but couldn't be linked.

> Question? What else Should I do or what am I doing wrong?

You aren't doing anything wrong here. Both of the above problems are a
result of the Windows binary packages for GRASS 6.x being incomplete.

Unfortunately, we don't have any "active" Windows developers. 
Occasionally people will build Windows packages or run specific tests
on Windows, but the active developers are all using Linux or MacOSX as
their main platform.

Also, some of the things which cause problems on Windows (e.g. relying
upon shell scripts) can't easily be fixed in 6.x. In 7.0, we are less
worried about compatibility, so it's easier to change things.

In 6.x, building modules against an installed version of GRASS still
isn't ideal even on Unix, and most things are a bit more trouble on
Windows than they are on Unix.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list