**Compilaction** (insert ../crumbs.html here)
[**Compiler Explorer : The tool that keeps tooling**](20.03.25.html)
[Compiler Explorer](https://godbolt.org/), the wonderful web-based tool by Matt Godbolt, is a trove of treasures. What people often don't notice, it's that you can actually have your own little instance installed locally. Let's see what we can do with that! ---------------------------------------------------------------------------------------------------- When dealing with curious behavior from your favorite compiler or just because you want to know how something is actually done "down under", you may already have played with [Compiler Explorer](https://godbolt.org/). This incredibly useful tool by Matt Godbolt lets you input code in a large selection of languages (C,C++, FORTRAN among others), select one of your favorite compiler brand and version and see what the compiler is actually generating at the assembly level. A nice feature is the fact that you can install Compiler Explorer locally. We've been using such a local for some times now and it has proven an invaluable resources as we can directly checks the code generated by the libraries we develop. Installing *le* Compiler explorer ==================================================================================================== Compiler Explorer is written in Node.js. You will need to install the latest LTS version[^version]. Once this is done, the installation process can be summarized to: - clone the Compiler Explorer latest version from github: `git clone https://github.com/mattgodbolt/compiler-explorer.git` - run `make` That's it. That's the whole thing. Assuming you have installed node before hand, you can then open your favorite browser and go to `http://localhost:10240/`. You'll end up on exactly the same interface than on the on-line version. Adding your compilers of choice ==================================================================================================== Next step is to add and configure compilers. The on-line version of Compiler Explorer comes with a lot of compilers but you may have your own preferred version. You may also want to specify compiler options so you don't have to set them every time. In our cases, we regularly deals with SIMD extensions and other performance related options. We decided to setup our local Compiler Explorer instance so that we can test both clang and g++ for a selection of SIMD extensions. The magic happens in the `c++.default.` file which contains the configuration for C++ compilers. Interaction with Docker ==================================================================================================== Conclusion ==================================================================================================== ---------------------------------------------------------------------------------------------------- [^version]: version 12 at the moment of writing.