[GRASS-dev] nvizlib compile error

I get an error trying to compile lib/nviz on a Debian system with a fresh SVN checkout of trunk:

"~/SRC/GRASS/grass_trunk/lib/nviz$ make
gcc -I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include -Wall -g -O2 -fPIC -DPACKAGE=\""grasslibs"\" -I/usr/include -DPACKAGE=\""grasslibs"\" -I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include -o OBJ.i486-pc-linux-gnu/cplanes_obj.o -c cplanes_obj.c
In file included from cplanes_obj.c:19:
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/nviz.h:31:4: error: #error Unsupported platform, or confused platform defines...
In file included from cplanes_obj.c:19:
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/nviz.h:113: error: expected specifier-qualifier-list before ‘Display’
make: *** [OBJ.i486-pc-linux-gnu/cplanes_obj.o] Erreur 1"

- configure output shows:

checking for location of OpenGL library...
checking for glBegin in -lGL... yes
checking for gluBeginCurve in -lGLU... yes
checking for glXCreatePbuffer... yes
checking for glXCreateGLXPixmap... yes
[...]
OpenGL support: yes

Moritz

Hi,

2008/7/8 Moritz Lennert <mlennert@club.worldonline.be>:

I get an error trying to compile lib/nviz on a Debian system with a fresh
SVN checkout of trunk:

"~/SRC/GRASS/grass_trunk/lib/nviz$ make
gcc -I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include
-Wall -g -O2 -fPIC -DPACKAGE=\""grasslibs"\" -I/usr/include
-DPACKAGE=\""grasslibs"\"
-I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include -o
OBJ.i486-pc-linux-gnu/cplanes_obj.o -c cplanes_obj.c
In file included from cplanes_obj.c:19:
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/nviz.h:31:4:
error: #error Unsupported platform, or confused platform defines...
In file included from cplanes_obj.c:19:
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/nviz.h:113:
error: expected specifier-qualifier-list before 'Display'
make: *** [OBJ.i486-pc-linux-gnu/cplanes_obj.o] Erreur 1"

- configure output shows:

checking for location of OpenGL library...
checking for glBegin in -lGL... yes
checking for gluBeginCurve in -lGLU... yes
checking for glXCreatePbuffer... yes
checking for glXCreateGLXPixmap... yes
[...]
OpenGL support: yes

should be fixed,

http://trac.osgeo.org/grass/changeset/32051

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *

On 08/07/08 19:41, Martin Landa wrote:

Hi,

2008/7/8 Moritz Lennert <mlennert@club.worldonline.be>:

I get an error trying to compile lib/nviz on a Debian system with a fresh
SVN checkout of trunk:

"~/SRC/GRASS/grass_trunk/lib/nviz$ make
gcc -I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include
-Wall -g -O2 -fPIC -DPACKAGE=\""grasslibs"\" -I/usr/include
-DPACKAGE=\""grasslibs"\"
-I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include -o
OBJ.i486-pc-linux-gnu/cplanes_obj.o -c cplanes_obj.c
In file included from cplanes_obj.c:19:
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/nviz.h:31:4:
error: #error Unsupported platform, or confused platform defines...
In file included from cplanes_obj.c:19:
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/nviz.h:113:
error: expected specifier-qualifier-list before 'Display'
make: *** [OBJ.i486-pc-linux-gnu/cplanes_obj.o] Erreur 1"

- configure output shows:

checking for location of OpenGL library...
checking for glBegin in -lGL... yes
checking for gluBeginCurve in -lGLU... yes
checking for glXCreatePbuffer... yes
checking for glXCreateGLXPixmap... yes
[...]
OpenGL support: yes

should be fixed,

http://trac.osgeo.org/grass/changeset/32051

Now it compiles, but when I display the elevation map from the NC data set and then chose the nviz tool in the map display, the entire wx gui crashes...

...

Just found out why: it's a locale problem. LANG is set to fr_BE.UTF-8 on my system. When I set it to C nviz runs (great job !!), but when I leave the default setting, wxgrass crashes and I get the following error in the terminal window where I launch g.gui:

GRASS_INFO_ERROR(22238,1): région pour le jeu de données (mapset) courant ligne 1: <n-s resol: 29.349241>

GRASS_INFO_ERROR(22238,1): lancer "g.region"
GRASS_INFO_END(22238,1)

Moritz

Hi,

2008/7/8 Moritz Lennert <mlennert@club.worldonline.be>:

Now it compiles, but when I display the elevation map from the NC data set
and then chose the nviz tool in the map display, the entire wx gui
crashes...
Just found out why: it's a locale problem. LANG is set to fr_BE.UTF-8 on my
system. When I set it to C nviz runs (great job !!), but when I leave the
default setting, wxgrass crashes and I get the following error in the
terminal window where I launch g.gui:

GRASS_INFO_ERROR(22238,1): région pour le jeu de données (mapset) courant
ligne 1: <n-s resol: 29.349241>

GRASS_INFO_ERROR(22238,1): lancer "g.region"
GRASS_INFO_END(22238,1)

right, it crashes when LC_NUMERIC != "C", calling G_scan_resolution()

http://trac.osgeo.org/grass/browser/grass/trunk/lib/gis/rd_cellhd.c#L258

quick fix

http://trac.osgeo.org/grass/changeset/32063

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *

Martin Landa wrote:

> Now it compiles, but when I display the elevation map from the NC data set
> and then chose the nviz tool in the map display, the entire wx gui
> crashes...
> Just found out why: it's a locale problem. LANG is set to fr_BE.UTF-8 on my
> system. When I set it to C nviz runs (great job !!), but when I leave the
> default setting, wxgrass crashes and I get the following error in the
> terminal window where I launch g.gui:
>
> GRASS_INFO_ERROR(22238,1): région pour le jeu de données (mapset) courant
> ligne 1: <n-s resol: 29.349241>
>
> GRASS_INFO_ERROR(22238,1): lancer "g.region"
> GRASS_INFO_END(22238,1)

right, it crashes when LC_NUMERIC != "C", calling G_scan_resolution()

LC_NUMERIC affects the format which scanf("%f") etc understands. If
it's set to a locale which uses a comma as the decimal separator, any
GRASS function which tries to read floating-point values which use a
period (i.e. many of GRASS' internal file formats) will fail.

This isn't a problem for normal GRASS modules, as GRASS modules (and
library functions) never call setlocale(LC_NUMERIC). It is a problem
if you're using GRASS library functions from within a program which
sets LC_NUMERIC from the environment (I suspect that this includes the
Python interpreter).

http://trac.osgeo.org/grass/browser/grass/trunk/lib/gis/rd_cellhd.c#L258

quick fix

http://trac.osgeo.org/grass/changeset/32063

A more general fix would be to call setlocale(LC_NUMERIC,"C") from
e.g. gisinit() (in lib/gis/gisinit.c). Otherwise, we will probably end
up running into this issue repeatedly.

--
Glynn Clements <glynn@gclements.plus.com>

Hi,

2008/7/10 Glynn Clements <glynn@gclements.plus.com>:

[...]

http://trac.osgeo.org/grass/browser/grass/trunk/lib/gis/rd_cellhd.c#L258

quick fix

http://trac.osgeo.org/grass/changeset/32063

A more general fix would be to call setlocale(LC_NUMERIC,"C") from
e.g. gisinit() (in lib/gis/gisinit.c). Otherwise, we will probably end
up running into this issue repeatedly.

done

http://trac.osgeo.org/grass/changeset/32078

and

http://trac.osgeo.org/grass/changeset/32079

M.

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *