Building the Unix Binaries

There are several versions of Tcl/Tk being used today. The newer Tcl 7.5 release is are becoming popular because they can run on Windows, Unix and Macintosh. However, many people are still using Tcl 7.4. Another popular variant of Tcl is Itcl , which adds object-oriented functionality to the Tcl language. Both version Itcl 2.0 and Itcl 2.1 are being widely used now.

Tix supports all of these versions of Tcl and Itcl so you can freely choose a version of Tcl or Itcl that works best for you. The following steps guide you through the process of building the Tix binary for your choice of the version(s) of Tcl or Itcl on Unix platforms.

1. Download the Tcl, Tk and/or Itcl sources

You may have already installed Tcl, Tk and Itcl on your system. The installed binaries usually reside in the /usr/local/ directory. However, the build process of Tix doesn't use the installed binaries because doing that may result in subtle version conflects. Instead, Tix uses only the binaries from the Tcl, Tk and Itcl source directories. Install sources of these packages if they are not already in your system.

Make sure that the source directory of these package reside in the same directory as Tix. For example, if I am compiling Tix 4.1.0 for Tcl 7.4 and Itcl 2.1, my source directory would look like this:


  /home/src/tcl7.4/
  /home/src/tk4.0/
  /home/src/itcl2.1/
  /home/src/Tix4.1.0/
  
IMPORTANT: Do not arrange your source directory in any other way. Do not change the names for these directories. Otherwise Tix will not be configured properly.

Note that Tcl 7.6b1/Tk 4.2b1 are not yet supported by Tix. Support for Tcl7.6b1/Tk4.2b1 has been planned for the next release of Tix.

2. Build Tcl, Tk and/or Itcl

Tcl, Tk and Itcl comes with installation guides and should be easy to build. In case you have any problems building these packages, you can send your questions to the comp.lang.tcl newsgroup or to the respective authors of these packages. You may also send mail to tix-support@xpi.com.

3. Select the appropriate compilation target(s)

Tix can be configured to build with different combination of Tcl/Tk and Itcl. Each configuration is referred to as a Compilation Target.

The easiest way to select the compilation targets is to use the setup.tcl program. To run this program, you must already have wish version 4.0 or later installed in your system. You can start the setup.tcl by changing to the Tix source directory and typing:


  cd /home/src/Tix4.1.0/
  wish setup.tcl
  
The following screen will pop up:

(Screen 3.1)

Press the "Set Up The Tix Package" button and this will bring you to the next screen:

(Screen 3.2)

You can now select the compilation targets by clicking on the check buttons. If you are not sure about what an item means, you can simply clicks on that item and a help message will show up at the bottom of the screen. In the figure above, we have selected two targets: Tcl7.4/Tk4.1 and Itcl 2.0.

If you have installed the sources as described in step 1 above, you don't need to type anything into the "source directory" entry boxes. Those directories will be automatically detected by the setup.tcl program later on. If you have installed some sources in non-standard directories (which we strongly advise against), you can enter the names of these directory in the respective entry boxes. In the following figure, the Tcl 7.4 directory is set to /home/foo/tcl7.4:

(Screen 3.3)

There are other options under the X Window Files, Compiler Options, and Installation Options headings. Usually there is no need to type anything into these entry boxes. On some systems, you may need to set the X Window directories to:

(Screen 3.4)

By default, the cc compiler will be used. However, on some systems, you may need to set the compiler to a non-standard compiler. For example, you may need to set it to gcc:

(Screen 3.5)

You should set these options only if you know exactly what you are doing. Ask a local expert when in doubt.

You may notice that there are two buttons labeled with "Use Embedded TK". Also known as ET, it provides an easy way to compile your Tcl script and C source code into a single executable binary. You can read the file ET.txt to find out more about ET.

4. Configure Tix

Once you have finished selecting the compilation targets and entering the options, you can start configuring Tix by pressing the "Run GNU configure ..." button at the lower right corner of screen 3.2. This will start the configure program, which will check the characteristics of your system and set up the Makefile's needed to build the Tix targets you selected in step 3. The following screen will pop up:

(Screen 4.1)

Assuming you have already build Tcl/Tk or Itcl in step 2, you would have used the configure program and the output of screen 4.1 should look fairly familiar to you. The lines at the top of the screen shows the arguments to the configure program and the rest are the output by configure.

Normally configure will successfully end by printing "Tix configuration is complete". You may then proceed to step 5 below. If configure reports any errors, though, you need to go back to step 3 and enter alternative options.

You may also invoke the configure program directly outside of the graphical setup.tcl program. You can find out the options of configure by executing configure --help in your shell.

5. Build Tix

Now it's time to build Tix. This can be done by typing "make" in the Tix source directory:


  cd /home/src/Tix4.1.0/
  make
  
When this fininshes, you will get the binaries in the respetive target directories. For example, if you have selected the Tcl7.4/Tk4.1 and Itcl 2.0 targets, you will get the following executables:


  /home/src/Tix4.1.0/unix-tk4.0/tixwish
  /home/src/Tix4.1.0/itcl2.0/itixwish
  

6. Experimenting with Tix

Tix comes with a large number of demo programs. You can run these program by running the demos/widget script with the tixwish or itixwish you have built in step 5. Make sure that you have set the TIX_LIBRARY variable accordingly. If you haven't installed Tcl and/or Tk then you'll need to set your TCL_LIBRARY and TK_LIBRARY environment variable as well (see the Tcl and Tk README files for information on this).

You can type the following command in your shell:


  cd /home/src/Tix4.1.0/demos
  env TIX_LIBRARY=/home/src/Tix4.1.0/library ../unix-tk4.0/tixwish widget
  
This will open up the Tix demo window. You can click on the "Run Sample Programs" tab and execute the sample programs:

(Screen 6.1)

7. Installing Tix

If you are sufficiently convinced that Tix works properly, you can install the Tix binaries and scripts on your system. If you are paranoid, these is a small set of test scripts that tests the behavior of Tix under various configurations. You can type "make test" to run these tests. Hopefully it will report "0 error(s) found".

Type "make install" to install Tix's binaries and script files in standard places:


  cd /home/src/Tix4.1.0
  make install
  
In the default configuration information will be installed in /usr/local so you'll need write permission on this directory. If you'd like to use a default installation directory, you can change the "exec_prefix" and "prefix" options in step 3, reconfigure, rebuild Tix and then type "make install".

8. Trouble Shooting

If make fails then you'll have to personalize the Makefile's for your site or possibly modify the distribution in other ways. First check the files docs/FAQ.html and docs/Porting.html to see if there are hints for compiling on your system. If you need to modify Makefile's, there are comments at the beginning of it that describe the things you might want to change and how to change them.

If you have trouble compiling Tix, I'd suggest looking at the files docs/FAQ.html and docs/Porting.html. It contains information that people have sent me about changes they had to make to compile Tix in various environments.

I make no guarantees that this information is accurate, complete, or up-to-date, but you may find it useful. If you get Tix running on a new configuration and had to make non-trivial changes to do it, I'd be happy to receive new information to add to docs/Porting.html. I'm also interested in hearing how to change the configuration setup so that Tix compiles on additional platforms "out of the box".


Last modified Sep 30 20:43