Installing Esterel and ECL (Esterel C Language) on a modern linux

  21 Feb 2024


Esterel is a …. ECL (Esterel C Language) is an extension…

Because this is all pretty old stuff (the ECL document is dated October 24, 2001), the installation requires digging through old dependencies and decades-old unsupported software which can be quite frustrating, but equally rewarding.

Installing Esterel

Installing Esterel is relatively straight-forward. The first step is to download the latest version from the official website.

Once downloaded, extract in a directory of your choice and run the setup script with root priviledges. The nice (although appreciably old-school) graphical interface will take care of correctly setting up the paths and create symbolic links for you (if you enable them). A Makefile is provided, but you will have to set the variables yourself.

Esterel setup GUI

An uninstall script will be created to undo the installation (I trust it will work, I have not tested it).

Installing ECL

Installing ECL is a little big more tricky. You can download the source code from the ECL SourceForge page but you have to compile it ourselves. Download the code and extract it where you want.

Then, you will need a Java Runtime Environment and a Java Development Kit, as the compiler is written in Java.

After some testing, because the compiler uses ancient syntax, Java 1.4 seems to be the latest usable. Finding such a version for Linux is surprisingly unintuitive (download here), as versions newer than 1.4.2_19 are only available for Solaris; also Oracle requires a login to donwload them. So, one burner account later, I am the proud owner of the ancient j2re-1\_4\_2\_19-linux-i586.bin and j2sdk-1\_4\_2\_19-linux-i586.bin for linux (I didn’t even know i586 was a thing). These files will self-extract and you can just move the folders anywhere you want (/opt in my case).

Java acquired, we are almost ready to compile ECL, we first need to set the following environmental variables. I have added these lines to my .bashrc file, following the manual (these variables are not only needed to compile ECL, but also to execute ECL code, so they need to always be defined):

export ECL_CC="gcc -m32"
export ECL_JAVAC="/opt/j2sdk1.4.2_19/bin/javac"
export ECL_JAVAVM="/opt/j2re1.4.2_19/bin/java"
export ECL_HOME="/opt/ecl-3.1.0"
export ESTERELHOME="/opt/esterel-5.92"
export CLASSPATH="$ECL_HOME/src:$ECL_HOME/util/JavaCup:$ECL_HOME/util:$ECL_HOME/xecl"

This is the script I used to compile ECL, just save it in the $ECL\_HOME directory and run it:

# variables redefined in a way that ECL expects
export CC=${ECL_CC}
export JAVAC=${ECL_JAVAC}
export JAVAVM=${ECL_JAVAVM}
export ECL=${ECL_HOME}

# utils
make -C "util"
# ECL compiler
make -C "src"
# xecl
make -C "xecl"

The file $ECL\_HOME/script/ecl will run the java class. I did some modifications to it, in order to use the variables as I’ve set them, this is my modified version (it’s mostly the same, just changed variable names and added quotes for compiler flags, see next section for that):

#!/bin/bash
${ECL_JAVAVM} -DESTEREL="${ESTERELHOME}" -DCC="${ECL_CC}" ecl $*

Remember to set a symlink to ecl inside your $PATH.

xecl is a graphical script to run ECL and Esterel, you will need to install the package libxtst6:i386 for it to work, and also modify a little the file $ECL\_HOME/script/xecl

#!/bin/bash
${ECL_JAVAVM} -DESTEREL="${ESTERELHOME}" -DESTERELV6="${ESTERELHOME}" -DCC="${ECL_CC}" xecl $*

Compiling ECL files

Compiling the files is a little tricky because ECL expects a 32bit system. After a couple hours of testing and some bruteforcing, only two steps are really required:

  1. add the -m32 flag to gcc (which is why I had to add quotes to the 4ECL\_CC variable), this is required so ld emulated the format elf_i386, otherwise it would throw all kind of errors about incompatibility with x86_64
  2. install the packages gcc-9-multilib libc6-dev:i386. This is the most delicate step. For some reason, in my experience installing old version of libc and libgcc risks messing up your packages. After some tries, this is the combination of packages that includes all the needed dependencies and don’t uninstall half of my system (it only required to uninstall gcc-7 and some components of gcc-9, but it left untouched gcc-8 and gcc-10, I stopped looking for a logic in this). Of cource, your mileage might vary, based on your specific system setup. Whatever you do, do not blindly accept whatever your package manager proposes you, you seriously risk messing up your system and corrupting your packages

Verify that all is working by compiling and running the test files

make
cd abro
./abro.exe < abro.in

If you see the output signals, congratulations! You successfully installed ECL on your system. What can you do with it? A lot of things, but as far as I can tell, no public project uses it, but feel free to mess with it for fun, that’s what I’ll bedoing for sure.

Conclusions

My journey through exotic and ancient hardware design language brought me another intersting adventure. I will surely consider what I learnt when designing new projects.

I have also added ECL support to my sces (SCript-Executing Script) project, so check it out if you didn’t already!

If you use Esterel or ECL professionaly, please get in touch and consider sharing your experience, I am really curios to know what these are used for!