Friday, September 2, 2022

[SOLVED] How can I configure Tcl 8.5 to enable threads on Linux?

Issue

I have installed tcl 8.5 as well as tk on my linux computer, but I need to be able to use threads for a project. I'm aware that this needs to be enabled separately if you downloaded tcl/tk from a binary file, and that it has something to do with configuring using the keywords --enable-threads.

However, for the life of me I can't figure out where to do this and the exact terms I need to use. "configure" or "./configure" is not a term my linux terminal understands, and I'm probably not starting from the right directly either.

Can someone please tell me how to enable threads for tcl on a Linux machine from the beginning?


Solution

When building Tcl on Unix from source, assuming you have a compiler installed, you change to the unix directory in the source tree and do:

# First, set things up. (See below for what options to use.)
./configure ...options...

# Then, to actually do the build
make

# Possibly then you might run the test suite...
make test

# Finally, you'll install it to its working location
make install
# Might be:
#    sudo make install
# if installing to a shared location

The options you will probably need are:

  • --prefix=$DIR where you replace $DIR with somewhere you can write to during make install.
  • --enable-threads (you asked for this explicitly)

There are a few other things that can be set, but they tend to either be things that we autodetect adequately, or that are mostly only needed when developing Tcl itself (like extended debugging modes).

You might also need to say which compiler to use. Do that the standard way, by setting (and exporting) the CC environment variable before calling any of the above. The configure script will guess if you don't say, but it doesn't try very hard.



Answered By - Donal Fellows
Answer Checked By - Senaida (WPSolving Volunteer)