Friday, October 10, 2014

Compiling ical calendar manager on Ubuntu 14.04 and tcl-tk 8.6


I like to use ical calendar manager by Sanjay Ghemawat. It is an old program, maintained and loved by a small group of users.

EDIT: See below for Ubuntu 18.04.

After upgrading to Ubuntu 14.04, I wanted to install ical. The version at the time of writing is 3.0.2, from: https://launchpad.net/ical-tcl. Unfortunately it does not compile for a stock 14.04, there are a few problems:

1. It does not recognize tcl-tk 8.6 which comes with Ubuntu 14.04. Edit "configure.ac" so that it does:
Find the following lines and add version 8.6 so it looks like this:
AC_CHECKING(Tcl/Tk installation)
#legal_tk_versions="8.5 8.4 8.3 8.2 8.0 4.9 4.8 4.7 4.6 4.5 4.4 4.3 4.2 4.1"
#legal_tcl_versions="8.5 8.4 8.3 8.2 8.0 7.9 7.8 7.7 7.6 7.5"
legal_tk_versions="8.6 8.5 8.4 8.3 8.2 8.0 4.9 4.8 4.7 4.6 4.5 4.4 4.3 4.2 4.1"
legal_tcl_versions="8.6 8.5 8.4 8.3 8.2 8.0 7.9 7.8 7.7 7.6 7.5"

2. It fails to find some libraries and headers. This is a matter of installing them or adding symlinks, notably: tcl8.6-dev and tk 8.6-dev.

3. Extra arguments are required when running the "configure" script (not all are necessary, but it does not hurt):
./configure --with-tclsh=/usr/bin/tclsh8.6 --with-tclconfig=/usr/lib/tcl8.6 --with-tkconfig=/usr/lib/tk8.6  CXXFLAGS='-g -O2 -I/usr/include/tcl8.6'

4. It cannot find libtk8.6.so and its tcl counterpart. They are not where ical expects them to be. This can be hacked with some symbolic links (ugly solution, but it works):
ln -s /usr/lib/x86_64-linux-gnu/libtk8.6.so /usr/lib/libtk8.6.so
ln -s /usr/lib/x86_64-linux-gnu/libtcl8.6.so /usr/lib/libtcl8.6.so

 5. Finally, make fails with the error:  'Tcl_Interp' has no member named 'result'
Some searching came up with the solution: http://askubuntu.com/questions/372480/tcl-error-while-installing-wordnet. Essentially, it is necessary to modify the "tcl.h" file (you must copy this file over from: /usr/include/tcl8.6/tcl.h to the ical source directory):

Just under the lines:
#ifndef _TCL
#define _TCL

add:
#define USE_INTERP_RESULT 1

Ubuntu 18.04 new error(!): It is possible to install TCL/TK 8.6 for Ubuntu 18.04. You need to do the same fixes as above. Additionally, there is a new error:

In file included from main.C:27:0:
bitmaps/left.xbm:7:50: error: narrowing conversion of ‘128’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]


Go to the directory "bitmaps"
There are bitmap files there. Unfortunately, the bitmaps are all defined as
"static char". This prevents them to have values greater than 127 (which would map to negative values).

Solution: Edit each file and change the lines (around line 3) that look like:
 static char ical_bits[] = {
to:
static unsigned char ical_bits[] = {
Do the same change to each .xbm file in the directory.


This finally fixed all the errors and I could start using ical again. Hope this helps somebody.

PS: After the modifications for Ubuntu 18.04, I also noticed that there is a new version of ical; 3.3, which has fixed (probably all of) the errors above.

No comments:

Post a Comment