Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

tclkit.exe and multiple threads

91 views
Skip to first unread message

seanna...@yahoo.com

unread,
May 9, 2006, 3:18:00 PM5/9/06
to
Hello, we use tclkit.exe to wrap tcl code into an exe. Currently this
exe does not support multi-threads and I would like to make it support
multi-threads. I know how to build a threaded version of wish and
tclsh, but how do we build multiple thread support into the exe created
by tclkit?

Michael Schlenker

unread,
May 9, 2006, 3:25:55 PM5/9/06
to
seanna...@yahoo.com schrieb:
The simplest way would be to use dqkit instead of tclkit, which is
threaded by default and comes with some extra extensions built in.

See:
http://sourceforge.net/project/showfiles.php?group_id=99106&package_id=106219

Michael

seanna...@yahoo.com

unread,
May 9, 2006, 8:12:31 PM5/9/06
to
I'm not sure what I'm supposed to do. I downloaded
kit-8.5a4-build2-win32-MTall.exe. I thought it would be a kit with
utilities to wrap tcl files into an exe. But it actually turned out to
be a wish.exe replacement. And it does not know the command,
"thread::create". I thought it had threading built in?

I also downloaded dqkit-20060505-sources.tar.gz. it has all kinds of
software but it doesn't have a central makefile to build TCL with all
the extra extensions.

any suggestions?

Michael Schlenker

unread,
May 9, 2006, 8:21:24 PM5/9/06
to
seanna...@yahoo.com schrieb:

> I'm not sure what I'm supposed to do. I downloaded
> kit-8.5a4-build2-win32-MTall.exe. I thought it would be a kit with
> utilities to wrap tcl files into an exe. But it actually turned out to
> be a wish.exe replacement. And it does not know the command,
> "thread::create". I thought it had threading built in?

Did you do a 'package require thread' in your code? Event if the thread
package is there it isn't automatically loaded.

The dqkit runtime is just a different runtime than tclkit, you can use
the usual sdx tool to create exe files with your payload.

Michael

seanna...@yahoo.com

unread,
May 9, 2006, 8:51:20 PM5/9/06
to
ok thanks a lot.

Don Porter

unread,
May 9, 2006, 8:54:43 PM5/9/06
to
Michael Schlenker wrote:
> Did you do a 'package require thread' in your code?

Package names are case sensitive. You mean [package require Thread].

--
| Don Porter Mathematical and Computational Sciences Division |
| donald...@nist.gov Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|

Adrian Ho

unread,
May 9, 2006, 9:30:44 PM5/9/06
to
On 2006-05-10, seanna...@yahoo.com <seanna...@yahoo.com> wrote:
> I'm not sure what I'm supposed to do. I downloaded
> kit-8.5a4-build2-win32-MTall.exe. I thought it would be a kit with
> utilities to wrap tcl files into an exe. But it actually turned out to
> be a wish.exe replacement.

It's actually more of a tclkit.exe replacement. Wrapping stuff with
either one requires a separate tool like sdx <http://wiki.tcl.tk/3411>.

> I also downloaded dqkit-20060505-sources.tar.gz. it has all kinds of
> software but it doesn't have a central makefile to build TCL with all
> the extra extensions.

dqkit is built using a Tcl script (buildkit). See the gen/ subdirectory
for that script plus a *nix script (common.sh) that (re-)builds the
dqkit combinations that are available for download on SourceForge.

common.sh should be simple enough that even non-*nix users should be able
to figure out what's going on, but if you run into any trouble with it,
yell for help right here on c.l.t. 8-)

- Adrian

seanna...@yahoo.com

unread,
May 10, 2006, 2:44:55 PM5/10/06
to


I got the following errors:

D:\a\dqkitsrc\dqkit-0.10>tclsh gen\buildkit
hostname 1
Beginning compilation steps: options, setupdirs, unpack, tcl, mk, res,
zlib, vfs
, link, finalize.

[ 1/10] options

[ 2/10] setupdirs

[ 3/10] unpack
unpack D:/a/dqkitsrc/dqkit-0.10/dl/openssl-0.9.6.tar.gz t...
tar -xzf ../dl/openssl-0.9.6.tar.gz

