Skip to main content

Autohell and CMake

Time for another software related post.

People familiar with the GNU/Unix system would know that the standard way to install about any GNU software from code is to run the following commands

  • configure
  • make
  • sudo make install

These commands are from the GNU autotools environment. Knowing the GNU environment, these tools are what I used to compile most of the (relatively small) pieces of code I wrote.

Until I discovered CMake.

CMake, or Cross-platform Make is a tool that serves the same functionality as the GNU autotools (hereafter referred to as autohell). As the name suggests, CMake can be used to compile software across multiple platforms.

Why am I encouraging CMake over autohell? Well, firstly, it’s not autohell! The GNU autotools are extremely useful when compiling on Linux. That’s what they are designed for. Cross compilation is extremely easy with the --host= flag. Unfortunately, when it comes to using them on Windows, the system just becomes a pain in the neck.

People who have tried to compile a GNU package on Windows would know what I’m speaking about. You type in configure, wait for about half an hour while the script does its job in the MSYS terminal, then enter make -j4 (to speed up the process), wait for an hour while libtool compiles the bloody code, then make install (finally!).

The reason why the process is so painfully slow is that autotools, at their heart are just shell scripts. This means that while compiling for Windows, in an MSYS terminal, the shell script is parsed by sh.exe, which is a slow emulator of the Unix shell. Further, when the configure script has done its job, the Makefile takes over, which relegates all compile operations to libtool, which is another bloody shell script. More sh.exe calls! The result? A painfully slow compile and installation process. Contrast that with CMake. Now, CMake exists on all platforms. It’s simple and elegant, and allows a choice of compilers, right from MSYS Makefiles, to CodeBlocks MinGW projects, to Visual Studio project files.

To prove my point, I’d just recommend that you checkout a simple project (Library management system, my 12th grade project) in my GitHub repository, which can be compiled using autohell as well as CMake. The CMake step takes a second, while autohell takes over a minute (on Windows). Moreover, the CMakeLists.txt file is short and sweet, and was written in under a minute. By contrast, I took ages to write autohell files, what with, and stuff. I switched from autohell to CMake immediately.


  1. this is informative... though most of such posts of urs just flow over my head, this one I did understand (~20%) as to what you are trying to say. partly bcoz I have to use linux and Windows and install codes on them... but nevertheless, you've clearly tried ur best! :-D

    1. Just try compiling a project (on a non-Unix system) with CMake, and then with auto-tools. You'll get what I mean.


Post a Comment

Popular posts from this blog

Progressive Snapshot: Is it worth it?

I turned 25 last year, which in the highly mathematical and calculating eyes of the US insurance industry meant that I had suddenly matured into a much more responsible driver than I was at 24 years and 364 days of age. As a result, I expected my insurance rates to go down. Imagine my surprise when my insurance renewal notice from GEICO actually quoted a $50 increase in my insurance rates. To me, this was a clear signal that it was time to switch companies.Typically, I score really high on brand loyalty. I tend to stick with a brand for as long as possible, unless they really mess up. This qualified as a major mess up. As a result, I started shopping for insurance quotes.Two companies that quoted me significantly lower rates (30%–40% lower) were Progressive and Allstate. Both had an optional programme that could give me further discounts based on my consenting to the companies tracking my driving habits. Now, I am a careful driver – I hardly ever accelerate hard. I hate using the brak…

Build those noise cancelling headphones

So, here's another DIYLet me start by putting the cart before the horse. I shall start with the credits. This project was done while I was working on my Electronics Design Lab, along with my friends, Srujan M and Indrasen Bhattacharya. The work would not have been possible without the generous help received from the staff at Wadhwani Electronics Laboratory, who ensured that the only thing we did right was to leave the lab on time. This project would also not have been possible without the guidance of our dear and learned professors. It would probably have just about become additional dead weight on the head.Enough with the credits, now, I need to dive right into noise cancellation and how it works.The essence of sound is a pressure wave. The pressure wave, when incident on the eardrum sets into motion the complex mechanisms inside the ear, and after a long path, rather like the Cog advertisement, ends up making some nerves vibrate. The nerves send electrical signals to the brain, …

The joy of receiving a handwritten letter...

I receive around 20 emails a day. I hit delete for most.While studying letter writing in school, I often used to wonder, is letter writing relevant any more? I mean, who sends snail mail? Isn't it much more convenient to write an email?Fast forward to a few days ago... I received a note, not really a letter, from a friend, whom I had the pleasure to know for over three months. The pleasure of reading the note really changed my perception about the composition exercise learnt in school.So, what is it that a handwritten letter has which email lacks? Maybe it is the personal touch, the realization that a person has written the letter, and that it has not been written by a computer. Handwriting just happens to add a personal touch which the cold hard sans-serif font of email just cannot capture.I also think that handwritten letters take time and effort into composition. This means that they generally have a better content than email, which is often written casually, in a hurry with l…