[GRASS-user] Problems with OpenGL when compiling grass-6.4.0 on Mac OS X 10.5.4

Michael Barton michael.barton at asu.edu
Sat Sep 20 16:15:05 EDT 2008


Elvis,

You can compile GRASS 6.4 with TclTk for X11 for Mac with a bit of  
tweaking, but I now recommend that you compile it for TclTk 8.5 aqua.  
You can still have X11 if you need it (e.g., for old GRASS display  
commands). TclTk 8.5 has finally solved the issues that earlier  
versions of aqua TclTk had, and both works well and looks nice. All of  
GRASS, including NVIZ will now run in aqua this way. It uses the  
native Mac OpenGL instead of the X11 OpenGL. I've worked with William  
Kyngesbury over the past month or so to work out a formula for doing  
this. Here is the information.

First, you need TclTk 8.5 aqua. You can compile it from source, but I  
recently found out that the Active States TclTk binaries will work  
fine. If you want to compile it from source, however, here are  
abbreviated instructions.

1) download TclTk 8.5.3 source (or a later version if available)
2) cd into ../tcl8.5.3/unix
3) ./configure --enable-framework --enable-threads
4) make
5) sudo make install
6) cd into ../tk8.5.3/unix
7) ./configure --enable-framework --enable-threads --enable-aqua
8) make
9) sudo make install

Next set up your Mac environment (I'm assuming an intel chip)
1) open a terminal
2) set the following environmental variables (you can leave out -g if  
you don't want debug enabled)

export CFLAGS="-arch i386 -Os -g"
export CFLAGS="-arch i386 -Os -g"
export LDFLAGS="-arch i386 -Os -g"
export NAD2BIN=/Library/Frameworks/PROJ.framework/Programs/nad2bin

Next, configure and make
1) cd into your GRASS source tree folder
2) Here is my configure string. Note: my configure string puts GRASS  
into /Applications/GRASS; you can change that with the --prefix  
setting. It also assumes that you have a current installation of  
MacPython from the python.org site and the most current version of  
wxPython installed. This is for the new GUI. If you don't want this,  
leave out the --with-python and --with-wxwidgets flags. Also note that  
with OS X 10.5 and wxPython 2.8.0 and above, you no longer need to  
install Python from the python.org site. You can just install wxPython  
and it will work fine (but you'll have to change the configure flags  
to reflect this; stuff will be in /usr/bin and /usr/lib instead of / 
usr/local/bin and /usr/local/lib).

./configure --with-freetype --with-freetype-includes="/Library/ 
Frameworks/FreeType.framework/unix/include/freetype2 /Library/ 
Frameworks/FreeType.framework/unix/include" --with-freetype-libs=/ 
Library/Frameworks/FreeType.framework/unix/lib --with-gdal=/Library/ 
Frameworks/GDAL.framework/Programs/gdal-config --with-proj --with-proj- 
includes=/Library/Frameworks/PROJ.framework/unix/include --with-proj- 
libs=/Library/Frameworks/PROJ.framework/unix/lib --with-proj-share=/ 
Library/Frameworks/PROJ.framework/Resources/proj --with-jpeg-includes=/ 
Library/Frameworks/UnixImageIO.framework/unix/include --with-jpeg- 
libs=/Library/Frameworks/UnixImageIO.framework/unix/lib --with-png- 
includes=/Library/Frameworks/UnixImageIO.framework/unix/include --with- 
png-libs=/Library/Frameworks/UnixImageIO.framework/unix/lib --with- 
tiff-includes=/Library/Frameworks/UnixImageIO.framework/unix/include -- 
with-tiff-libs=/Library/Frameworks/UnixImageIO.framework/unix/lib -- 
without-postgres --without-mysql --with-odbc --with-sqlite --with- 
sqlite-libs=/Library/Frameworks/SQLite3.framework/unix/lib --with- 
sqlite-includes=/Library/Frameworks/SQLite3.framework/unix/include -- 
with-fftw-includes=/Library/Frameworks/FFTW3.framework/unix/include -- 
with-fftw-libs=/Library/Frameworks/FFTW3.framework/unix/lib --with-x -- 
with-cxx --with-opengl=aqua --without-readline --prefix=/Applications/ 
GRASS --enable-macosx-app --with-python=/usr/local/bin/python-config -- 
with-wxwidgets=/usr/local/lib/wxPython-unicode-2.8.8.1/bin/wx-config -- 
with-tcltk-includes="/Library/Frameworks/Tcl.framework/Headers / 
Library/Frameworks/Tk.framework/Headers /Library/Frameworks/ 
Tk.framework/PrivateHeaders"

3) run make


Finally, make some final adjustments for aqua and install GRASS. Do  
this AFTER running make

1) In the GRASS source tree, edit the tcltklibs line in ../include/ 
make/platform.make

It will read...

TCLTKLIBS = -Tcl -Tk

Change it to read...

TCLTKLIBS = -framework Tcl -framework Tk

2) run sudo make install


Let us know how it goes
Michael


On Sep 20, 2008, at 11:09 AM, <grass-user-request at lists.osgeo.org>  
wrote:

> Message: 1
> Date: Sat, 20 Sep 2008 21:08:34 +0400
> From: Elvis Dowson <elvis.dowson at mac.com>
> Subject: [GRASS-user] Problems with OpenGL when compiling grass-6.4.0
> 	on Mac	OS X 10.5.4
> To: GRASS User <grass-user at lists.osgeo.org>
> Message-ID: <6B34E8FB-908F-4933-8D4C-5EE0D152545D at mac.com>
> Content-Type: text/plain; charset="us-ascii"
>
> Hi,
>          I just downloaded the latest svn snapshot of grass-6.4.0,
> installed all the required libraries
> proj-4.6.0
> gdal-1.5.2
> libjpeg-6b
> libtiff-3.8.2
> libpng-1.2.31
> fftw-2.1.5
>
> and fixed the X11 OpenGL problem on Mac OS X 10.5.4 as outlined below:
>
> X11 is broken on Leopard, it is impossible to compile programs against
> it (more precisely whenever libGL is touched - directly or
> indirectly). The easiest way to fix it is as follows:
>
> cd /usr/X11/lib
> sudo bash
> # enter your password
> mv libGL.dylib libGL.dylib.apple
> ln -s /System/Library/Frameworks/OpenGL.framework/Libraries/
> libGL.dylib .
>
> This fixed the problem of ./configure being able to locate the OpenGL
> libraries.
>
> However, when I try to make the program, I get more errors related to
> OpenGL.



More information about the grass-user mailing list