[ 4/10] tcl
sh autoconf
child process exited abnormally
while executing
"exec >@file89d3b0 2>@file89d3b0 sh autoconf"
("eval" body line 1)
invoked from within
"eval [concat [list exec >@$fh 2>@$fh] $cmd]"
(procedure "out::oexec" line 5)
invoked from within
"out::oexec {sh autoconf}"
(procedure "dirconfigure" line 14)
invoked from within
"dirconfigure 1 0 D:/a/dqkitsrc/dqkit-0.10/src/tcl-8.4.13/win
D:/a/dqkitsrc/dqki
t-0.10/build/a20040807-nonthreaded/tcl --disable-shared
--disable-threa..."
("eval" body line 1)
invoked from within
"eval [concat [list dirconfigure 1 0 [file join $srcdir
[utils::platformdir]] [p
wd]] $args]"
(procedure "conf::norelplatformconfigure" line 2)
invoked from within
"conf::norelplatformconfigure [part::srcdir tcl] --disable-shared
[conf::c_disen
thread threads] [conf::c_disen debug symbols]"
(procedure "::part::_build_tcl" line 6)
invoked from within
"::part::_build_tcl"
("eval" body line 1)
invoked from within
"eval $::part::part($component,buildproc)"
(procedure "_compile" line 9)
invoked from within
"_compile $n"
(procedure "main::build" line 21)
invoked from within
"main::build {}"
invoked from within
"if {[llength $argv]>0} {
main::[lindex $argv 0] [lrange $argv 1 end]
exit 0
} else {
main::build {}
exit 0
}"
(file "gen\buildkit" line 1295)

D:\a\dqkitsrc\dqkit-0.10>bash gen/common.sh
hostname 1
Beginning compilation steps: options, setupdirs, unpack, tcl, thread,
mk, tbcloa
d, tk, itcl, blt, res, openssl, tls, tktreectrl, tclcompiler, tktable,
itk, iwid
gets, zlib, expect, sqlite, tclx, tdom, tcludp, sqlite3, tile, vfs,
link, finali
ze.

[ 1/29] options

[ 2/29] setupdirs

[ 3/29] unpack

[ 4/29] tcl
sh autoconf
child process exited abnormally
while executing
"exec >@file89f408 2>@file89f408 sh autoconf"
("eval" body line 1)
invoked from within
"eval [concat [list exec >@$fh 2>@$fh] $cmd]"
(procedure "out::oexec" line 5)
invoked from within
"out::oexec {sh autoconf}"
(procedure "dirconfigure" line 14)
invoked from within
"dirconfigure 1 0 D:/a/dqkitsrc/dqkit-0.10/src/tcl-8.4.13/win
D:/a/dqkitsrc/dqki
t-0.10/build/a20040807-threaded/tcl --disable-shared --enable-threads
-..."
("eval" body line 1)
invoked from within
"eval [concat [list dirconfigure 1 0 [file join $srcdir
[utils::platformdir]] [p
wd]] $args]"
(procedure "conf::norelplatformconfigure" line 2)
invoked from within
"conf::norelplatformconfigure [part::srcdir tcl] --disable-shared
[conf::c_disen
thread threads] [conf::c_disen debug symbols]"
(procedure "::part::_build_tcl" line 6)
invoked from within
"::part::_build_tcl"
("eval" body line 1)
invoked from within
"eval $::part::part($component,buildproc)"
(procedure "_compile" line 9)
invoked from within
"_compile $n"
(procedure "main::build" line 21)
invoked from within
"main::[lindex $argv 0] [lrange $argv 1 end]"
invoked from within
"if {[llength $argv]>0} {
main::[lindex $argv 0] [lrange $argv 1 end]
exit 0
} else {
main::build {}
exit 0
}"
(file "gen/buildkit" line 1295)

Wojciech Kocjan

unread,
May 10, 2006, 4:46:07 PM5/10/06
to
On Wed, 10 May 2006 20:44:55 +0200, <seanna...@yahoo.com> wrote:

