[GRASS5] GMSL/g3d error on OSX compile

I'm building GRASS53 on Mac OSX. Here is my configure script:
./configure \
--with-postgres-includes=/sw/include/postgresql \
--with-postgres-libs=/sw/lib/postgresql \
--with-gdal=/usr/local/bin/gdal-config \
--with-includes=/sw/include \
--with-libs=/sw/lib \
--with-opengl-includes=/usr/X11R6/include \
--with-readline \
--with-proj

I'm getting an error:
Compilation error in module: src.contrib/GMSL/g3d (ignored)

Running gmake5 on /src.contrib/GMSL/g3d/src3d/raster/ gives:
showdspf.openGL
#################################################################
/Users/kirkw/tmp/grass53_exp_2003_12_06/src.contrib/GMSL/g3d/src3d/raster/r3.showdspf.openGL
   make -f OBJ.powerpc-apple-darwin7.0.0/make.rules

gcc -I/Users/kirkw/tmp/grass53_exp_2003_12_06/src/include -I/sw/include -g -O2 -I/sw/include -I/Users/kirkw/tmp/grass53_exp_2003_12_06/src/libes/dspf -I/Users/kirkw/tmp/grass53_exp_2003_12_06/src/libes/ogsf -I/usr/X11R6/include -I/usr/X11R6/include -c main_ogl.c -o OBJ.powerpc-apple-darwin7.0.0/main_ogl.o
In file included from main_ogl.c:20:
kns_defines.h:4: error: parse error before "GLXContext"
kns_defines.h:4: warning: no semicolon at end of struct or union
kns_defines.h:13: error: parse error before '}' token
kns_defines.h:13: warning: data definition has no type or storage class
In file included from main_ogl.c:21:
kns_globals.h:11: error: parse error before "MainOGLWindow"
kns_globals.h:11: warning: data definition has no type or storage class
kns_globals.h:12: error: parse error before "ColormapWindow"
kns_globals.h:12: warning: data definition has no type or storage class
main_ogl.c: In function `main':
main_ogl.c:131: warning: passing arg 1 of `G3d_setErrorFun' from incompatible pointer type
make[3]: *** [OBJ.powerpc-apple-darwin7.0.0/main_ogl.o] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all] Error 1
make: *** [all] Error 2
truffula:~/tmp/grass53_exp_2003_12_06/src.contrib/GMSL/g3d kirkw$

Can this be fixed by trying to compile with GLX or MOTIF? Or is this just not a big deal?

Thanks,

Kirk

Kirk R. Wythers wrote:

I'm building GRASS53 on Mac OSX. Here is my configure script:
./configure \
--with-postgres-includes=/sw/include/postgresql \
--with-postgres-libs=/sw/lib/postgresql \
--with-gdal=/usr/local/bin/gdal-config \
--with-includes=/sw/include \
--with-libs=/sw/lib \
--with-opengl-includes=/usr/X11R6/include \
--with-readline \
--with-proj

You also need to use the --with-glw and --with-motif switches, and
possibly the corresponding --with-*-includes= and/or --with-*-libs=
switches.

