metakit doesn't compile with TCL8.6 + solution to fix it

Sébastien Santoro dereckson at espace-win.org
Sat Feb 7 06:27:38 PST 2009


Hi,

Metakit port doesn't compile with TCL 8.6 (port lang/tcl86-threads
package tcl-threads-8.6.b.1) .

It should, as http://wiki.tcl.tk/15781 specifies Wub requires TCL 8.6
to run WubWikit, built on the top of Mk.

3 things are to modify. After that, that compiles fine and passes the
make test (strangely, you have to make install before make test to
allow him to find libraries)

The FreeBSD port compilation output is at the end of the mail.

FIRST PROBLEM - STUBS
=====================

To fix the problem, USE_TCL_STUBS should be defined at 0 but mk4tcl.h
defines it auto at 1 if PIC is defined. I didn't investigate on the
PIC define.

So to compile it:
(1) In builds/Makefile, removes -DUSE_TCL_STUBS
(2) a patch to ask mk4tcl.h not to define USE_TCL_STUBS

SECOND PROBLEM - Tcl_Interp struct errorLine member
=============================================

errorLine isn't enabled anymore by default.

USE_INTERP_ERRORLINE must be defined.

FIX : add -DUSE_INTERP_ERRORLINE in Makefile

typedef struct Tcl_Interp {
    /* TIP #330: Strongly discourage extensions from using the string result. */
#ifdef USE_INTERP_RESULT
    char *result;               /* If the last command returned a string
                                 * result, this points to it. */
    void (*freeProc) (char *blockPtr);
                                /* Zero means the string result is statically
                                 * allocated. TCL_DYNAMIC means it was
                                 * allocated with ckalloc and should be freed
                                 * with ckfree. Other values give the address
                                 * of function to invoke to free the result.
                                 * Tcl_Eval must free it before executing next
                                 * command. */
#else
    char* unused3;
    void (*unused4) (char*);
#endif
#ifdef USE_INTERP_ERRORLINE
    int errorLine;              /* When TCL_ERROR is returned, this gives the
                                 * line number within the command where the
                                 * error occurred (1 if first line). */
#else
    int unused5;
#endif
} Tcl_Interp;

THIRD PROBLEM
==============

g++ -c -g -O2  -fPIC  -I../unix/../include
-I/usr/local/include/tcl8.6/generic -I/usr/local/include/tcl8.6
-DUSE_INTERP_ERRORLINE ../unix/../tcl/mk4tcl.cpp
../unix/../tcl/mk4tcl.cpp: In function 'const c4_Property&
AsProperty(Tcl_Obj*, const c4_View&)':
../unix/../tcl/mk4tcl.cpp:982: error: invalid conversion from 'const
Tcl_ObjType*' to 'Tcl_ObjType*'
../unix/../tcl/mk4tcl.cpp: In function 'int
SetCursorFromAny(Tcl_Interp*, Tcl_Obj*)':
../unix/../tcl/mk4tcl.cpp:1086: error: invalid conversion from 'const
Tcl_ObjType*' to 'Tcl_ObjType*'

Indeed, in tcl.h, *typePtr is a constant:

typedef struct Tcl_Obj {
    const Tcl_ObjType *typePtr; /* Denotes the object's type. Always
                                 * corresponds to the type of the object's
                                 * internal rep. NULL indicates the object has
                                 * no internal rep (has no type). */

}

Solution: at lines 982 and 1086, declares the types as const Tcl_ObjType*

Cf. patch

PORT MAKE OUTPUT
=================

/usr/ports/databases/metakit ] uname -a
FreeBSD daventry.espace-win.org 7.0-RELEASE FreeBSD 7.0-RELEASE #0:
Wed May 21 10:13:51 UTC 2008
root at localhost.localdomain:/usr/obj/usr/src/sys/OVH7  amd64

/usr/ports/databases/metakit ] make
===>  Building for metakit-2.4.9.7
c++ -c -O2 -fno-strict-aliasing -pipe  -fPIC -DUSE_TCL_STUBS
-I./../unix/../include -I/usr/local/include/tcl8.6/generic
-I/usr/local/include/tcl8.6 ./../unix/../tcl/mk4tcl.cpp
In file included from ./../unix/../tcl/mk4tcl.cpp:26:
./../unix/../tcl/stubtcl.h:3: error: conflicting declaration
'TclStubs* tclStubsPtr'
/usr/local/include/tcl8.6/generic/tclDecls.h:4465: error:
'tclStubsPtr' has a previous declaration as 'const TclStubs*
tclStubsPtr'
./../unix/../tcl/stubtcl.h:4: error: conflicting declaration
'TclPlatStubs* tclPlatStubsPtr'
/usr/local/include/tcl8.6/generic/tclPlatDecls.h:98: error:
'tclPlatStubsPtr' has a previous declaration as 'const TclPlatStubs*
tclPlatStubsPtr'
./../unix/../tcl/stubtcl.h: In function 'int MyInitStubs(Tcl_Interp*)':
./../unix/../tcl/stubtcl.h:19: error: 'struct Tcl_Interp' has no
member named 'result'
./../unix/../tcl/stubtcl.h:20: error: 'struct Tcl_Interp' has no
member named 'freeProc'
./../unix/../tcl/stubtcl.h:33: error: invalid conversion from 'const
TclIntStubs* const' to 'TclIntStubs*'
./../unix/../tcl/stubtcl.h:34: error: invalid conversion from 'const
TclIntPlatStubs* const' to 'TclIntPlatStubs*'
./../unix/../tcl/mk4tcl.cpp: In function 'const c4_Property&
AsProperty(Tcl_Obj*, const c4_View&)':
./../unix/../tcl/mk4tcl.cpp:982: error: invalid conversion from 'const
Tcl_ObjType*' to 'Tcl_ObjType*'
./../unix/../tcl/mk4tcl.cpp: In function 'int
SetCursorFromAny(Tcl_Interp*, Tcl_Obj*)':
./../unix/../tcl/mk4tcl.cpp:1086: error: invalid conversion from
'const Tcl_ObjType*' to 'Tcl_ObjType*'
./../unix/../tcl/mk4tcl.cpp: In member function 'int MkTcl::LoopCmd()':
./../unix/../tcl/mk4tcl.cpp:2159: error: 'struct Tcl_Interp' has no
member named 'errorLine'
*** Error code 1

Stop in /usr/ports/databases/metakit/work/metakit-2.4.9.7/builds.
*** Error code 1

Stop in /usr/ports/databases/metakit.
*** Error code 1

Stop in /usr/ports/databases/metakit.

-- 
Sébastien Santoro aka Dereckson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: metakit-const-Tcl_Obj.patch
Type: application/octet-stream
Size: 683 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20090207/12ce62a9/metakit-const-Tcl_Obj.obj


More information about the freebsd-ports mailing list