>
> Adrian Ho wrote:
>> On 2006-05-10, seanna...@yahoo.com <seanna...@yahoo.com> wrote:
>
>> dqkit is built using a Tcl script (buildkit). See the gen/ subdirectory
>> for that script plus a *nix script (common.sh) that (re-)builds the
>> dqkit combinations that are available for download on SourceForge.
>>
>> common.sh should be simple enough that even non-*nix users should be
>> able
>> to figure out what's going on, but if you run into any trouble with it,
>> yell for help right here on c.l.t. 8-)
>>
>> - Adrian
>
>
> I got the following errors:
>
> D:\a\dqkitsrc\dqkit-0.10>tclsh gen\buildkit
> hostname 1
> Beginning compilation steps: options, setupdirs, unpack, tcl, mk, res,
> zlib, vfs
> , link, finalize.
>
> [ 1/10] options
>
> [ 2/10] setupdirs
>
> [ 3/10] unpack
> unpack D:/a/dqkitsrc/dqkit-0.10/dl/openssl-0.9.6.tar.gz t...
> tar -xzf ../dl/openssl-0.9.6.tar.gz
>
> [ 4/10] tcl
> sh autoconf

> [...]

Read out/*/tcl and see the error.

Basically I compile dqkit with mingw snapshot from tcl project on SF and
cygwin.

Also, in mingw, bin/gcc needs to be copied as bin/cc. And in cygwin
bin/autoconf-2.13 as bin/autoconf.

assuming C:/cygwin and C:/mingw, then try:

path C:\mingw\bin;C:\cygwin\bin;%PATH%
tclsh gen/buildkit build -tcl,tk=8.4.* -resfile=current -compression=none
-binary=b1

--
WK

seanna...@yahoo.com

unread,
May 10, 2006, 6:06:26 PM5/10/06
to

thanks for your help.
i tried your steps and building tcl failed. here's my out/*/tcl.


