[GRASS-dev] 6.2.2 RC1, Mac .app compilation, & Tcl/Tk

William Kyngesburye woklist at kyngchaos.com
Wed May 30 10:27:33 EDT 2007

On May 30, 2007, at 7:52 AM, Scott Mitchell wrote:

> I have tended to stick with the "unix version" of GRASS on my  
> Macs.  I have occasionally played with either William's binaries  
> (kyngchaos.com), or compiling from source with the --enable-macosx- 
> app option, but I've never used these versions much beyond quick  
> tests, since I work a lot over network connections in a mixed Linux/ 
> Mac environment.
You can start the .app GRASS from the Terminal with /Applications/ 
GRASS-[version].app/Contents/Resources/grass.sh.  This is the  
equivalent of grass62 in the unix build.

> Once or twice I ran into troubles with the "wish not behaving as  
> expected" error on startup with the .app versions, but never really  
> explored this, just went back to my working versions.

Could be the TclTk symlink problem below.

> So for 6.2.2 RC1, I just tried compiling with the following:
> branford:~/src/grass-6.2.2RC1 smitchl$ ./configure  --prefix=/ 
> Applications --enable-macosx-app '--with-libs=/usr/X11R6/lib / 
> Library/Frameworks/UnixImageIO.framework/unix/lib /sw/lib' '--with- 
> includes=/usr/X11R6/include /Library/Frameworks/ 
> UnixImageIO.framework/unix/include /sw/include' --with-freetype -- 
> with-freetype-includes=/Library/Frameworks/FreeType.framework/unix/ 
> include --with-freetype-libs=/Library/Frameworks/FreeType.framework/ 
> unix/lib --with-gdal=/usr/local/bin/gdal-config --with-motif --with- 
> postgres-includes=/sw/include/postgresql --with-odbc --with-fftw- 
> includes=/Library/Frameworks/FFTW3.framework/unix/include --with- 
> fftw-libs=/Library/Frameworks/FFTW3.framework/unix/lib --with- 
> sqlite --with-python --with-proj=/usr/local --with-cxx --with-tcltk- 
> includes=/sw/include --with-tcltk-libs=/sw/lib
Quite a mix of stuff there.  A possible problem is the global libs/ 
includes option, especially as it includes Fink (/sw) - that could  
short circuit more specific options like FreeType and FFTW, and link  
other installed copies.  It makes a longer configure command, but I  
prefer to leave -libs and -includes as a last resort and specify  
every option.

Note: since you're using my FreeType, FFTW and UnixImageIO  
frameworks, have you considered the rest - GDAL, PROJ and SQLite3?

> What I've ended up with, though, is a "unix version" installed  
> under /Applications/grass-6.2.2RC1 instead of an .app/  -- I'm  
> assuming this is because I specified "unix" tcltk (on this machine,  
> installed through fink, so it's in /sw).
The OSX .app build is not in 6.2.  So that will still be a unix  
build.  Nothing to do with using X11 TclTk.  It seemed like a new  
feature, and so not appropriate to add to 6.2.

> It seems to work fine, with the exception of nviz, which generates:
> Exception:  EXC_BAD_ACCESS (0x0001)
> Codes:      KERN_INVALID_ADDRESS (0x0001) at 0x5c637273
> I just recompiled a "normal" build into /usr/local, and it too gets  
> a segmentation error launching nviz.  Hmm... I'll have to delve  
> into that further.
I found an odd build issue with the X11 TclTk - it does not add the  
unversioned symlinks to the libraries (libtcl.dylib, libtk.dylib).   
So when linking to nviz (-ltcl -ltk) it doesn't find those and moves  
on to link the system's tcltk, which doesn't work.

Add the symlinks to your tcltk build and try building GRASS again.  I  
see your tcltk is in /sw, so:

sudo ln -sf libtcl8.4.dylib /sw/lib/libtcl.dylib
sudo ln -sf libtk8.4.dylib /sw/lib/libtk.dylib

If that's already OK, then maybe it's something that Fink is doing  
with the build?

> In the meantime, I'm wondering:
> (1) Am I correct in inferring that if one wants a .app build, one  
> needs to use the Aqua Tcl/Tk (i.e. don't specify a unix/X11 version  
> for the tcltk includes and libs) ?
> 	(a) if that's correct, does the Apple stock distribution work, or  
> does it work
> 		for all except nviz?
> 	(b) if that's not correct, what went wrong in my build
>               - i.e. why didn't I get an .app?
No.  The .app can use the X11 TclTk.  And the unix build can use  
Aqua.  OSX's TclTk is old, 8.3.  That should work, but I haven't had  
any luck with it.  And, in Panther it's not really Aqua, and not  
really X11, only in Tiger is it fully Aqua.

You would need the separate Aqua 8.4 distribution for an Aqua build  
to work.  But even then there are issues.  TclTk Aqua is only  
partially 'Aqua-fied' - some of the controls are still X11-style,  
like sliders.  The Aqua controls are also bigger, and mess up  
layouts, and control names can get truncated.

And, there are still random problems with NVIZ and TclTk Aqua.  So,  
X11 TclTk is still recommended (by me at least).  With the move to  
Python for the GUI, I haven't bothered to look into NVIZ bugs with Aqua.

> (2) If someone wants to use X11 instead of Aqua, there's nothing  
> wrong with an "external" build of Tcl/Tk, alongside Apple's,  
> right?  If I understand William's writing in http://grass.itc.it/ 
> platforms/macgrass/tcltk.php correctly, this is essentially what he  
> has done by installing into /usr/X11R6, because Apple's is directly  
> under /usr
I need to clean up those instructions and move them into the wiki.   
Rather than install them in X11, install them in /usr/local.  As I  
mention in the readme in CVS, /usr/local/tcltk is what I use, to keep  
it isolated.  Though I see you're using TclTk from Fink.

Installing extras into X11, I decided after writing those  
instructions, was not safe since it's an 'Apple space' - their  
updaters might trash something in the future.

> (3) Are there any other issues I should be aware of if I'm going to  
> edit the platform notes?  I suppose some mention of GRASS_WISH  
> would be useful.

William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>

Earth: "Mostly harmless"

- revised entry in the HitchHiker's Guide to the Galaxy

More information about the grass-dev mailing list