[GRASS-dev] lib/form/ and Tcl 8.6 compile problem

hi,

I tried to compile GRASS on Mandriva Cooker which comes (currently)
with

rpm -qa | grep tcl
tcl-8.6-0.b1.1mdv2009.1
libtcl-devel-8.6-0.b1.1mdv2009.1
libtcl8.6-8.6-0.b1.1mdv2009.1

I get this problem with 6.4:

cd lib/form/
make
...
gcc -I/home/guest/rpm/BUILD/grass-6.4/dist.i686-pc-linux-gnu/include
-g -O2 -fPIC -DPACKAGE=\""grasslibs"\"
-DPACKAGE=\""grasslibs"\"
-I/home/guest/rpm/BUILD/grass-6.4/dist.i686-pc-linux-gnu/include -o
OBJ.i686-pc-linux-gnu/form.o -c form.c
form.c: In function 'submit':
form.c:195: error: 'Tcl_Interp' has no member named 'result'
make: *** [OBJ.i686-pc-linux-gnu/form.o] Error 1

The code looks like this:
   190 else {
   191 memset(buf, '\0', strlen(buf));
   192 ret = Tcl_UtfToExternal(interp,
   193
Tcl_GetEncoding(interp,
   194
G__getenv
   195
("GRASS_DB_ENCODING")),
   196 Columns[i].value,
   197
strlen(Columns[i].value), 0, NULL,
   198 buf, 2000, NULL, NULL,
NULL);

Any idea how to solve this?

Markus

Hello,
there was similar issue reported on Mac. It comes from tcl.h where
they recommend not to use result:
  463 typedef struct Tcl_Interp {
  464 /* TIP #330: Strongly discourage extensions from using the
string result. */
  465 #ifdef USE_INTERP_RESULT

I'm not a make process guru to propose solution.
Maris.

2009/1/20, Markus Neteler <neteler@osgeo.org>:

hi,

I tried to compile GRASS on Mandriva Cooker which comes (currently)
with

rpm -qa | grep tcl
tcl-8.6-0.b1.1mdv2009.1
libtcl-devel-8.6-0.b1.1mdv2009.1
libtcl8.6-8.6-0.b1.1mdv2009.1

I get this problem with 6.4:

cd lib/form/
make
...
gcc -I/home/guest/rpm/BUILD/grass-6.4/dist.i686-pc-linux-gnu/include
-g -O2 -fPIC -DPACKAGE=\""grasslibs"\"
-DPACKAGE=\""grasslibs"\"
-I/home/guest/rpm/BUILD/grass-6.4/dist.i686-pc-linux-gnu/include -o
OBJ.i686-pc-linux-gnu/form.o -c form.c
form.c: In function 'submit':
form.c:195: error: 'Tcl_Interp' has no member named 'result'
make: *** [OBJ.i686-pc-linux-gnu/form.o] Error 1

The code looks like this:
   190 else {
   191 memset(buf, '\0', strlen(buf));
   192 ret = Tcl_UtfToExternal(interp,
   193
Tcl_GetEncoding(interp,
   194
G__getenv
   195
("GRASS_DB_ENCODING")),
   196 Columns[i].value,
   197
strlen(Columns[i].value), 0, NULL,
   198 buf, 2000, NULL, NULL,
NULL);

Any idea how to solve this?

Markus
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

On Tue, Jan 20, 2009 at 11:20 AM, Maris Nartiss <maris.gis@gmail.com> wrote:

Hello,
there was similar issue reported on Mac. It comes from tcl.h where
they recommend not to use result:
463 typedef struct Tcl_Interp {
464 /* TIP #330: Strongly discourage extensions from using the
string result. */
465 #ifdef USE_INTERP_RESULT

Good hint!

They propose to use Tcl_GetObjResult():
http://wiki.tcl.tk/21120

Is the following patch nonsense?

Index: form.c

--- form.c (revision 35372)
+++ form.c (working copy)
@@ -192,7 +192,7 @@
                    TCL_ERROR) {
                    G_warning
                        ("Could not set Tcl system encoding to '%s' (%s)",
- Columns[i].value, interp->result);
+ Columns[i].value, (char *) Tcl_GetObjResult(interp));
                }
            }
            continue;

Wild guessing :slight_smile:
Markus

Yes, it is :slight_smile:
In short - no one has eliminated old tcl/tk versions out there. Any
patch needs to work with old and new approach too. Also forms isn't
the only place where interp result is used (lazy to grep)

Maris.

2009/1/21 Markus Neteler <neteler@osgeo.org>:

On Tue, Jan 20, 2009 at 11:20 AM, Maris Nartiss <maris.gis@gmail.com> wrote:

Hello,
there was similar issue reported on Mac. It comes from tcl.h where
they recommend not to use result:
463 typedef struct Tcl_Interp {
464 /* TIP #330: Strongly discourage extensions from using the
string result. */
465 #ifdef USE_INTERP_RESULT

Good hint!

They propose to use Tcl_GetObjResult():
http://wiki.tcl.tk/21120

Is the following patch nonsense?

Index: form.c

--- form.c (revision 35372)
+++ form.c (working copy)
@@ -192,7 +192,7 @@
                   TCL_ERROR) {
                   G_warning
                       ("Could not set Tcl system encoding to '%s' (%s)",
- Columns[i].value, interp->result);
+ Columns[i].value, (char *) Tcl_GetObjResult(interp));
               }
           }
           continue;