sh autoconf
bash ../../../src/tcl-8.4.13/win/configure
--prefix=D:/a/dqkitsrc/dqkit-0.10/install/a20040807-nonthreaded
--exec-prefix=D:/a/dqkitsrc/dqkit-0.10/install/a20040807-nonthreaded
--disable-shared --disable-threads --disable-symbols
creating cache ./config.cache
checking for gcc... gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking for ar... ar
checking for ranlib... ranlib
checking for windres... windres
checking whether make sets ${MAKE}...
../../../src/tcl-8.4.13/win/configure: eval: line 918: unexpected EOF
while looking for matching `"'
../../../src/tcl-8.4.13/win/configure: eval: line 919: syntax error:
unexpected end of file
no
checking for Cygwin environment... no
checking for SEH support in compiler... no
checking for EXCEPTION_DISPOSITION support in include files... yes
checking for LPFN_ACCEPT support in winsock2.h... no
checking for winnt.h that ignores VOID define... yes
checking for alloca declaration in malloc.h... yes
checking for cast to union support... yes
checking for object suffix... o
checking for mingw32 environment... yes
checking for executable suffix... .exe
checking for building with threads... no (default)
checking how to build libraries... static
checking if 64bit support is requested... no
checking for cygpath... cygpath -w
checking for Windows native path bug in windres... no
checking compiler flags... using static flags
checking for build with symbols... no
checking how to run the C preprocessor... gcc -E
checking for errno.h... yes
updating cache ./config.cache
creating ./config.status
creating Makefile
creating tclConfig.sh
creating tcl.hpj
make binaries
sed: -e expression #1, char 7: unterminated `s' command
sed: -e expression #1, char 7: unterminated `s' command
gcc -c -O2 -fomit-frame-pointer -Wall -Wconversion -I"" -I""
-DHAVE_NO_SEH=1 -DHAVE_NO_LPFN_DECLS=1 -DHAVE_WINNT_IGNORE_VOID=1
-DHAVE_CAST_TO_UNION=1 -DSTATIC_BUILD=1 -DBUILD_tcl
"d:\a\dqkitsrc\dqkit-0.10\src\tcl-8.4.13\generic\regcomp.c" -o
regcomp.o
sed: -e expression #1, char 7: unterminated `s' command
sed: -e expression #1, char 7: unterminated `s' command
gcc -c -O2 -fomit-frame-pointer -Wall -Wconversion -I"" -I""
-DHAVE_NO_SEH=1 -DHAVE_NO_LPFN_DECLS=1 -DHAVE_WINNT_IGNORE_VOID=1
-DHAVE_CAST_TO_UNION=1 -DSTATIC_BUILD=1 -DBUILD_tcl
"d:\a\dqkitsrc\dqkit-0.10\src\tcl-8.4.13\generic\regexec.c" -o
regexec.o
sed: -e expression #1, char 7: unterminated `s' command
sed: -e expression #1, char 7: unterminated `s' command
gcc -c -O2 -fomit-frame-pointer -Wall -Wconversion -I"" -I""
-DHAVE_NO_SEH=1 -DHAVE_NO_LPFN_DECLS=1 -DHAVE_WINNT_IGNORE_VOID=1
-DHAVE_CAST_TO_UNION=1 -DSTATIC_BUILD=1 -DBUILD_tcl
"d:\a\dqkitsrc\dqkit-0.10\src\tcl-8.4.13\generic\regfree.c" -o
regfree.o
sed: -e expression #1, char 7: unterminated `s' command
sed: -e expression #1, char 7: unterminated `s' command
gcc -c -O2 -fomit-frame-pointer -Wall -Wconversion -I"" -I""
-DHAVE_NO_SEH=1 -DHAVE_NO_LPFN_DECLS=1 -DHAVE_WINNT_IGNORE_VOID=1
-DHAVE_CAST_TO_UNION=1 -DSTATIC_BUILD=1 -DBUILD_tcl
"d:\a\dqkitsrc\dqkit-0.10\src\tcl-8.4.13\generic\regerror.c" -o
regerror.o
sed: -e expression #1, char 7: unterminated `s' command
sed: -e expression #1, char 7: unterminated `s' command
gcc -c -O2 -fomit-frame-pointer -Wall -Wconversion -I"" -I""
-DHAVE_NO_SEH=1 -DHAVE_NO_LPFN_DECLS=1 -DHAVE_WINNT_IGNORE_VOID=1
-DHAVE_CAST_TO_UNION=1 -DSTATIC_BUILD=1 -DBUILD_tcl
"d:\a\dqkitsrc\dqkit-0.10\src\tcl-8.4.13\generic\tclAlloc.c" -o
tclAlloc.o
In file included from
d:/a/dqkitsrc/dqkit-0.10/src/tcl-8.4.13/generic/tclPort.h:22,
from
d:\a\dqkitsrc\dqkit-0.10\src\tcl-8.4.13\generic\tclAlloc.c:29:
d:/a/dqkitsrc/dqkit-0.10/src/tcl-8.4.13/generic/../win/tclWinPort.h:532:
tclIntPlatDecls.h: No such file or directory
d:\dqmingw\mingw\bin\make.exe: *** [tclAlloc.o] Error 1

Wojciech Kocjan

unread,
May 11, 2006, 1:18:21 AM5/11/06
to
On Thu, 11 May 2006 00:06:26 +0200, <seanna...@yahoo.com> wrote:
> [...]

> make binaries
> sed: -e expression #1, char 7: unterminated `s' command
> sed: -e expression #1, char 7: unterminated `s' command
> gcc -c -O2 -fomit-frame-pointer -Wall -Wconversion -I"" -I""
> -DHAVE_NO_SEH=1 -DHAVE_NO_LPFN_DECLS=1 -DHAVE_WINNT_IGNORE_VOID=1
> -DHAVE_CAST_TO_UNION=1 -DSTATIC_BUILD=1 -DBUILD_tcl
> [...]

