Updated 2015-09-29 16:59:59 by pooryorick

You should have an installed Tcl version greater or equal to 8.2 for most packages in Tcllib; for 64-bit systems, a recent Tcl 8.4 or newer is recommended. The minimal version for all Tcllib packages is 8.0, due to the use of namespaces.

Getting Tcllib

If you don't already have Tcllib downloaded then see Tcllib Location for some ways to get to a working tcllib on your OS.

Installing Tcllib

If you used something like ActiveStates Distro, a deb or rpm package, you probably don't need this.

The easiest way to install tcllib is the included installer, try:
 tclsh installer.tcl

 wish installer.tcl

It pops up a GUI (if Tk is available) which will guide you through the installation. You can get info about valid command line switches for the installer by running:
 tclsh installer.tcl -help

Testing if Tcllib works

Fire up your default tcl interpreter. Try this (or to require any of the other packages):
 % package require nmea

If it works and returns the version number of the returned package, you installed Tcllib correctly. If it does not work, check your auto_path variable like this:
 % set auto_path

It has to contain the parent directory of the directory into which you installed the packages, or the install directory itself. If it is missing, you have to add it to your auto_path in your scripts.
 % lappend auto_path /path/to/tcllib/installdir

Upgrading an existing installation

How do you upgrade the ActiveTcl version? Do you take the defaults the installer gives you or do you find where the current version is and replace that?

You can happily install multiple tcllib versions in parallel. All packages use version numbers so if you don't use package require -exact in your scripts you get the latest compatible version automatically. So if you have for instance an ActiveTcl install, you simply accept the installer defaults (run the installer with your tclsh from ActiveTcl, so it picks up the right auto_path) and install in parallel. If you are concerned about disk space you can simply delete the older tcllib directory and examples from your installation.

There may be some unexpected and unwanted side effects if a package versions changes from major version (1.x to 2.x for example) indicating an API change. This happend with the md5 package, which is provided as an 1.x and 2.x version. If your code simply uses package require md5 you get the latest version, which is 2.x, which may break scripts expecting the older 1.x API. Simple fix is to change the package require to package require md5 1.

Tcllibc  edit

tcllib ships with a module called tcllibc, which is compiles to a shared object. To compile it:
tclsh sak.tcl critcl

There is currently no provision to automate installation, so installing is a matter of copying the contents of modules/tcllibc to something like /lib/tcllibc.


LV Can anyone address why 64 bit systems need a newer Tcl? Is it because Tcl itself has problems before 8.4 on 64 bit machines?

schlenk Yes. As far as i remember there are some packages like MD5 etc., which don't work correctly on 64-bit systems with a pre-8.4 Tcl, but i don't rememeber the details, must be in the bugtracker.

RLH 2006-10-05: Wierd on OSX the defaults are kind of strange. It comes up with /System/Libray/bin to install any executables? That should default to somewhere on the /usr path (preferably /usr/local/bin). I guess I will have to find where tcllib1.8 is hiding.

schlenk Please file a bug report, when the installer does something strange. Category Installer.