[GRASS-dev] debugging nviz with TclTk 8.5 aqua

Glynn,

After some delays, I managed to recompile GRASS 7 with CFLAGS="-arch i386 -g", etc so that gdb would produce useful output, and with TclTk 8.5 aqua for Mac. Running nviz in gdb gives the results below. Hopefully these are more helpful. It freezes at the last line.

(gdb) run -f $GISBASE/etc/nviz2.2/scripts/nviz2.2_script elev=elevation.dem
Starting program: /Applications/Grass/GRASS-7.0.app/Contents/MacOS/etc/nviz2.2/nviz -f $GISBASE/etc/nviz2.2/scripts/nviz2.2_script elev=elevation.dem
Reading symbols for shared libraries . done
Reading symbols for shared libraries ....... done
Reading symbols for shared libraries . done
Loading raster map <elevation.dem@PERMANENT>...
Translating colors from raster map <elevation.dem@PERMANENT>...
Reading symbols for shared libraries . done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000024
0x0001702d in Togl_CreateWindow (tkwin=0x1fdb608, parent=30857160, instanceData=0x758db0) at togl.c:2338
2338 if (!aglSetDrawable(togl->aglCtx,

Michael

Michael Barton wrote:

After some delays, I managed to recompile GRASS 7 with CFLAGS="-arch
i386 -g", etc so that gdb would produce useful output, and with TclTk
8.5 aqua for Mac. Running nviz in gdb gives the results below.
Hopefully these are more helpful. It freezes at the last line.

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000024
0x0001702d in Togl_CreateWindow (tkwin=0x1fdb608, parent=30857160,
instanceData=0x758db0) at togl.c:2338
2338 if (!aglSetDrawable(togl->aglCtx,

The complete line is:

        if (!aglSetDrawable(togl->aglCtx,
# if defined(TOGL_AGL)
                        ((MacDrawable *) (window))->toplevel->grafPtr
# else
                        ((MacDrawable *) (window))->toplevel->portPtr
# endif
                )) {

togl and togl->aglCtx are known to be non-NULL (otherwise it would
have crashed before then). Can you try the following:

  print ((MacDrawable *) (window))
  print ((MacDrawable *) (window))->toplevel
  print ((MacDrawable *) (window))->toplevel->grafPtr

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

On Jul 22, 2008, at 5:07 AM, Glynn Clements wrote:

Michael Barton wrote:

After some delays, I managed to recompile GRASS 7 with CFLAGS="-arch
i386 -g", etc so that gdb would produce useful output, and with TclTk
8.5 aqua for Mac. Running nviz in gdb gives the results below.
Hopefully these are more helpful. It freezes at the last line.

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000024
0x0001702d in Togl_CreateWindow (tkwin=0x1fdb608, parent=30857160,
instanceData=0x758db0) at togl.c:2338
2338 if (!aglSetDrawable(togl->aglCtx,

The complete line is:

       if (!aglSetDrawable(togl->aglCtx,
# if defined(TOGL_AGL)
                       ((MacDrawable *) (window))->toplevel->grafPtr
# else
                       ((MacDrawable *) (window))->toplevel->portPtr
# endif
               )) {

togl and togl->aglCtx are known to be non-NULL (otherwise it would
have crashed before then). Can you try the following:

  print ((MacDrawable *) (window))
  print ((MacDrawable *) (window))->toplevel
  print ((MacDrawable *) (window))->toplevel->grafPtr

I'm assuming that you mean to enter these lines in gdb. Here is the result.

(gdb) run -f $GISBASE/etc/nviz2.2/scripts/nviz2.2_script -q
Starting program: /Applications/Grass/GRASS-7.0.app/Contents/MacOS/etc/nviz2.2/nviz -f $GISBASE/etc/nviz2.2/scripts/nviz2.2_script -q
Reading symbols for shared libraries +++++++++++++++++++++++...................................................................................... done
Reading symbols for shared libraries . done
Reading symbols for shared libraries ....... done
Reading symbols for shared libraries . done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x0000002c
0x0001702d in Togl_CreateWindow (tkwin=0x1d89608, parent=30902152, instanceData=0x7579c0) at togl.c:2338
2338 if (!aglSetDrawable(togl->aglCtx,
(gdb) print ((MacDrawable *) (window))
No symbol "MacDrawable" in current context.
(gdb) print ((MacDrawable *) (window))->toplevel
No symbol "MacDrawable" in current context.
(gdb) print ((MacDrawable *) (window))->toplevel->grafPtr
No symbol "MacDrawable" in current context.

Michael

Michael Barton wrote:

> togl and togl->aglCtx are known to be non-NULL (otherwise it would
> have crashed before then). Can you try the following:
>
> print ((MacDrawable *) (window))
> print ((MacDrawable *) (window))->toplevel
> print ((MacDrawable *) (window))->toplevel->grafPtr

I'm assuming that you mean to enter these lines in gdb. Here is the
result.

(gdb) print ((MacDrawable *) (window))
No symbol "MacDrawable" in current context.

Hmm; does this work:

  print ((struct TkWindowPrivate *) (window))
  print ((struct TkWindowPrivate *) (window))->toplevel
  print ((struct TkWindowPrivate *) (window))->toplevel->grafPtr
?

Failing that, just:

  print window

might provide a clue.

OTOH, I'm not sure if any of this will actually help in the end. The
conclusion may well just be "Togl doesn't work with 8.5". I can't see
any references to 8.5 on the Togl site (it isn't a particularly active
project).

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

On Jul 22, 2008, at 1:41 PM, Glynn Clements wrote:

Michael Barton wrote:

togl and togl->aglCtx are known to be non-NULL (otherwise it would
have crashed before then). Can you try the following:

  print ((MacDrawable *) (window))
  print ((MacDrawable *) (window))->toplevel
  print ((MacDrawable *) (window))->toplevel->grafPtr

I'm assuming that you mean to enter these lines in gdb. Here is the
result.

(gdb) print ((MacDrawable *) (window))
No symbol "MacDrawable" in current context.

Hmm; does this work:

  print ((struct TkWindowPrivate *) (window))
  print ((struct TkWindowPrivate *) (window))->toplevel
  print ((struct TkWindowPrivate *) (window))->toplevel->grafPtr
?

Failing that, just:

  print window

might provide a clue.

OTOH, I'm not sure if any of this will actually help in the end. The
conclusion may well just be "Togl doesn't work with 8.5". I can't see
any references to 8.5 on the Togl site (it isn't a particularly active
project).

This actually produced some results.

(gdb) run -f $GISBASE/etc/nviz2.2/scripts/nviz2.2_script -q
Starting program: /Applications/Grass/GRASS-7.0.app/Contents/MacOS/etc/nviz2.2/nviz -f $GISBASE/etc/nviz2.2/scripts/nviz2.2_script -q
Reading symbols for shared libraries +++++++++++++++++++++++...................................................................................... done
Reading symbols for shared libraries . done
Reading symbols for shared libraries ....... done
Reading symbols for shared libraries . done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x0000002c
0x0001702d in Togl_CreateWindow (tkwin=0x1fcb608, parent=30918536, instanceData=0x757ce0) at togl.c:2338
2338 if (!aglSetDrawable(togl->aglCtx,
(gdb) print ((struct TkWindowPrivate *) (window))
$1 = (struct TkWindowPrivate *) 0x1d7c648
(gdb) print ((struct TkWindowPrivate *) (window))->toplevel
$2 = (struct TkWindowPrivate *) 0x28
(gdb) print ((struct TkWindowPrivate *) (window))->toplevel->grafPtr
Cannot access memory at address 0x2c
(gdb) print window
$3 = 30918216
(gdb)

Michael

Michael Barton wrote:

>> (gdb) print ((MacDrawable *) (window))
>> No symbol "MacDrawable" in current context.
>
> Hmm; does this work:
>
> print ((struct TkWindowPrivate *) (window))
> print ((struct TkWindowPrivate *) (window))->toplevel
> print ((struct TkWindowPrivate *) (window))->toplevel->grafPtr
> ?
>
> Failing that, just:
>
> print window
>
> might provide a clue.
>
> OTOH, I'm not sure if any of this will actually help in the end. The
> conclusion may well just be "Togl doesn't work with 8.5". I can't see
> any references to 8.5 on the Togl site (it isn't a particularly active
> project).

This actually produced some results.

(gdb) print ((struct TkWindowPrivate *) (window))
$1 = (struct TkWindowPrivate *) 0x1d7c648
(gdb) print ((struct TkWindowPrivate *) (window))->toplevel
$2 = (struct TkWindowPrivate *) 0x28

Ouch.

Do you have more than one version of Tcl/Tk on your system? One
possibility is that the tkMacOSXInt.h header which Togl is using
doesn't match the library.

Another possibility is that the structure packing could be affected by
compiler switches, so if Togl isn't compiled with the same switches as
the Tk library, it won't be accessing the fields correctly.

Can you try:

  print *((struct TkWindowPrivate *) (window))

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

On Jul 22, 2008, at 6:29 PM, Glynn Clements wrote:

Michael Barton wrote:

(gdb) print ((MacDrawable *) (window))
No symbol "MacDrawable" in current context.

Hmm; does this work:

  print ((struct TkWindowPrivate *) (window))
  print ((struct TkWindowPrivate *) (window))->toplevel
  print ((struct TkWindowPrivate *) (window))->toplevel->grafPtr
?

Failing that, just:

  print window

might provide a clue.

OTOH, I'm not sure if any of this will actually help in the end. The
conclusion may well just be "Togl doesn't work with 8.5". I can't see
any references to 8.5 on the Togl site (it isn't a particularly active
project).

This actually produced some results.

(gdb) print ((struct TkWindowPrivate *) (window))
$1 = (struct TkWindowPrivate *) 0x1d7c648
(gdb) print ((struct TkWindowPrivate *) (window))->toplevel
$2 = (struct TkWindowPrivate *) 0x28

Ouch.

Do you have more than one version of Tcl/Tk on your system? One
possibility is that the tkMacOSXInt.h header which Togl is using
doesn't match the library.

Another possibility is that the structure packing could be affected by
compiler switches, so if Togl isn't compiled with the same switches as
the Tk library, it won't be accessing the fields correctly.

Can you try:

  print *((struct TkWindowPrivate *) (window))

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x0000002c
0x0001702d in Togl_CreateWindow (tkwin=0x5cf0608, parent=97384328, instanceData=0x757dc0) at togl.c:2338
2338 if (!aglSetDrawable(togl->aglCtx,
(gdb) print *((struct TkWindowPrivate *) (window))
$1 = {
   winPtr = 0x5cf0608,
   grafPtr = 0x0,
   context = 0x6c63542f,
   rootControl = 0x0,
   xOff = 0,
   yOff = 7337416,
   size = {
     width = 1.02819154e-38,
     height = 0
   },
   visRgn = 0x936b48,
   aboveVisRgn = 0x0,
   drawRect = {
     origin = {
       x = 6.97764217e+22,
       y = 1.8089652e+25
     },
     size = {
       width = 1.41764467e+22,
       height = 1.63008877e-19
     }
   },
   referenceCount = -271777041,
   toplevel = 0x28,
   flags = 97452040
}
(gdb)

Mac OS X 10.5 comes with TclTk aqua 8.4 and 8.5. But I also have to install an x11 version that I compile (in /usr/local/tcltk) in order to compile and run GRASS with the standard x11 tcltk.

Michael

Glynn Clements wrote:

> This actually produced some results.

> (gdb) print ((struct TkWindowPrivate *) (window))
> $1 = (struct TkWindowPrivate *) 0x1d7c648
> (gdb) print ((struct TkWindowPrivate *) (window))->toplevel
> $2 = (struct TkWindowPrivate *) 0x28

Ouch.

Do you have more than one version of Tcl/Tk on your system? One
possibility is that the tkMacOSXInt.h header which Togl is using
doesn't match the library.

Another possibility is that the structure packing could be affected by
compiler switches, so if Togl isn't compiled with the same switches as
the Tk library, it won't be accessing the fields correctly.

Can you try:

  print *((struct TkWindowPrivate *) (window))

Oh; while you're at it, can you post your tkMacOSXInt.h header?

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

On Jul 22, 2008, at 6:49 PM, Glynn Clements wrote:

Glynn Clements wrote:

This actually produced some results.

(gdb) print ((struct TkWindowPrivate *) (window))
$1 = (struct TkWindowPrivate *) 0x1d7c648
(gdb) print ((struct TkWindowPrivate *) (window))->toplevel
$2 = (struct TkWindowPrivate *) 0x28

Ouch.

Do you have more than one version of Tcl/Tk on your system? One
possibility is that the tkMacOSXInt.h header which Togl is using
doesn't match the library.

Another possibility is that the structure packing could be affected by
compiler switches, so if Togl isn't compiled with the same switches as
the Tk library, it won't be accessing the fields correctly.

Can you try:

  print *((struct TkWindowPrivate *) (window))

Oh; while you're at it, can you post your tkMacOSXInt.h header?

I've put it at <http://www.public.asu.edu/~cmbarton/files/tcltk/&gt;

This is for aqua and (I assume) for 8.5.

Michael

Michael Barton wrote:

> Oh; while you're at it, can you post your tkMacOSXInt.h header?

I've put it at <http://www.public.asu.edu/~cmbarton/files/tcltk/&gt;

This is for aqua and (I assume) for 8.5.

Yep; that's 8.5:

struct TkWindowPrivate {
    TkWindow *winPtr; /* Ptr to tk window or NULL if Pixmap */
    CGrafPtr grafPtr;
    CGContextRef context;
    ControlRef rootControl;
    int xOff; /* X offset from toplevel window */
    int yOff; /* Y offset from toplevel window */
    CGSize size;
    HIShapeRef visRgn; /* Visible region of window */
    HIShapeRef aboveVisRgn; /* Visible region of window & its children */
    CGRect drawRect; /* Clipped drawing rect */
    int referenceCount; /* Don't delete toplevel until children are
         * gone. */
    struct TkWindowPrivate *toplevel;
        /* Pointer to the toplevel datastruct. */
    int flags; /* Various state see defines below. */
};

For 8.4.9, it looks like:

struct TkWindowPrivate {
    TkWindow *winPtr; /* Ptr to tk window or NULL if Pixmap */
    CGrafPtr grafPtr;
    ControlRef rootControl;
    int xOff; /* X offset from toplevel window */
    int yOff; /* Y offset from toplevel window */
    RgnHandle clipRgn; /* Visable region of window */
    RgnHandle aboveClipRgn; /* Visable region of window & it's children */
    int referenceCount; /* Don't delete toplevel until children are
         * gone. */
    struct TkWindowPrivate *toplevel; /* Pointer to the toplevel
           * datastruct. */
    int flags; /* Various state see defines below. */
};

> Can you try:
>
> print *((struct TkWindowPrivate *) (window))

Okay; decoding to hex and/or strings:

(gdb) print *((struct TkWindowPrivate *) (window))
$1 = {
   winPtr = 0x5cf0608,
   grafPtr = 0x0,
   context = 0x6c63542f, // = "/Tcl"
   rootControl = 0x0,
   xOff = 0,
   yOff = 7337416, // 0x006ff5c8
   size = {
     width = 1.02819154e-38, // 0x006ff5cc
     height = 0
   },
   visRgn = 0x936b48,
   aboveVisRgn = 0x0,
   drawRect = {
     origin = {
       x = 6.97764217e+22, // 0x656c6966 = "file"
       y = 1.8089652e+25 // 0x696f6a20 = " joi"
     },
     size = {
       width = 1.41764467e+22,// 0x6440206e = "n @d"
       height = 1.63008877e-19// 0x20407269 = "ir@ "
     }
   },
   referenceCount = -271777041,// 0xefcd02ef
   toplevel = 0x28,
   flags = 97452040 // 0x05cf0008
}

As raw data, that's:

     0x05cf0608,
     0,
     0x6c63542f = "/Tcl"
     0,
     0,
     0x006ff5c8
     0x006ff5cc
     0
     0x0936b48,
     0,
     0x656c6966 = "file"
     0x696f6a20 = " joi"
     0x6440206e = "n @d"
     0x20407269 = "ir@ "
     0xefcd02ef
     0x28,
     0x05cf0008

If I map that to the 8.4 TkWindowPrivate structure:

     TkWindow * winPtr = 0x5cf0608
     CGrafPtr grafPtr = 0
     ControlRef rootControl = 0x6c63542f = "/Tcl"
     int xOff = 0
     int yOff = 0
     RgnHandle clipRgn = 0x006ff5c8
     RgnHandle aboveClipRgn = 0x006ff5cc
     int referenceCount = 0
     struct ... * toplevel = 0x00936b48
     int flags = 0

which looks quite sane (the rootControl field isn't initialised by
TkpMakeWindow(), so it isn't unusual that it contains garbage at this
point).

Mac OS X 10.5 comes with TclTk aqua 8.4 and 8.5. But I also have to
install an x11 version that I compile (in /usr/local/tcltk) in order
to compile and run GRASS with the standard x11 tcltk.

I'd say it's a fairly safe bet that Togl is being compiled with the
8.5 headers but linked against the 8.4 library.

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

On Jul 23, 2008, at 7:17 AM, Glynn Clements wrote:

Mac OS X 10.5 comes with TclTk aqua 8.4 and 8.5. But I also have to
install an x11 version that I compile (in /usr/local/tcltk) in order
to compile and run GRASS with the standard x11 tcltk.

Actually, OSX 10.5 only comes with 8.4 Aqua.

I'd say it's a fairly safe bet that Togl is being compiled with the
8.5 headers but linked against the 8.4 library.

That's certainly possible. I have to watch some projects when I compile them when I want to use dependencies that I've built newer versions than are available in the system - if the project adds -L/usr/lib to the linking, the system version will usually link instead of mine. Since /usr/lib is always in the default link path, it's not needed. OSX -L ordering rules in the linker are a bit different than linux, and can be troublesome at times.

GRASS is good about this, but there are a couple things in the system that can add that, from .la info or config scripts.

Michael, for the line that links nviz, do you see -L/usr/lib?

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"Those people who most want to rule people are, ipso-facto, those least suited to do it."

- A rule of the universe, from the HitchHiker's Guide to the Galaxy

On Jul 23, 2008, at 8:38 AM, William Kyngesburye wrote:

I'd say it's a fairly safe bet that Togl is being compiled with the
8.5 headers but linked against the 8.4 library.

Michael, for the line that links nviz, do you see -L/usr/lib?

Another possibility is my OSX app startup script is confusing things, so that it's building correctly with 8.5 but running with 8.4. Are you compiling with the TCLTK_INTERNAL and TCLTKVER exports I have in the Mac readme?

And configuring with opengl=aqua?

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

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

- Marvin

On Jul 23, 2008, at 9:05 AM, William Kyngesburye wrote:

On Jul 23, 2008, at 8:38 AM, William Kyngesburye wrote:

I'd say it's a fairly safe bet that Togl is being compiled with the
8.5 headers but linked against the 8.4 library.

Michael, for the line that links nviz, do you see -L/usr/lib?

Another possibility is my OSX app startup script is confusing things, so that it's building correctly with 8.5 but running with 8.4.

No, that's silly, nviz links against a specific version of tcltk, duh.

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

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

- Marvin

On Jul 23, 2008, at 5:17 AM, Glynn Clements wrote:

I'd say it's a fairly safe bet that Togl is being compiled with the
8.5 headers but linked against the 8.4 library.

So is this fixable?

Michael

On Jul 23, 2008, at 6:38 AM, William Kyngesburye wrote:

On Jul 23, 2008, at 7:17 AM, Glynn Clements wrote:

Mac OS X 10.5 comes with TclTk aqua 8.4 and 8.5. But I also have to
install an x11 version that I compile (in /usr/local/tcltk) in order
to compile and run GRASS with the standard x11 tcltk.

Actually, OSX 10.5 only comes with 8.4 Aqua.

Well, I don't remember installing 8.5 (though the absence of memory is not necessarily a memory of absence in my case). It doesn't look to be an Active States installation and I'm sure that I didn't compile 8.5 aqua. So I'm not sure where it came from if it didn't come with some system update.

I'd say it's a fairly safe bet that Togl is being compiled with the
8.5 headers but linked against the 8.4 library.

That's certainly possible. I have to watch some projects when I compile them when I want to use dependencies that I've built newer versions than are available in the system - if the project adds -L/usr/lib to the linking, the system version will usually link instead of mine. Since /usr/lib is always in the default link path, it's not needed. OSX -L ordering rules in the linker are a bit different than linux, and can be troublesome at times.

GRASS is good about this, but there are a couple things in the system that can add that, from .la info or config scripts.

Michael, for the line that links nviz, do you see -L/usr/lib?

Where do I look for this?

Michael

On Jul 23, 2008, at 7:05 AM, William Kyngesburye wrote:

On Jul 23, 2008, at 8:38 AM, William Kyngesburye wrote:

I'd say it's a fairly safe bet that Togl is being compiled with the
8.5 headers but linked against the 8.4 library.

Michael, for the line that links nviz, do you see -L/usr/lib?

Another possibility is my OSX app startup script is confusing things, so that it's building correctly with 8.5 but running with 8.4. Are you compiling with the TCLTK_INTERNAL and TCLTKVER exports I have in the Mac readme?

Yes

And configuring with opengl=aqua?

Yes

And without x11.

Here is what I do to compile with 8.5 aqua:

export CFLAGS="-arch i386 -Os"
export CXXFLAGS="-arch i386 -Os"
export LDFLAGS="-arch i386 -Os"

[NOTE: I've changed -Os to -g for debugging in my current version]

export NAD2BIN=/Library/Frameworks/PROJ.framework/Programs/nad2bin
export TCLTK_INTERNAL=
export TCLTKVER="8.5"

./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 --without-x --with-cxx --with-opengl=aqua --without-readline --prefix=/Applications/GRASS --enable-macosx-app --with-python --with-wxwidgets=/usr/local/lib/wxPython-unicode-2.8.7.1/bin/wx-config --with-tcltk-includes="/Library/Frameworks/Tcl.framework/Headers /Library/Frameworks/Tk.framework/Headers /Library/Frameworks/Tk.framework/PrivateHeaders"

Michael

On Jul 23, 2008, at 10:42 AM, Michael Barton wrote:

Actually, OSX 10.5 only comes with 8.4 Aqua.

Well, I don't remember installing 8.5 (though the absence of memory is not necessarily a memory of absence in my case). It doesn't look to be an Active States installation and I'm sure that I didn't compile 8.5 aqua. So I'm not sure where it came from if it didn't come with some system update.

What comes with OSX is in /System/Library/Frameworks, and all that is in my system is 8.4. If you have 8.5 in /Library/Frameworks, then that that must have been installed by something.

Michael, for the line that links nviz, do you see -L/usr/lib?

Where do I look for this?

I don't have a recent compile log handy, but I think you can search for "-o nvwish" in the Terminal after compiling. But then...

./configure

...

--with-tcltk-includes="/Library/Frameworks/Tcl.framework/Headers /Library/Frameworks/Tk.framework/Headers /Library/Frameworks/Tk.framework/PrivateHeaders"

In my local notes, I set --with-tcltk-libs=/usr/local/lib. Without that, the 8.5 includes are used, but the libraries are found in /usr/lib, which are the 8.4 libs.

This assumes that there are symlinks to the frameworks in /usr/local/lib. I don't remember if the aqua tcltk build automatically adds these or not, or if the binaries available (ie Activestate) include these. Ideally, I think GRASS needs to detect a framework TclTk Aqua and use -framework Tcl -framework Tk instead of -ltcl -ltk to link tcltk, then the symlinks and -L flag would not be necessary.

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

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

- Marvin

Michael Barton wrote:

>> I'd say it's a fairly safe bet that Togl is being compiled with the
>> 8.5 headers but linked against the 8.4 library.
>>
>
> That's certainly possible. I have to watch some projects when I
> compile them when I want to use dependencies that I've built newer
> versions than are available in the system - if the project adds -L/
> usr/lib to the linking, the system version will usually link instead
> of mine. Since /usr/lib is always in the default link path, it's
> not needed. OSX -L ordering rules in the linker are a bit different
> than linux, and can be troublesome at times.
>
> GRASS is good about this, but there are a couple things in the
> system that can add that, from .la info or config scripts.
>
> Michael, for the line that links nviz, do you see -L/usr/lib?

Where do I look for this?

  make -C visualization/nviz clean
  make -C visualization/nviz &> build.log

Search for "nvwish" in the output.

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

Michael Barton wrote:

> I'd say it's a fairly safe bet that Togl is being compiled with the
> 8.5 headers but linked against the 8.4 library.

So is this fixable?

At a minimum, it's fixable by uninstalling one of the versions.

In terms of making it work while keeping both versions installed, you
could delete or move the 8.5 headers (or the 8.4 library, but that
might break things, while removing headers won't).

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

William Kyngesburye wrote:

Ideally, I think GRASS needs to detect a framework TclTk Aqua
and use -framework Tcl -framework Tk instead of -ltcl -ltk to link
tcltk, then the symlinks and -L flag would not be necessary.

Presumably this would be handled similarly to OpenGL, which already
has suitable configure checks.

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