[Pkg-tcltk-devel] Tcl 8.6: undefined reference to `tclStubsPtr'
sgolovan at nes.ru
Sun Oct 5 06:11:53 UTC 2014
On Sat, Oct 4, 2014 at 6:13 PM, Ole Streicher <olebole at debian.org> wrote:
> I am trying to build a new version (7.3) of my saods9 package which
> comes with a builtin tcl interpreter. When I replace this interpreter
> with the one in Debian unstable (tcl8.6_8.6.2+dfsg-1), I get lots of
> errors like
> .../lib/libtcliis1.0.a(iistcl.o): In function `Tcliis_Init':
> /tmp/buildd/saods9-7.3+dfsg/tcliis1.0/iistcl.C:52: undefined reference to `tclStubsPtr'
> /tmp/buildd/saods9-7.3+dfsg/tcliis1.0/iistcl.C:58: undefined reference to `tclStubsPtr'
There was a recent change connected with tclStubsPtr which for some
old code results in these compiling errors. Let me describe what
tclStubsPtr is for:
In Tcl extensions can be linked with some specific Tcl library
(libtcl8.5.so or libtcl8.6.so) but can instead be linked with the so
called stubs library (libtclstubs8.5.a or libtclstub8.6.a).
In the first case the linker loads the library and allows to use the
symbols in it.
In the latter case one have to define USE_TCL_STUBS macro which
replaces all calls to Tcl_* procedures by tclStubsPtr->something
pointers (effectively, all Tcl_* symbols become macros). the
tclStubsPtr refers to a large table with pointers to all Tcl_*
procedures. Also, in this case the extension init procedure must call
Tcl_InitStubs which populates this table.
In the not so distant past the main library libtcl8.5.so also
contained this tclStubsPtr table, so if you defined USE_TCL_STUBS
accidentally you still could link to libtcl8.5 and everything worked.
But recently this table was removed form there and kept only in
This means that either your extension uses stubs, defines
USE_TCL_STUBS and links to libtclstubs.so, or it doesn't define
USE_TCL_STUBS and links to libtcl.so. You can't mix both ways.
In your case I don't know which is better: to add -ltclstub to the
libraries list or to remove -DUSE_TCL_STUBS from the defines list.
Probably any of those will suffice.
Note, that for Tk stubs there's similar change.
More information about the Pkg-tcltk-devel