Also, you need to have both GLw and Motif installed. GLw is included
with recent versions of XFree86 (e.g. /usr/X11R6/lib/libGLwM.a), and
is also available from Mesa (http://mesa3d.sourceforge.net/).

For Motif, you could try LessTif (http://www.lesstif.org/), although I
don't know whether it will be sufficiently compatible. Commercial Unix
implementations normally include Motif; Linux users can use OpenMotif,
which is free, but only for "Open Source" operating systems.

I'm getting an error:
Compilation error in module: src.contrib/GMSL/g3d (ignored)

Running gmake5 on /src.contrib/GMSL/g3d/src3d/raster/ gives:
showdspf.openGL
#################################################################
/Users/kirkw/tmp/grass53_exp_2003_12_06/src.contrib/GMSL/g3d/src3d/
raster/r3.showdspf.openGL
   make -f OBJ.powerpc-apple-darwin7.0.0/make.rules

gcc -I/Users/kirkw/tmp/grass53_exp_2003_12_06/src/include -I/sw/include
-g -O2 -I/sw/include
-I/Users/kirkw/tmp/grass53_exp_2003_12_06/src/libes/dspf
-I/Users/kirkw/tmp/grass53_exp_2003_12_06/src/libes/ogsf
-I/usr/X11R6/include -I/usr/X11R6/include -c main_ogl.c -o
OBJ.powerpc-apple-darwin7.0.0/main_ogl.o
In file included from main_ogl.c:20:
kns_defines.h:4: error: parse error before "GLXContext"

Not using --with-glw will cause this.

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

It has worked for me on OS X using the two extra switches Glynn mentioned, with lesstif from fink - that should get found from your generic --with-includes and --with-libs lines - and your opengl-includes line will take care of finding the GLw stuff.

Scott

On 10-Dec-03, at 12:14, Glynn Clements wrote:

Kirk R. Wythers wrote:

I'm building GRASS53 on Mac OSX. Here is my configure script:
./configure \
--with-postgres-includes=/sw/include/postgresql \
--with-postgres-libs=/sw/lib/postgresql \
--with-gdal=/usr/local/bin/gdal-config \
--with-includes=/sw/include \
--with-libs=/sw/lib \
--with-opengl-includes=/usr/X11R6/include \
--with-readline \
--with-proj

You also need to use the --with-glw and --with-motif switches, and
possibly the corresponding --with-*-includes= and/or --with-*-libs=
switches.

Also, you need to have both GLw and Motif installed. GLw is included
with recent versions of XFree86 (e.g. /usr/X11R6/lib/libGLwM.a), and
is also available from Mesa (http://mesa3d.sourceforge.net/).

For Motif, you could try LessTif (http://www.lesstif.org/), although I
don't know whether it will be sufficiently compatible. Commercial Unix
implementations normally include Motif; Linux users can use OpenMotif,
which is free, but only for "Open Source" operating systems.

------
Scott W. Mitchell Scott_Mitchell@carleton.ca
Department of Geography and Environmental Studies
Carleton University, B349 Loeb Building (Office A209)
1125 Colonel By Drive, Ottawa, ON Canada K1S 5B6
+1-613-520-2600 ext 2695 Fax: 1-613-520-4301

Yes, --with-glw --with-motif --with-*-includes= --with-*-libs= works.

I've successfully built this with LessTif installed, tho I haven't tested it yet.

Strangely, now that I look at it again, tho I find libGLw.a (it comes with Apple's X11), I see that configure failed to find GLw because _GLwCreateMDrawingArea was missing (it finds the GLw headers). There are _GLwCreateM1DrawingArea and _GLwCreateM2DrawingArea though, and GLwCreateMDrawingArea is #defined in GLwDrawA.h to be one of those depending on the Motif version. So maybe the configure test needs work? Or is Apple's GLw buggered? Yet showdspf.openGL compiled successfully.

On Dec 10, 2003, at 11:14 AM, Glynn Clements wrote:

You also need to use the --with-glw and --with-motif switches, and
possibly the corresponding --with-*-includes= and/or --with-*-libs=
switches.

Also, you need to have both GLw and Motif installed. GLw is included
with recent versions of XFree86 (e.g. /usr/X11R6/lib/libGLwM.a), and
is also available from Mesa (http://mesa3d.sourceforge.net/).

For Motif, you could try LessTif (http://www.lesstif.org/), although I
don't know whether it will be sufficiently compatible. Commercial Unix
implementations normally include Motif; Linux users can use OpenMotif,
which is free, but only for "Open Source" operating systems.

-----
William Kyngesburye <kyngchaos@charter.net>
http://webpages.charter.net/kyngchaos/

"I ache, therefore I am. Or in my case - I am, therefore I ache."

- Marvin

William K wrote:

Yes, --with-glw --with-motif --with-*-includes= --with-*-libs= works.

I've successfully built this with LessTif installed, tho I haven't
tested it yet.

Strangely, now that I look at it again, tho I find libGLw.a (it comes
with Apple's X11),

Depending upon the implementation, you may need libGLwM.a rather than
libGLw.a. Some implementations put both the Motif and generic versions
of the widgets in the same library, while some split them into
separate libraries. If you have separate libraries, it's libGLwM.a
that's relevant.

I see that configure failed to find GLw because
_GLwCreateMDrawingArea was missing (it finds the GLw headers). There
are _GLwCreateM1DrawingArea and _GLwCreateM2DrawingArea though, and
GLwCreateMDrawingArea is #defined in GLwDrawA.h to be one of those
depending on the Motif version. So maybe the configure test needs
work?

The actual configure check is:

LOC_CHECK_LIBS(GLw, GLwCreateMDrawingArea, GLwM,$LGLWM $XMLIB $OPENGL_LIB_PATH,LGLWM,$X_LIBS $OPENGLLIB -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS,[
LOC_CHECK_LIBS(GLw, GLwCreateM1DrawingArea,GLwM,$LGLWM $XMLIB $OPENGL_LIB_PATH,LGLWM,$X_LIBS $OPENGLLIB -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS,[
LOC_CHECK_LIBS(GLw, GLwCreateM2DrawingArea,GLwM,$LGLWM $XMLIB $OPENGL_LIB_PATH,LGLWM,$X_LIBS $OPENGLLIB -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS,[
LOC_CHECK_LIBS(GLwM, GLwCreateMDrawingArea, GLwM,$LGLWM $XMLIB $OPENGL_LIB_PATH,LGLWM,$X_LIBS $OPENGLLIB -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS,[
LOC_CHECK_LIBS(GLwM, GLwCreateM1DrawingArea,GLwM,$LGLWM $XMLIB $OPENGL_LIB_PATH,LGLWM,$X_LIBS $OPENGLLIB -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS,[
LOC_CHECK_LIBS(GLwM, GLwCreateM2DrawingArea,GLwM,$LGLWM $XMLIB $OPENGL_LIB_PATH,LGLWM,$X_LIBS $OPENGLLIB -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS,[
LOC_CHECK_LIBS(MesaGLw, GLwCreateMDrawingArea, GLwM,$LGLWM $XMLIB $OPENGL_LIB_PATH,LGLWM,$X_LIBS $OPENGLLIB -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS,[
LOC_CHECK_LIBS(MesaGLwM,GLwCreateMDrawingArea, GLwM,$LGLWM $XMLIB $OPENGL_LIB_PATH,LGLWM,$X_LIBS $OPENGLLIB -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS,[
], $OPENGLULIB)
], $OPENGLULIB)
])
])
])
])
])
])

Or is Apple's GLw buggered? Yet showdspf.openGL compiled
successfully.

In which case, the check succeeded.

If you have GLwCreateM1DrawingArea and GLwCreateM2DrawingArea in
libGLw.a (this is the case for the XFree86 version), the first attempt
will fail, but the second attempt will succeed.

The configure output will look like:

  checking for GLwCreateMDrawingArea in -lGLw... no
  checking for GLwCreateM1DrawingArea in -lGLw... yes

If the check failed, you would get:

  checking for GLwCreateMDrawingArea in -lGLw... no
  checking for GLwCreateM1DrawingArea in -lGLw... no
  checking for GLwCreateM2DrawingArea in -lGLw... no
  checking for GLwCreateMDrawingArea in -lGLwM... no
  checking for GLwCreateM1DrawingArea in -lGLwM... no
  checking for GLwCreateM2DrawingArea in -lGLwM... no
  checking for GLwCreateMDrawingArea in -lMesaGLw... no
  checking for GLwCreateMDrawingArea in -lMesaGLwM... no
  configure: error: *** Unable to locate GLwM library.

at which point, configure would terminate.

The individual configure checks are succeed/fail predicates. They run
a command, and do one thing if it succeeds and something else if it
fails.

Anything which doesn't fit the pattern of "check that this works; if
it doesn't, abort with an error" involves multiple checks. Each check
tries a single "candidate" command. If it succeeds, the remaining
checks are skipped; if it fails, it proceeds to the next check. If
none of the candidates work, configure aborts with an error.

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

[looking at the log again]

On Dec 10, 2003, at 6:44 PM, Glynn Clements wrote:

Or is Apple's GLw buggered? Yet showdspf.openGL compiled
successfully.

In which case, the check succeeded.

If you have GLwCreateM1DrawingArea and GLwCreateM2DrawingArea in
libGLw.a (this is the case for the XFree86 version), the first attempt
will fail, but the second attempt will succeed.

The configure output will look like:

  checking for GLwCreateMDrawingArea in -lGLw... no
  checking for GLwCreateM1DrawingArea in -lGLw... yes

Yep, there it is (tucked away between some warnings I need to look into - I think I need to leave Apple's freetype alone ^_^):

  configure:10777: checking for GLwCreateM1DrawingArea in -lGLw

after the first one failed, and no failure after this one.

-----
William Kyngesburye <kyngchaos@charter.net>
http://webpages.charter.net/kyngchaos/

All generalizations are dangerous, even this one.

Strangely, now that I look at it again, tho I find libGLw.a (it comes
with Apple's X11), I see that configure failed to find GLw because
_GLwCreateMDrawingArea was missing (it finds the GLw headers). There
are _GLwCreateM1DrawingArea and _GLwCreateM2DrawingArea though, and
GLwCreateMDrawingArea is #defined in GLwDrawA.h to be one of those
depending on the Motif version. So maybe the configure test needs
work? Or is Apple's GLw buggered? Yet showdspf.openGL compiled
successfully.

Yes saw this yesterday before installing lesstif. It found GLw in the
first place it looked, but the test compile failed because of the
missing motif stuff. Then it couldn't find another GLw & went on..
After installing lesstif from Fink, all was well.

### GRASS 5.3 compile on Max OSX 10.3 ###

Needed fink packages for a compile:
  (maybe missed some)
fftw
freetype2
g77
lesstif
libjpeg
libpng3
libtiff
readline
unixodbc2

If you want postgres try unstable or the postgres-ssl package.
You should install PROJ.4 and GDAL to /usr/local somehow too..

Download latest GRASS 5.3-CVS snapshot,
mkdir ~/src
cd ~/src
tar xzf ~/Desktop/grass53_cvs_DATE.tar.gz
mv grass53_cvs_DATE grass53/
cd grass53/
cvs login
pw:grass
cvs -z3 update -dP

# this is about as concise/correct as I could get it:

CFLAGS="-Wall" LDFLAGS="-s" ./configure \
  --enable-shared \
  --with-includes="/usr/X11R6/include /sw/include" \
  --with-libs="/usr/X11R6/lib /sw/lib" \
  --without-gd --without-proj --without-postgres \
  --with-gdal --with-readline --with-glw \
  --with-motif --with-cxx --with-odbc \
  --with-freetype --with-freetype-includes=/usr/X11R6/include/freetype2

# again, it might be a good idea to include proj & postgres support
# maybe use --with-freetype-includes=/sw/include/freetype2
# r.terraflow will fail so --with-cxx is currently useless

make
make install # as root

happy building,
Hamish