Wild guessing :slight_smile:
Markus

On Wed, Jan 21, 2009 at 5:58 PM, Maris Nartiss <maris.gis@gmail.com> wrote:

Yes, it is :slight_smile:
In short - no one has eliminated old tcl/tk versions out there. Any
patch needs to work with old and new approach too. Also forms isn't
the only place where interp result is used (lazy to grep)

This is the list:
./lib/form/form.c
./vector/v.digit/form.c
./visualization/nviz/src/anim_support.c
./visualization/nviz/src/cutplane_obj.c
./visualization/nviz/src/do_zoom.c
./visualization/nviz/src/draw.c
./visualization/nviz/src/exag.c
./visualization/nviz/src/lights.c
./visualization/nviz/src/map_obj.c
./visualization/nviz/src/misc.c
./visualization/nviz/src/mkdspf_main.c
./visualization/nviz/src/nvizAppInit.c
./visualization/nviz/src/nviz_init.c
./visualization/nviz/src/position.c
./visualization/nviz/src/togl_flythrough.c
./visualization/nviz/src/volume.c

I am willing to fix it if someone tells me how.

The lack of ./lib/form/form.c fix breaks some more modules,
so that's of priority.

Markus

On Wed, Jan 21, 2009 at 6:15 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Wed, Jan 21, 2009 at 5:58 PM, Maris Nartiss <maris.gis@gmail.com> wrote:

In short - no one has eliminated old tcl/tk versions out there. Any
patch needs to work with old and new approach too. Also forms isn't
the only place where interp result is used (lazy to grep)

This is the list:
./lib/form/form.c
./vector/v.digit/form.c
./visualization/nviz/src/anim_support.c
./visualization/nviz/src/cutplane_obj.c
./visualization/nviz/src/do_zoom.c
./visualization/nviz/src/draw.c
./visualization/nviz/src/exag.c
./visualization/nviz/src/lights.c
./visualization/nviz/src/map_obj.c
./visualization/nviz/src/misc.c
./visualization/nviz/src/mkdspf_main.c
./visualization/nviz/src/nvizAppInit.c
./visualization/nviz/src/nviz_init.c
./visualization/nviz/src/position.c
./visualization/nviz/src/togl_flythrough.c
./visualization/nviz/src/volume.c

I am willing to fix it if someone tells me how.

The lack of ./lib/form/form.c fix breaks some more modules,
so that's of priority.

I see
http://www.tcl.tk/cgi-bin/tct/tip/330.html
http://www.nabble.com/Re:-TIP--330-and-(void)-Tcl_GetStringResult(interp)-calls-in-the-core-td21045974.html

Please :slight_smile:
Nobody can tell me how to fix this?

Is it this?
http://wiki.tcl.tk/1564

Index: lib/form/form.c

--- lib/form/form.c (revision 35532)
+++ lib/form/form.c (working copy)
@@ -192,7 +192,7 @@
                    TCL_ERROR) {
                    G_warning
                        ("Could not set Tcl system encoding to '%s' (%s)",
- Columns[i].value, interp->result);
+ Columns[i].value, Tcl_GetStringResult(interp));
                }
            }
            continue;

?

Markus

On Tue, Jan 20, 2009 at 11:20 AM, Maris Nartiss <maris.gis@gmail.com> wrote:

Hello,
there was similar issue reported on Mac. It comes from tcl.h where
they recommend not to use result:
463 typedef struct Tcl_Interp {
464 /* TIP #330: Strongly discourage extensions from using the
string result. */
465 #ifdef USE_INTERP_RESULT

I'm not a make process guru to propose solution.

What do you need? I have added TCL_VERSION to
configure which is now set as well.

In IRC, #tcl channel they suggested
Tcl_GetString(Tcl_GetObjResult(interp))
to me.
?

Code:
http://trac.osgeo.org/grass/browser/grass/branches/develbranch_6/lib/form/form.c#L195

Really lost here,
Markus