Posts Tagged ‘technique’

Compiling Gimp with LLVM/Clang and static analyse

Clang, which use LLVM infrastructure, is a compiler for the C language family. His goal is to offer a moder alternative to GCC. With Clang come a pretty cool static analyser. Here is how to use it for Gimp.

A small disclaimer before, I shamefully copied and adapted the procedure given by Campbell Barton, form the Blender team. (

Step 1: compile LLVM/Clang

I first tried the LLVM provided by ArchLinux, but the compilation ended with a fatal error. It goes flawlessly with the development version. To fetch it, Campbell Barton’s script works well.

Step 2: configure Gimp’s compilation

First, we need to add  LLVM’s binary to the PATH:

export PATH=$PATH:/opt/llvm/bin

The only difference with a classic GCC compilation, is that we explicitly ask to use Clang’s compiler:

CC=ccc-analyzer ./ --prefix=/opt/gimp/

Step 3: compile

If you just want to compile, the procedure doesn’t change.

make -j3

If you want to run a static analyse, you have to use scan-build:

scan-build -o clang make -j3

Just be aware that a static analyse will take a lot of time (3h40 with my Core 2 Duo E4500).

Etape 4: profit !

The static analyzer of Clang will probably find a lot of bug in the code. Yes, there is false positive, but it’s globally remarkably well done ! You can find here the result of the analyse of master i did today:

(Français) Implémenter une machine à état

(Français) Ubuntu/Debian : faire le ménage dans les noyaux

Sorry, this entry is only available in Français.

(Français) Quelques photos de Prague

Some pictures I took in Prage last weekend. They are almost not retouched, I just resized them and I cropped one.

Btw, I wanted to give you a pretty usefull soft : mogrify. I used it to resize all my pictures at once, but it has lots of more possibilities.
Here is the unix command :

mogrify -resize 50% *

Be carefull, it will replace your original pictures.

The Saint Vitus Cathedral
Tux in Prague !
The Saint Vitus Cathedral, indoor