Created at:

Modified at:

Tcl/Tk notes

Troubleshooting

Images get deformed when using the -grayscale option

(2010-03-24)

In code like that:

    image create photo -data [$colorimg data -format bmp -grayscale]

You must check if the parameter to the "format" option is right. In my case, I was putting -format bmp when the correct option is -format jpeg.

Some random notes

Why XOTcl needs Tcl sources to compile

When trying to compile the XOTcl extension for Tcl, I saw it looked for the tclConfig.sh file (this file is in lib/. If someone didn't install it in a default directory, it turns to be necessary to pass the path for this directory with the --with-tcl flag when calling the ./configure script). This file has much data, including the original path of the Tcl source code compiled to generate the binary release.

After checking this file, the ./configure script checks a lot of steps, but it can stop complaining that it couldn't find the tclInt.h file in the original source code tree (took from tclConfig.sh)! I wondered why XOTcl would require those files and I got good explanation here:

[Xotcl] Tcl source requirement

[...]

there is a short answer and a very long answer to your question. XOTcl needs the Tcl-source since it contains several .h files that are not included in typical binary distributions. Such files are tclInt.h or tclCompile.h. The first one is sneeking into more distributions (a student told me that his SuSE distro includes tclInt.h), tclCompile.h was just needed for speed (1.0.2 has a better configure script that checks automatically this file).

The long answer where i am not going into details is, why des XOTcl need tclInt.h. In short, XOTcl needs it because its needs access to internal of several tcl structures that are not public available. Examples are the structures Command, Namespace, Interp. Certainly it will be possible to define access functions to access the relevant info, and we could try to push these into the tcl-source development, but we have not started this effort jet. Just comment out the include statement of tclInt.h, and you will see how many places are involved. We have on our informal todo-list a step where we define access macros fort the relevant infos, but this is currently not top priority. I agree certainly that it would be much nicer to get rid of tclInt.h.

[...]

Load packages installed in non-standard path directories

(2019-02-18)

If you installed a package in a non-standard path directory, the Tcl interpreter will not find it when you perform a package require. To tell the interpreter where it is, you can use one of the techniques described in the link below, like setting the TCLLIBPATH variable:

    export TCLLIBPATH='/path/to/libraryA /path/to/libraryB'

a question about package in TCL

Note that space is required to separate different paths (unlike other environment variables that require a collon).

Inside each directory, there should be another directory and, inside it, a pkgIndex.tcl file. For example: suppose you installed TclX in /opt/tclx-8.4, before running your program, you should do:

    export TCLLIBPATH='/opt/tclx-8.4/lib'

TclX

Inside /opt/tclx-8.4/lib there is tclx8.4/pkgIndex.tcl.