[GRASSLIST:1636] Re: grass-5.0.3rc5 on cygwin

Glynn Clements glynn.clements at virgin.net
Sat Nov 1 03:02:14 EST 2003


Richard Greenwood wrote:

> I've compiled 5.0.3rc5 on cygwin, but on starting a monitor I get:
> 
>     Socket is already in use or not accepting connections.
>     Use d.mon to select a monitor
>     Problem selecting x0. Will try once more
>     Socket is already in use or not accepting connections.
>     Use d.mon to select a monitor
> 
> I've compiled 5.0.2 from CVS and I get the same error.
> 
> However I compiled 5.7 from 9/27 CVS snapshot and monitors run properly, 
> and I have a 5.0.2 Xwin installed from binary which runs properly.

1. Which version of Windows?

2. Did you use the --enable-w11 configure switch?

Without --enable-w11, XDRIVER generally crashes on the DOS-based
versions of Windows (95/98/ME); NT variants (NT/2K/XP) are reported to
work, but this may depend upon the specific versions of Windows and/or
Cygwin in use.

If you want to build a "real" (i.e. not libW11) X11 version of XDRIVER
for 95/98/ME, you have to manually add -D__W98__ to CFLAGS when
configuring, e.g.:

	CFLAGS='-g -O2 -D__W98__' ./configure ...

The --enable-w98 switch defines __W98__ automatically, but it also
uses libW11 for XDRIVER (i.e. produces the "generic" version). The
__W98__ macro is used by mon.start (src/display/d.mon/pgms/start.c),
and has two effects:

1. XDRIVER is started using the Windows spawnl() function rather than
the Unix execl() function.

2. The second argument to XDRIVER is a dash, which prevents XDRIVER
from going into the background with fork() (spawnl(_P_DETACH,...) is
equivalent to a combined fork()+exec()).

This feature was originally added for the wingrass_generic (libW11)
version, but can be used to work around what appears to be a bug in
either Cygwin's fork() or in their X libraries.

> Unfortunately I am not smart enough to know where to even begin looking for 
> the source(s) of my errors, so any pointers would be appreciated.

You can start XDRIVER manually using e.g.

	$GISBASE/driver/XDRIVER x0 - ""

(three arguments; the first is the name, the second is a dash, the
third is ignored but must be present). If this works, but using:

	$GISBASE/driver/XDRIVER x0 "" ""

(i.e. an empty second argument in place of the dash) doesn't,
rebuilding mon.start with -D__W98__ should cure it.

 Assuming that XDRIVER is
crashing on startup, starting it manually may provide more information
as to why. Better still, run it under GDB, e.g.

	$ gdb $GISBASE/driver/XDRIVER
	gdb> run x0 - ""
	[crashes e.g. due to "Segmentation fault".]
	gdb> where

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-user mailing list