A Poor Boy does Deployment

2002-09-16 (September 16, 2002)

So here we are again... the last time I released any code to the world at large was on July 22, 2002... about two months ago. Now this doesn't mean that I haven't been tcl'ing - I just can't get enough! So what does it mean?

It means deployment SUCKS! I WANT TO KILL IT

Do what your users do

When developing, it's a MUST that you run your code with the interpreter that your users are going to be using. If you don't do this, then you're just going to get so angry when you find that your program just won't run with the binary from that new wrapping tool you're using.

Let me give you some concrete examples from my own painful development/deployment. When I write fun code, I choose Tcl/Tk because it's fast. I write and it doesn't work what ever, I hack it till it does. Sure I won't win any ACM awards for its engineering, but life is more exciting that way.

looking for my own head

So I take my code, usually the bootstrap code is called something like main.tcl, and it calls a bunch of libraries that I write for that app, in something like a scripts/ directory. Now I want this code to run - I don't mean every tiny detail looking the same - I just mean PLEASE RUN when wrapped for distribution to my buddies.

But damn it, main.tcl just can't find its scripts when wrapped! This is using freewrap, which totally munges the paths of files when wrapped. Not to mention doesn't work anymore (5.2 and 5.3 introduced a wicked bug where the freewrap'ed app just sits there when run from a path that contains spaces - like C:\My Documents\My Pictures).

Now don't get me wrong, freewrap is cool. But talk about a NON-INTUITIVE (read - INSANE) way of packing the paths. It drove me just about nuts trying to figure this out. Btw, this is because it embeds the current working directory of your project inside the wrapped app, i.e. inside your ZVFS. So it's like - where you executed the command becomes part of the product. I used to accept this because hey it's insane, but it works.

freewrap served me well for Mind Web, and it sure looks like it works for a bunch of other people, since my fave mp3 player snackamp uses it too for distro to windows boxes. So I'm not trashing freewrap, just blame it on my psychosis.

All this pain that I feel would be better understood if you could witness my sleepless nights, my tossing and turning, my mute silence when with others, and the wild-eyed glare that is so evident when glancing in the mirror.

what the hell is eq, use string equal

The second problem with wrapping it, apart from having a hell of a time figuring it out, and then finding weird bugs in it, is that it just totally divorces you from your great users. You develop and test using something like ActiveTcl, then all of a sudden a different version of the Tcl/Tk interpreter gets wrapped with your scripts. This is not good at all, because you might be using 8.4 features but deploying it with 8.3 - MADNESS WILL SURELY ENSUE.

all this is moot

This is all moot anyway, because freewrap is a dud for me now that 5.2 and 5.3 have got that awesome bug that is so noted, also in the sourceforge bug tracker [L1 ] And I can't go back to freewrap 5.1, since I use the 8.4 features... plus 5.1 has its own bugs ;)

my compilation skillz - what skillz????!

So I can compile my own freewrap - with the bugs fixed. This is open-source after all, isn't it? Not bloody likely - I suck with a compiler. Ya, maybe 3 years ago I could have messed with gcc and visual c++, but not today, not with scripting being so much fun and my compilation skills rotting away. There is no way I am going back to that NIGHTMARE! The line must be drawn here.

the result

I sit here in the darkness. I feel nothing. What was love, what was life? I cannot. I cannot go on.

life will find a way

Okay, so I'm in a little quandary. But I could live with 8.3.4, that is freewrap 5.1 - but I have got to make it so that I can test with the same interpreter that is going to be deployed! This is not a feature, it is a tenet. So I make a little program that rips off the stub of the interpreter from the freewrap 5.1 binary, then go on to append a new zip to the end of it - basically hacking on the freewrap binary. I learn all these wonderful zip flags like -A and -9r. It makes me feel almost whole. I read about and munge about with the zvfs extension by Richard Hipp [L2 ], and just generally reinvent the wheel - and a square one at that. I make it so it loads up zip script archives with an extension .ix, and it works. It also loads tcl files so now the interp that runs my development is the same as the one that runs the user-distro. It's basically a really crap tclkit.

whoa! the second time is better

holy crow! TCLKIT! The last time I used this son-of-a-gun-app it used to crash on win98 on exit. That was a showstopper right there. But today, oh ye gods, today it works! It also worked on my win95 computer with msvcrt.dll in the same dir as the tclkit executable (finding this out was pain though - i hope your pain is avoided). (meta: I think I will write a lucid howto for others so that they can read about the caveats of tclkit and freewrap - something more inviting than this rant ;)

So tclkit... wow... talk about INFORMATION-OVERLOAD there is a gazillion different pages about tclkit, starkits, starpacks, scripted documents(obsolete term), SD's(obsolete term), and oh oh oh my brain is going to explode!

But wait - I read jcw's papers from the austin conference, i read and read and read... slowly the haze is lifting - i am starting to see what it is all about - oh lord a revolution!

applogic with appdata in one file... one runtime... need to distribute 3 files... the starkit, the tclkit, and msvcrt.dll ... for windows

for linux the same starkit (!!!!) and a tclkit... wow this is getting heavy

an editor in the starkit that edits itself... no more separate devel env, the development environment is in the starkit! this is heavy...

A metakit db in itself... all appdata stored in it, but I want my users to able to export and import program settings... sure make an option in the program instead of relying on data files... still open source configuration information, but just programmatically... safer this way, and can be much more portable... export to anything... xml, etc.


This is where I am today. The promise of tclkit and starkits and all that jazz is indeed incredible, and it finally looks stable enough for all my devel needs. I can't wait to get started.


It's kind of sad though, that for the last few weeks I've been obsessing with deployment... it's really upsetting to have all these ideas and code but no way to deliver them. I shed a tear for all of us.

windows issues

Like it or not, my friends run windows. I have to figure out how to deliver starkits to them without telling them to drag the starkit over the tclkit. Should I make a Tclkit installer for windows that associates .kit files with the tclkit? Is this too complex?

The user would have to install the tclkit installer - rebranded because I dont want people confused... then they would have to download the starkit and place in their document directory. Then double click on the starkit... this has the advantage of storing the starkit in their doc dir, instead of in C:\Program Files ...where the appdata could be all deleted when the prog is uninstalled.

Or do I use one installer per program that installs the tclkit and the starkit in a dir... but this is not safe because appdata is stored with applogic... so if you uninstall the program you are also losing your data... when you uninstall MSWord it doesn't also delete all your word files... and for what I'm doing (mindweb) the appdata is your content... you cant just delete it - that is criminal.

All my programs could require the Rohan Kit... and from there you just download any kit off my website... and you could run me programs... is this too complex? this is not how windows users are used to things... but I'm not making starpacks because I want to use the benefits the SUPER benefits of writeable starkits... of the metakit db... of vfs, of all that jazz.. of easily-auto-updated programs.

Life is looking up

Thanks jcw, and everyone else. I'm indeed on the shoulder of giants. I'm acutely aware that without all Your (yes, YOU!) hard work, community spirit, I would be wrestling with a C++ console app that only ran on windows. Instead today, I can perhaps hope for a brighter day, and can make my dreams come true in the form of SOFT-WARE not FROZEN-WARE

Thanks for making my code liquidy.

Rohan Pall

Feel free to comment.

IDG I still get exit crashes in Win98 if I load a binary extension (i.e. a .dll). I don't get crashes otherwise. Have you found a way of loading extensions without exit crashes?

Ro: no sorry, I haven't tried yet. I'm still experimenting with tclkit and starkits. I will update this answer as soon as I've got more info. Thanks for your experience Ian.

MPJ: I use it for my NewzPoint application deployment. This application uses 3 binary extensions (optcl, ffidl, libtkdnd), images and text files. I have been using it as tclkit/starkit for about 6 months. During that time have tested the application out (completly wrap "exe" and scripted doc's "kit") on Win95, Win98, WinME and WinXP and found that it just WORKS!!!

Ro: Hey yeah, NewzPoint rocks! I tried it last night and I was sooooo impressed! (on Win98) That's a great app, and boy oh boy is it easy to NOT-install! The only thing I noticed was that I got an error when running it on my win95 box with only IE3 installed. I figure that it doesn't support the interface that your optcl is using to connect to it. The splash screen starts up and starts loading stuff quickly, then errors out with:

  error in creating object
    while executing
  "optcl::new -window $win Shell.Explorer.2 "
    (procedure "News:New" line 4)

MPJ: NewzPoint needs IE4 or greater installed. The older IE version does not have all the interfaces. You would have to change the activex component to "Shell.Explorer" and see what bombs (I think a couple of the optcl::binds will fail).

Ro: Cool. Glad to see it resolved. It would be cool if there was a note on your page about that issue ;) Ian, does NewzPoint answer your question?

IDG Sort of - NewzPoint (nice program, by the way)does not crash for me. However, unpacking it, I see it is not built according to the current instructions for building starkits. I haven't yet figured out what's the critical change to avoid crashes. MPJ - did you know about the crash and program around it, or did you build that way for unrelated reasons? For a small simple example of a kit which seems to me to be built "right" and which crashes on exit, see the following post to the starkit mailing list [L3 ]

MPJ The conversion of NewzPoint to a Scripted Document is based on some (a lot) of help from Steve Landers. I also modified this structure a little so it works the same if I run it with wish (click on main.tcl) or as a Scripted Document (run as a .kit/.exe). I did not use the package structure (I don't think it existed yet) that is now the recommended. I plan on revisiting this later but right now it works. The thing I would like to see in the Starpacks is a way to update the resource file of the executable so it has the right icon and properties (Windows only). Currently, I do this manually with Resource Hacker [L4 ] on a non UPX [L5 ] compressed version of tclkit. Then compress the tclkit with UPX (using -9 switch) and then use SDX to wrap the Tcl code. It's ugly but it works.

Ro I checked out the post and your structure. The starkit in that post isn't built properly either ;) I put my app in lib/app-myapp as per some docs I read... but then again it shouldn't matter because your main.tcl seems fine. I'd appreciate it if you'd send me the starkit, at rohan TA rohanpall.com It might just be that your tktable extension is screwy ;O

You could hack around this behavior by just catching the WM_DELETE_WINDOW

  proc ::quit {} {
  wm protocol . WM_DELETE_WINDOW ::quit

but this isn't really solving the underlying issues is it ;)

IDG Actually that example is out of date. With the current release of tclkit it crashes whatever way you exit. I'll send you the complete starkit tonight or tomorrow - it's at home. (Though if you download Tktable you could build it pretty fast by cut & paste). I don't think it's a bad copy of Tktable, it works fine outside of starkits. The problem originally arose with my own extensions; I built an example with Tktable so people can't criticize my .dll building procedures. I assume JH builds it in the canonical manner.

18mar03 jcw - Not sure when the above was written, but today, with Tclkit 8.4.2, on Win NT4, entering the above "quit" code and closing the window does not crash for me. If you see *any* crash-on-exit cases with tclkit built on or after this date, please tell me! (or use the tclkit bug tracking system at [L6 ])

IDG Mar 19/03 - Yes, I should have dated that, it's old. Everything has been fine in this regard since the releases of about Oct./Nov. 2002. Thanks.

2002-09-17 (September 17, 2002)

I've wrapped mindweb in a starkit, and it's writable, check out my hints at Sexy Starkits. All the data is stored within it, it's great, amazing and my own mother is impressed! NO MORE INSTALLATION FOREVER

strobel - 2013-01-11 12:31:24

This page looks like old crab. Maybe we should just delete it. Discussions go to c.l.t, here we should have important reference.