Google Summer of Code 2012 – Clang support for build services in Debian

This project is about extension of the Debian infrastructure with ability to build packages with clang. The key idea is to have an alternative way to build packages and easily switch between clang and gcc/g++. Clang is faster than gcc, uses less memory, and produces faster code. It is getting better with time. It is available under the BSD license. It is well documented. It can help programmers find and analyze easily their errors, because clang has much more detailed error and warning messages and it allows better diagnostics. It also provides a good alternative for programmers using gcc in the coding and compiling processes. It enforces better code quality.

In the compiling process, compiler choice is usually done by setting the environment variable CC. When Makefile is generated, it contains initialization of the CC variable based on the current environment. If CC is not set, the default compiler is gcc. CC is always used by make. I proved this with tests (I set CC=/usr/bin/clang).
There must be an easy way to switch the default compiler between gcc/g++ and clang. One way would be by issuing a command like
“dpkg-reconfigure default-compiler”. I think that debuild, sbuild can be changed to take optional compiler argument (something like –clang –gcc). If this argument is not specified, the default compiler is used (according to CC)
Also I think that when the default compiler is set to clang, some special cases should be checked.
Example: There is gcc hard coded in the Makefile. In this case there should be a dialog box that offers several options to choose from:
1. Leave gcc in this line.
2. Change gcc with the CC variable.
3. Edit with the default text editor.
I have seen the 3rd option in many applications, like svn or crontab. When some file modification is required, the default editor is launched to modify the file.
Also, I’ll check what are the compiling problems of the current packages that can’t compile by just changing gcc with clang. This way I’ll see what checks for special cases to implement.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>