Not really sure why this happens. Could you set up the path as you would
do for the build and throw the output of (you can cut parts not related to
cygwin/mingw/msys/whatever, but please don't remove "windows" lines"):

tclsh
% join [split $::env(PATH) \;] \n

And
C> which sed
C> which gcc
C> which bash

--
WK

Eckhard Lehmann

unread,
May 11, 2006, 4:37:45 AM5/11/06
to

I finally managed to compile a small section on this topic on my
homepage. There you can find threaded Tclkits for Linux and Windows as
well as an adapted genkit.tcl which I use to build the tclkits.
The use of my genkit.tcl to build Tclkit is not encouraged... it could
be that there are problems. I did not take care about making these
genkit files a generic build system that is supposed to work
everywhere, just made it work for me. Some issues are documented on the
site and probably it will work for others too. It would be good to have
the changes (MinGW support and a -threaded flag) in the official
version of genkit one day...
Still the easiest way is to download and use the appropriate tclkit
binary, if one doesn't want to do unusual things ;-).

The link: http://e-lehmann.de/?page_id=31


Eckhard

seanna...@yahoo.com

unread,
May 11, 2006, 4:19:34 PM5/11/06
to
here's my info

D:\rptbase\cur\rpt>tclsh


% join [split $::env(PATH) \;] \n

d:\dqmingw\mingw\bin
C:\Tcl\bin
c:\cygwin\bin
c:\cygwin\usr\bin
c:\mks\mkssi
c:\mks\mksnt
c:\bc5\bin
c:\bc5\lib
c:\scripts
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\Program Files\Hummingbird\Connectivity\7.00\Accessories\
c:\apps
c:\vim\vim62
C:\Program Files\Microsoft Visual Studio\Common\msdev98\BIN
C:\Program Files\Microsoft Visual Studio\VC98\BIN
C:\Program Files\Microsoft Visual Studio\Common\TOOLS
d:\matlab\bin\win32
d:\perforce
d:\python
C:\BC5\BIN

D:\rptbase\cur\rpt>which sed
/usr/bin/sed

D:\rptbase\cur\rpt>which gcc
/cygdrive/d/dqmingw/mingw/bin/gcc

D:\rptbase\cur\rpt>which bash
/usr/bin/bash

seanna...@yahoo.com

unread,
May 11, 2006, 6:54:47 PM5/11/06
to
thanks, for the info. i tried your tclkit.exe but it crashed. it's
possible that we need the 8.4.12 or 13. it could also very well be
that i don't know how to wrap up an exe. here's the command that we
use.

C:\Tcl\bin\tclsh84.exe C:/Tcl/bin/tclapp.tcl -verbose -prefix
tclkit.exe -icon D:/rptbase/cur/rpt/images/rcviewer.ico -out
rptviewer.exe -code {set ::RELEASE 1} -anchor / -startup rtmain.tcl
axipdggui.tcl axipdstgui.tcl axippdgui.tcl axiptsgui.tcl mdi.tcl ...

Eckhard Lehmann

unread,
May 12, 2006, 2:34:45 AM5/12/06
to

seanna...@yahoo.com wrote:
> thanks, for the info. i tried your tclkit.exe but it crashed. it's
> possible that we need the 8.4.12 or 13. it could also very well be
> that i don't know how to wrap up an exe. here's the command that we
> use.

Did you use tclkit.exe 8.4.9? Where did it crash? Do you have C
extensions in your app that rely on Itcl, e.g. Itk? What about the
tclkitsh.exe, does it crash as well (it's 8.4.13)?

Would be nice to get some input on this... I don't feel comfortable
with providing programs that don't work.


Eckhard

seanna...@yahoo.com

unread,
May 15, 2006, 2:10:13 PM5/15/06
to
I can't remember if I used 8.4.9 because I can't seem to find the
website that states what version it is. I do know that it was less
than 8.4.12. I don't believe we have C ext relying on Itcl nor Itk. I
have not used tclkitsh.exe because our app requires Tk.

Eckhard Lehmann

unread,
May 16, 2006, 4:45:28 AM5/16/06
to

I built Tk into tclkitsh, it can be obtained by "package re Tk". Only
drawback is, that there is always a cmd running in the background.
The Tclkit has been updated as well to version 8.4.13 on my site,
including the vfs patch for Tk bug 1468291. But because of some changes
in Itcl, you really must rebuild all Itcl dependend extensions,
*including Itk* - if you use them. I've had crashes when I tried it
with Itk from ActiveTcl and also needed to recompile a self-written C
extension that uses Itcl_RegisterObjC(). This is due to a change I made
to one of the internal structures and a regeneration of the stub'ified
functions.
You also should remove any Itcl from ::auto_path in your programs - the
Itcl that is going to be used should be the one that is built into
tclkit, to avoid any confusion.

That's the only reason I can imagine why the tclkit crashes. Apart from
that it always worked fine for me, in heavily used applications...


Eckhard

seanna...@yahoo.com

unread,
May 16, 2006, 3:11:49 PM5/16/06
to

When i use tclkitsh.exe, it complains that there's no console command.
Even if I do the package require Tk. I don't really know what you mean
when you say there's a cmd running in the background. Do you mean a
command window?

D:\rptbase\cur\rpt>rpt
invalid command name "console"
while executing
"# Compiled -- no source code available
error "called a copy of a compiled script""
invoked from within
"tbcload::bceval {
TclPro ByteCode 2 0 1.4 8.4
40 0 391 80 0 0 236 0 6 40 40 -1 -1
391
w0E<!:B`W!*TA9v0|yTv6qQ>!0W&=!5`8s!6G:3w6,Ts!M`yTv2uS=!>,f=!9_Lq..."
(file "D:/rptbase/cur/rpt/rpt.exe/rtengine.tcl" line 23)
invoked from within
"source $startup"
(file "D:/rptbase/cur/rpt/rpt.exe/main.tcl" line 23)

Eckhard Lehmann

unread,
May 17, 2006, 2:15:28 AM5/17/06
to

seanna...@yahoo.com wrote:
> Eckhard Lehmann wrote:

> When i use tclkitsh.exe, it complains that there's no console command.

shure, [console] is not available in tclkitsh, since it is built upon
tclsh, where [concole] is also not available. It is a wish command on
windows...

> Even if I do the package require Tk. I don't really know what you mean
> when you say there's a cmd running in the background. Do you mean a
> command window?

Yes, exactly. But when your program requires [concole], you must use
tclkit, not tclkitsh - unless you can remove this dependency. Does the
new built of tclkit work for you?


> D:\rptbase\cur\rpt>rpt
> invalid command name "console"
> while executing
> "# Compiled -- no source code available
> error "called a copy of a compiled script""
> invoked from within
> "tbcload::bceval {
> TclPro ByteCode 2 0 1.4 8.4
> 40 0 391 80 0 0 236 0 6 40 40 -1 -1

[...]

Is this bytecode from TclDevkit compiler? I didn't test the tclkits
with this bytecode. It *could* be that this is a problem, but I don't
know...


Eckhard

seanna...@yahoo.com

unread,
May 19, 2006, 2:25:02 PM5/19/06
to

Eckhard Lehmann wrote:
>
> Does the new built of tclkit work for you?
>

I took out the console command and i get the common microsoft crash
dialog, "rptviewer.exe has encountered a problem and needs to close..."
We have a lot of packages that we load, but i'm assuming loading the
BLT is the culprit. Did you use mingw to build your tclkit?

> Is this bytecode from TclDevkit compiler? I didn't test the tclkits
> with this bytecode. It *could* be that this is a problem, but I don't
> know...
>

The bytecode is from our code. thanks for your help.

Eckhard Lehmann

unread,
May 21, 2006, 8:45:44 AM5/21/06
to

seanna...@yahoo.com wrote:

> I took out the console command and i get the common microsoft crash
> dialog, "rptviewer.exe has encountered a problem and needs to close..."
> We have a lot of packages that we load, but i'm assuming loading the
> BLT is the culprit. Did you use mingw to build your tclkit?

Yes, it's built with MinGW, the official version from www.mingw.org
(there is a mingw version floating around on tcl.sf.net as well...).
If BLT was not built with MinGW, it can make trouble, yes. I don't know
much about BLT... but - on the other side - if it is stub-ified, that
shouldn't be an issue. Does this BLT distribution work with a "normal"
MinGW built Tcl?

Anyway, in this case it is probably better to use DQkit, as the others
mentioned. I think it includes BLT..


Eckhard

0 new messages