Richard Bucker

Tcl From Scratch

Posted at — Sep 19, 2020

Many have called it the “best-kept secret in the software industry”. Whether in large companies, small companies, academia or the wild world of open source, you’ll be surprised at many of the places Tcl can be found …

I have plenty of development hardware. I have laptops, tablets, and desktops a plenty. But I am still chasing the notion of a technology pandemic. While I started thinking that “systems” would be thrown back to the stonage of DOS or maybe some other custom RTOS… we kinda have no idea. The challenge we face is that the software we depend on is based on many years of layered development.

consider how long it took for the Sun developoment team to get java to build java… and golang to build golang.

It’s impossible to know what software would be around in order to bootstrap the world’s software industry… So my theory of operation is to define the rules in a simple language like tcl… expand the language as needed… and build it on some other simple syntax so that the base could be rebuilt preserving the model.

think practical literate model that could be easily created

I’ve tried a number of syntax' like lua and lisp, but tcl seems to be holding string. Although there is one strong use-case for lisp in that it’s recursive enough that all one might need is the shim to the OS. Consider back in the day what it took to build emacs with the limited hardware and software available. They did it.

picol 500 lines was a good start and there is a lisp version out there too.

However, lisp is a challenge to learn. It’s not natural. All those freaking parens. And so I started looking at tcl again. My dsl is not 100% compat but I’m not tring to be. What is interesting is that I have been able to take the tcl source, all in c, and build it with clang or gcc. I’ve been able to add SQLite and I have even tested a connection to an ODBC database. tcl from the source is an unfortunate challenge because there are several source distributions with hidden documentation. It’s a mixed blessing from Active State.

And there is one more thing… Most operating systems provide their toolchain as they see it. They decide where the include files are stored, the libs are stored, the dependencies, and so on. For example the current verion of sqlite is 3.33.0. However, the all-in-one tcl source only supports 3.31.0. This is the opposite of what I’m refering too but it’s something I can upgrade… and it’s all over the OS.

So in the following notes… I’m going to install MY version of tcl on a ChromeOS device in the linux container. The general rules should work from anywhere on anywhere. One other side effect is that the OS version is shimmed away from the application tools. This is a big deal. It reminds me of a book I read about Microsoft in the early days. Moving on…

trying to do everything in userspace

sudo apt install clang tdsodbc/stable 
sudo apt install unixodbc unixodbc-dev tdsodbc odbcinst 
mkdir -p $HOME/tools/bin
tar zxvf fossil-linux-x64-2.12.1.tar.gz
mv fossil $HOME/tools/bin/.
mkdir -p $HOME/fossils
fossil clone $HOME/fossils/tcllib.fossil
cd $HOME/Download
mkdir tcllib
cd tcllib
fossil open $HOME/fossils/tcllib.fossil 
tar zxvf sqlite-autoconf-3330000.tar.gz 
cd sqlite-autoconf-3330000/
CC=cc ./configure --prefix=$HOME/tools
make install
fossil clone http://o2o001.bucker.local:8080/vctools $HOME/fossils/vctools.fossil
mkdir -p $HOME/src/vctools
mkdir -p $HOME/.config/vctools
cd $HOME/src/vctools
fossil open $HOME/fossils/vctools.fossil
mkdir -p $HOME/BIN
unixODBC 2.3.6
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
USER DATA SOURCES..: /home/richard/.odbc.ini

some remote database connectivity

some sqlite connecivity

And to upgrade to SQLite 3.33.0 if not already by the time I get here.

I hate being ROOT


wget fossil...
wget sqlite3...
apt install clang make
 CC=cc ./configure --prefix=$HOME/tools
 # sadly there are a few compiler warnings... :(
 make && make install
add $HOME/tools/bin to the PATH
wget tcllib
mv the tcllib to the pkgs folder and repeat the configure make install process. The reason for the second step is because
tcllib's configure/make depends on tcl...


This project is being undertaken on my Google pixel in portait mode with a Lenovo Thinkpad USB keyboard with the dimple. The processor is an i7 with 16GB ram and I think 64GB of SSD. Part of me wants to continue this experiment with an android tablet and a ESXi server with applicable guest OS. That will clearly work too.

We are constantly being tested as to whether we need big iron or if smaller machines are sufficient. Programmers seem to have a hoarder mentality and it has taken me years to get rid of. There is a part of me that does not want to repeat the past and I’m looking for waster ways to move to the future. One thing for sure is that scale is not a problem most projects suffer from.

So really the next place to try this project is on a raspberry pi.


tcl -