Difference between revisions of "Installing on Windows using the Tiny-C compiler"
Hzwakenberg (talk | contribs) (Created page with "= Installing Liberty Eiffel on Windows using the Tiny-C compiler = == Prerequisites == === Liberty Eiffel repository === The complete Liberty Eiffel source code repository can be downloaded from gnu’s git server. Install git on your machine if you haven’t done so already and simply use: “git clone git://git.sv.gnu.org/liberty-eiffel.git” This will create a directory called ‘liberty-eiffel’ and replicate the entire repository into it. Personally, I prefe...") |
Hzwakenberg (talk | contribs) m |
||
Line 12: | Line 12: | ||
=== Tiny-C compiler === |
=== Tiny-C compiler === |
||
− | The installation script assumes that a working Tiny-C compiler (tcc) is installed and that your ‘path’ environment variable points to the tcc installation directory as well. If you think this is the case, simply open a command prompt and check whether tcc.exe can indeed be found, like I did for the following screenshot. Note that my current directory was C:\Liberty, where I copied the Liberty Eiffel repository to: |
+ | The installation script assumes that a working Tiny-C compiler (tcc) is installed and that your ‘path’ environment variable points to the tcc installation directory as well. If you think this is the case, simply open a command prompt and check whether tcc.exe can indeed be found, like I did for the following screenshot. Note that my current directory was C:\Liberty, which is where I copied the Liberty Eiffel repository to: |
Revision as of 11:23, 28 October 2024
Installing Liberty Eiffel on Windows using the Tiny-C compiler
Prerequisites
Liberty Eiffel repository
The complete Liberty Eiffel source code repository can be downloaded from gnu’s git server. Install git on your machine if you haven’t done so already and simply use:
“git clone git://git.sv.gnu.org/liberty-eiffel.git”
This will create a directory called ‘liberty-eiffel’ and replicate the entire repository into it. Personally, I prefer directory names to be a bit shorter, so for my case I renamed it to just ‘liberty’, see the screenshot that follows further below. For those of you who don’t want to install ‘git’: it is possible to visit the mirrored Liberty Eiffel repository at GitHub and download the entire repository as a ZIP-file as well.
Tiny-C compiler
The installation script assumes that a working Tiny-C compiler (tcc) is installed and that your ‘path’ environment variable points to the tcc installation directory as well. If you think this is the case, simply open a command prompt and check whether tcc.exe can indeed be found, like I did for the following screenshot. Note that my current directory was C:\Liberty, which is where I copied the Liberty Eiffel repository to:
As you can see, tcc could be found and it reported back that it is version 0.9.27 (x86_64 Windows). This also means that the ‘path’ environment variable points to the correct Tiny-C installation directory, otherwise the compiler would not have been found.
Installation
Open a new command window and navigate to Liberty Eiffel's root installation directory. This directory contains a cmd-file named win-install-tcc.cmd. Type this command into a CMD-window, like in the following screenshot:
And then press the enter-key. The following screenshot documents what will happen on your machine:
Note the time stamps on the output… Now is the time to grab a cup of coffee, or even a few, and then come back to read the remaining part of this document 😊
I’ll get back to the time stamps later on….
What does this installation script do?
The big picture? This script creates your Liberty Eiffel executables by compiling them from the original source code!
- First it verifies the installation prerequisites by creating a number of temporary files. Then it searches for your Tiny-C installation, which is why it was important to have your installation and your ‘path’ settings checked beforehand, as described above.
- Next, a configuration file is created. This ‘liberty.cfg’ file is used by the Eiffel compiler and other commands in the tool set. It is created in %USERPROFILE%. If you want ‘liberty.cfg’ to be readable for all users, you have to copy it manually to %ALLUSERSPROFILE% as well. You’ll need admin credentials to do this.
- Up next is the first real compilation: bootstrapping ‘compile_to_c’, the command used by most of the other Liberty Eiffel commands. As the name implies, this command takes an Eiffel source file or files and creates C-files from them. The C-sources for ‘compile_to_c’ itself are compiled into an initial version of ‘compile_to_c.exe’. I had Tiny-C emit some statistics about the size of the sources and the time it took to create an executable from it.
- This initial executable is then used to compile itself again from the original Eiffel sources. ‘compile_to_c.exe’ creates C-files, and these are again compiled by Tiny-C, resulting in yet another version of ‘compile_to_c.exe’. This bootstrapping cycle is repeated three times. The installation script provides a short message about each of these cycles, named T1, T2 and T3.
- The script continues with comparing the ‘compile_to_c.exe’ files from the T2 and T3 cycles. If they are binary equivalents, the T3-version is moved to the ..\bin directory. This is how the core compiler is bootstrapped and later used to compile the rest of the Liberty Eiffel commands. But before that, the script removes all temporary files and directories that were created for the bootstrapping process.
- Using the now stable version of ‘compile_to_c.exe’, the remaining commands are compiled. The corresponding executables are moved to ..\bin as well. Any temporary file created by the compilation process is removed (Liberty Eiffel provides the ‘clean’ command for that, which is used after that executable got created).
Now back to the time stamps I alluded to before:
Liberty Eiffel (and its predecessor too) were predominantly developed on Linux and a number of other Unix-derived operating systems. On these operating systems, the compilation tasks share multiple processor cores, making the installation rather swift. On Windows, we still need to work on the Eiffel code for ‘exec’ and a few other features to spawn separate processes. Until that is finished, it is not yet possible to have parallel compilation to create a single application.
The bottom line: this installation script for Windows is a single-core sequential processing job, which is why it takes three to four times as long as on a comparable Linux machine. On my quad-core Xeon @ 4 GHz, it takes appr. an hour, but then again, only a single core is used for this job and my machine had other compute intensive tasks in the background as well…
If your installation process shows the ‘Finish:’ time stamp, you should have a working Liberty Eiffel environment on your Windows pc.
Looking for a small footprint code editor as well?
If you’re looking for a minimal footprint editor for your Eiffel endeavours on Windows as well, I recommend using Notepad++.
In your Liberty Eiffel ..\work directory, you’ll find a subdirectory called ‘notepad++_syntax-highlighting’. Within that directory, you’ll find a Liberty-Eiffel.xml file that can be imported in notepad++. It loosely implements the Eiffel formatting rules proposed by Bertrand Meyer. In this directory I also put a pdf-file to show what that looks like.
Good luck and happy Eiffeling….! 😉