[GRASS-dev] Unable to locate Tcl library

Hello,

the last month everything was Ok when I was building Grass from sources
(according to [1]) on my Win7 64bit. Now the build fails in a configuring
phase and an error message "Unable to locate Tcl library." appears. To tell
the truth, I cannot confirm if the final build was Tcl ready as I use
wxPython GUI by default.

I've found several Tcl libraries on my PC (version 8.5.2) so it is weird.
Was there any refactoring in the meantime? Is it any kind of regression or
am I missing something?

Here is the snippet of a console output:
...
checking for OpenGL library... found
checking for GLU library... found
checking whether to use Tcl/Tk... yes
checking for location of Tcl/Tk includes...
checking for tcl.h... yes
checking for tk.h... yes
checking Tcl version... unknown (cross-compiling)
checking Tk version... unknown (cross-compiling)
checking for location of Tcl/Tk library...
checking for Tcl_Init in -ltcl... no
checking for Tcl_Init in -ltcl... no
checking for Tcl_Init in -ltclUNKNOWN... no
checking for Tcl_Init in -ltclUNKNOWN... no
checking for Tcl_Init in -ltclUNKNOWN... no
checking for Tcl_Init in -ltclUNKNOWN... no
configure: error: *** Unable to locate Tcl library.

Thanks for any ideas.

Regards,
Jan

PS: When I was looking for the remedy of my problem, I found a strange
target URL [2] on the list of mailing lists [3].
______________
[1] http://trac.osgeo.org/grass/wiki/CompileOnWindows
[2] http://www.nabble.com/GRASS-f1200.html
[3] http://grass.osgeo.org/searchgrass.php

Jan Tosovsky wrote:

the last month everything was Ok when I was building Grass from sources
(according to [1]) on my Win7 64bit. Now the build fails in a configuring
phase and an error message "Unable to locate Tcl library." appears. To tell
the truth, I cannot confirm if the final build was Tcl ready as I use
wxPython GUI by default.

I've found several Tcl libraries on my PC (version 8.5.2) so it is weird.
Was there any refactoring in the meantime? Is it any kind of regression or
am I missing something?

Here is the snippet of a console output:

checking Tcl version... unknown (cross-compiling)
checking Tk version... unknown (cross-compiling)

Are you actually cross-compiling?

configure decides if you're cross-compiling by compiling and executing
the program:

  #include "confdefs.h"
  main(){return(0);}

If it fails to compile, you get "C compiler cannot create executables".
If it compiles but cannot be executed, configure assumes that you're
cross-compiling.

checking for location of Tcl/Tk library...
checking for Tcl_Init in -ltcl... no
checking for Tcl_Init in -ltcl... no
checking for Tcl_Init in -ltclUNKNOWN... no
checking for Tcl_Init in -ltclUNKNOWN... no
checking for Tcl_Init in -ltclUNKNOWN... no
checking for Tcl_Init in -ltclUNKNOWN... no
configure: error: *** Unable to locate Tcl library.

The configure script checks for the Tcl/Tk version by compiling and
executing a test program which does:

  FILE *fp = fopen("conftestdata","w");
  fputs(TCL_VERSION, fp);

If you're cross-compiling, it can't run the executables which the
compiler generates, so it can't detect the version. If the library name
contains the version number (e.g. libtcl85.a), you lose. You can get
around this by making a copy of the library with the correct name.

However, I'm guessing that you're not actually cross-compiling, and the
problem is that configure thinks that you are.

Look at the top of the config.log file; the first few lines should look
something like:

  This file contains any messages produced by compilers while
  running configure, to aid debugging if configure makes a mistake.
  
  configure:754: checking host system type
  configure:777: checking for gcc
  configure:881: checking whether the C compiler (gcc -g -O2) works
  configure:897: gcc -o conftest -g -O2 conftest.c 1>&5
  configure:894: warning: return type defaults to 'int'
  configure:923: checking whether the C compiler (gcc -g -O2) is a cross-compiler
  configure:928: checking whether we are using GNU C

If there are any errors there, please post the beginning of the file
(everything up to "checking whether we are using GNU C").

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

Thanks for this exhaustive explanation! This clarified what was going on.

Seeing the result:
configure:759: checking host system type
configure:782: checking for gcc
configure:886: checking whether the C compiler (gcc ) works
configure:902: gcc -o conftest conftest.c 1>&5
configure:928: checking whether the C compiler (gcc ) is a cross-compiler
configure:933: checking whether we are using GNU C

one can register launching conftest file.

Yes, this is the consequence of a problem described in the another thread:
Exploit.DEM in conftest.exe

My antivirus is blocking this file so the configuration script fails to
evaluate cross-compiling settings properly.

I've added affected path into the list of exceptions and now it seems to be
Ok.

Thanks,
Jan

-----Original Message-----
From: Glynn Clements [mailto:glynn@gclements.plus.com]
Sent: Wednesday, March 17, 2010 11:04 AM
To: Jan Tosovsky
Cc: grass-dev@lists.osgeo.org
Subject: Re: [GRASS-dev] Unable to locate Tcl library

Jan Tosovsky wrote:

> the last month everything was Ok when I was building Grass from
sources
> (according to [1]) on my Win7 64bit. Now the build fails in a
configuring
> phase and an error message "Unable to locate Tcl library." appears.
To tell
> the truth, I cannot confirm if the final build was Tcl ready as I use
> wxPython GUI by default.
>
> I've found several Tcl libraries on my PC (version 8.5.2) so it is
weird.
> Was there any refactoring in the meantime? Is it any kind of
regression or
> am I missing something?
>
> Here is the snippet of a console output:

> checking Tcl version... unknown (cross-compiling)
> checking Tk version... unknown (cross-compiling)

Are you actually cross-compiling?

configure decides if you're cross-compiling by compiling and executing
the program:

  #include "confdefs.h"
  main(){return(0);}

If it fails to compile, you get "C compiler cannot create executables".
If it compiles but cannot be executed, configure assumes that you're
cross-compiling.

> checking for location of Tcl/Tk library...
> checking for Tcl_Init in -ltcl... no
> checking for Tcl_Init in -ltcl... no
> checking for Tcl_Init in -ltclUNKNOWN... no
> checking for Tcl_Init in -ltclUNKNOWN... no
> checking for Tcl_Init in -ltclUNKNOWN... no
> checking for Tcl_Init in -ltclUNKNOWN... no
> configure: error: *** Unable to locate Tcl library.

The configure script checks for the Tcl/Tk version by compiling and
executing a test program which does:

  FILE *fp = fopen("conftestdata","w");
  fputs(TCL_VERSION, fp);

If you're cross-compiling, it can't run the executables which the
compiler generates, so it can't detect the version. If the library name
contains the version number (e.g. libtcl85.a), you lose. You can get
around this by making a copy of the library with the correct name.

However, I'm guessing that you're not actually cross-compiling, and the
problem is that configure thinks that you are.

Look at the top of the config.log file; the first few lines should look
something like:

  This file contains any messages produced by compilers while
  running configure, to aid debugging if configure makes a mistake.

  configure:754: checking host system type
  configure:777: checking for gcc
  configure:881: checking whether the C compiler (gcc -g -O2) works
  configure:897: gcc -o conftest -g -O2 conftest.c 1>&5
  configure:894: warning: return type defaults to 'int'
  configure:923: checking whether the C compiler (gcc -g -O2) is a
cross-compiler
  configure:928: checking whether we are using GNU C

If there are any errors there, please post the beginning of the file
(everything up to "checking whether we are using GNU C").

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