[GRASSLIST:2232] can't find tk.h

I am trying to build 5.0.3 on Cygwin, but configure is failing:

    checking for location of Tcl/Tk includes... /usr/local/include
    checking for tcl.h... yes
    checking for tk.h... no

But I have
    --with-tcltk-includes=/usr/local/include
and tk.h is in /usr/local/include !!!???

I think I am cross-eyed from looking at this for too long. What is it that I am missing?

Thanks,
Rich

Richard Greenwood wrote:

I am trying to build 5.0.3 on Cygwin, but configure is failing:

    checking for location of Tcl/Tk includes... /usr/local/include
    checking for tcl.h... yes
    checking for tk.h... no

But I have
    --with-tcltk-includes=/usr/local/include
and tk.h is in /usr/local/include !!!???

I think I am cross-eyed from looking at this for too long. What is it
that I am missing?

Look at config.log; that contains the commands which are being run and
their output (i.e. error messages).

Note that header checks involved attempting to preprocess a trivial
test program which includes the corresponding header (i.e. they don't
just check for the existence of a file). If any output is generated,
the test is deemed to have failed. A corollary of this is that
(otherwise) harmless warning messages will cause the test to fail.

Problems with the tk.h check are often related to the X headers. tk.h
includes X11/Xlib.h, which in turn includes several other X and system
headers. If any of those generate an error or warning message, the
check will fail.

If it turns out that the check *is* failing due to what should be a
harmless warning message, you can try using:

  CPPFLAGS=-w ./configure ...

to suppress warnings from the preprocessor. However, this should only
be done as a last resort, as it can obscure genuine problems. Also,
the -w switch should be removed manually from the COMPILE_FLAGS
setting in the src/CMD/head/head file once configure has completed.

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

Glynn et al,

I am trying to get NVIZ (from Grass 5.0.3 source) compiled and working on Cygwin. I have a new, clean, minimal Cygwin install and built Grass. It appears to run, as does tcltkgrass, but nviz generates the error [1] below. Inspecting my config.log, I see a couple suspicious errors, [2] and [3] below.

[2] says "ld: cannot find -ltk" and neither can I. Do I need to link tk to something? And if so, what?

[3] is a list of 427 undefined references. Am I missing a library, or a link, or something in my path?

There are two shell scripts in /usr/local/lib 'tclConfig.sh' and 'tkConfig.sh' which define numerous shell variables. Is it possible that these relate to my problem? Do I need to run these prior to configure and build?

As always, I apprecite the assistance that I receive from this list.

Best regards,
Rich

=== [1] ====
GRASS:~ > nviz ned_patch
child killed: segmentation violation
    while executing
"exec /home/Rich/grass/grass-5.0.3/dist.i686-pc-cygwin/etc/nviz2.2/NVWISH2.2 -f
/home/Rich/grass/grass-5.0.3/dist.i686-pc-cygwin/etc/nviz2.2/scripts/nv..."
    ("eval" body line 1)
    invoked from within
"eval exec $env(GISBASE)/etc/nviz2.2/NVWISH2.2 -f $env(GISBASE)/etc/nviz2.2/scri
pts/nviz2.2_script $argv -name NVIZ >&@stdout"
    invoked from within
"if {$argv == ""} {
#no arguments
eval exec $env(GISBASE)/etc/nviz2.2/NVWISH2.2 -f $env(GISBASE)/etc/nviz2.2/scrip
ts/nviz2.2_script -name NVIZ >&@stdo..."
    (file "/home/Rich/grass/grass-5.0.3/dist.i686-pc-cygwin/bin/nviz" line 16)

=== [2] =====
int main() {
Tk_MainWindow()
; return 0; }
configure:8617: checking for Tk_MainWindow in -ltk
configure:8634: gcc -o conftest -O2 -I/usr/include/ncurses -s -L/usr/local/lib -L/usr/X11R6/lib conftest.c -ltk -ltcl8.3 -L/usr/X11R6/lib -lSM -lICE -lX11 1>&5
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/../../../../i686-pc-cygwin/bin/ld: cannot find -ltk
collect2: ld returned 1 exit status

=== [3] =====
int main() {
Tk_MainWindow()
; return 0; }
configure:8661: checking for Tk_MainWindow in -ltk8.3
configure:8678: gcc -o conftest -O2 -I/usr/include/ncurses -s -L/usr/local/lib -L/usr/X11R6/lib conftest.c -ltk8.3 -ltcl8.3 1>&5
/usr/local/lib/libtk8.3.a(tkWindow.o)(.text+0x138c):tkWindow.c: undefined reference to `_XDestroyWindow'
/usr/local/lib/libtk8.3.a(tkWindow.o)(.text+0x1404):tkWindow.c: undefined reference to `_XDestroyIC'
##### another 425 lines of libtk8.3. undefined references follow

--
Richard Greenwood
www.greenwoodmap.com

Richard Greenwood wrote:

I am trying to get NVIZ (from Grass 5.0.3 source) compiled and working
on Cygwin. I have a new, clean, minimal Cygwin install and built Grass.
It appears to run, as does tcltkgrass, but nviz generates the error [1]
below. Inspecting my config.log, I see a couple suspicious errors, [2]
and [3] below.

[2] says "ld: cannot find -ltk" and neither can I. Do I need to link tk
to something? And if so, what?

No. If you look at what follows that section in config.log, you will
note that configure first tries "-ltk"; if that fails, it tries e.g.
-ltk8.3, then finally -ltk83 (in the last two cases, the version is
deduced from the tk.h header file).

Errors messages in config.log are normal. The most basic configure
checks either succeed or fail. More complex checks (e.g. choosing one
of a list of likely possibilities) are constructed by performing a
series of basic checks until one succeeds.

[3] is a list of 427 undefined references. Am I missing a library, or a
link, or something in my path?

configure:8678: gcc -o conftest -O2 -I/usr/include/ncurses -s
-L/usr/local/lib -L/usr/X11R6/lib conftest.c -ltk8.3 -ltcl8.3 1>&5
/usr/local/lib/libtk8.3.a(tkWindow.o)(.text+0x138c):tkWindow.c:
undefined reference to `_XDestroyWindow'
/usr/local/lib/libtk8.3.a(tkWindow.o)(.text+0x1404):tkWindow.c:
undefined reference to `_XDestroyIC'
##### another 425 lines of libtk8.3. undefined references follow

The symbols are part of Xlib (/usr/X11R6/lib/libX11.a).

The configure checks for the Tk library try each of the aforementioned
variants (-ltk, -ltk8.3, -ltk83) twice; first without the X libraries
then, if that fails, with them.

Again, the error messages from failed attempts don't matter, so long
as it ultimately finds a combination which succeeds. If all of the
combinations fail, you will get an error message along the lines of:

  *** Unable to locate Tk library.

and the configure script will abort at that point.

There are two shell scripts in /usr/local/lib 'tclConfig.sh' and
'tkConfig.sh' which define numerous shell variables. Is it possible
that these relate to my problem? Do I need to run these prior to
configure and build?

No. GRASS' build system doesn't use those files.

=== [1] ====
GRASS:~ > nviz ned_patch
child killed: segmentation violation
    while executing

[snip]

Unfortunately, almost everything which could possibly go wrong with
building NVIZ results in exactly this error message (including the
stuff which I've snipped).

The only way to track such problems down is to use a debugger (e.g.
gdb). If you can try the following, it may provide useful information:

  GRASS:~ > eval `g.gisenv`
  GRASS:~ > gdb /home/Rich/grass/grass-5.0.3/dist.i686-pc-cygwin/etc/nviz2.2/NVWISH2.2
  > run -f /home/Rich/grass/grass-5.0.3/dist.i686-pc-cygwin/etc/nviz2.2/scripts/nviz2.2_script ned_patch -name NVIZ
  [... segmentation fault ...]
  > where

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

Well I tried nviz under gdb, but the results are not very telling:

GRASS:~ > eval `g.gisenv`
GRASS:~ > gdb /home/Rich/grass/grass-5.0.3/dist.i686-pc-cygwin/etc/nviz2.2/NVWISH2.2
    This GDB was configured as "i686-pc-cygwin"...
(gdb) run -f /home/Rich/grass/grass-5.0.3/dist.i686-pc-cygwin/etc/nviz2.2/scripts/nviz2.2_script ned_patch -name NVIZ
Starting program: /home/Rich/grass/grass-5.0.3/dist.i686-pc-cygwin/etc/nviz2.2/NVWISH2.2 -f /home/Rich/grass/grass-5.0.3/dist.i686-pc-cygwin/etc/nviz2.2/scripts/nviz2.2_script ned_patch -name NVIZ

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? () from
(gdb) where
#0 0x00000000 in ?? () from
(gdb)

Any suggestions?

Thanks,
Rich

--
Richard Greenwood
www.greenwoodmap.com

Richard Greenwood wrote:

Well I tried nviz under gdb, but the results are not very telling:

GRASS:~ > eval `g.gisenv`
GRASS:~ > gdb
/home/Rich/grass/grass-5.0.3/dist.i686-pc-cygwin/etc/nviz2.2/NVWISH2.2
    This GDB was configured as "i686-pc-cygwin"...
(gdb) run -f
/home/Rich/grass/grass-5.0.3/dist.i686-pc-cygwin/etc/nviz2.2/scripts/nviz2.2_script
ned_patch -name NVIZ
Starting program:
/home/Rich/grass/grass-5.0.3/dist.i686-pc-cygwin/etc/nviz2.2/NVWISH2.2
-f
/home/Rich/grass/grass-5.0.3/dist.i686-pc-cygwin/etc/nviz2.2/scripts/nviz2.2_script
ned_patch -name NVIZ

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? () from
(gdb) where
#0 0x00000000 in ?? () from
(gdb)

That's odd. The NULL address is plausible enough, but I would still
have expected a backtrace.

Any suggestions?

Not really.

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