Catégorie: "Développement"

libc++: New C++ standard library in Debian

Août 15th, 2012

Thanks to the work of Andrej Belym, Debian has now a new C++ standard library. This work has been done in the context of the Google Summer of Code 2012.
Available in Debian Experimental, this new packages provides both the runtime libraries (libc++abi1) and the C++ headers (libc++-dev).

With this library, it is possible to build a C++-based program without any dependency on libstdc++.

For example, as detailed in README.Debian, with the (amazing) C++ code:

// foo.cpp
#include <iostream>

int main() {
std::cout < < "plop" << std ::endl;
return 0;
}

with clang++ (or g++) will give:

$ clang++ -o plop foo.cpp
$ ldd plop |grep c++
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f15791cb000)

Using libc++, it will drop the dependency on libstdc++ to use lib++

$ clang++ -stdlib=libc++ -o plop foo.cpp
$ ldd plop |grep c++
libc++.so.1 => /usr/lib/x86_64-linux-gnu/libc++.so.1 (0x00007f87464df000)

For the record, it is not that trivial to do with g++. The command being:

g++ -nostdlib -lc++ -lc++abi -std=c++11 -o plop /usr/lib/x86_64-linux-gnu/crt1.o /usr/lib/x86_64-linux-gnu/crti.o foo.cpp /usr/lib/x86_64-linux-gnu/crtn.o -isystem/usr/include/c++/v1 -lc -lgcc_s

Besides this change, libc++ provides a support of C++ 11, considered as "correct" against the C++11 standard by upstream.

// bar.cpp
#include <chrono>
int main() {
return 0;
}

clang++ -stdlib=libc++ -o bar bar.cpp

More information:

News on Debian & clang

Juillet 24th, 2012

A couple week ago, during the last debconf (Debian Conference) in Managua/Nicaragua, I presented the latest developments about the inclusion of clang in the Debian architecture.

To sum up (details are available in the slides and the video), the rebuild of the Debian archive with Clang 3.1 increased the number of failures from 8.8 to 12.1%. The main reason is that further checks have been added to clang.

With Paul Tagliamonte as co-mentor and Alexander Pashaliyski as a GSoC student, we made great progress in bringing Clang as A new compiler in the Debian infrastructure.

The various feedbacks that I had during Debconf were pretty good. It interests many people for reasons like Quality Assurance (more checks), performances, hackability or to decorrelate Debian and GCC.

Build Debian with another compiler - Slides
Build Debian with another compiler - Video

A nice resume of my talk has been made by Michael Larabel on Phoronix:
Decoupling GCC From Debian By Using LLVM/Clang

Rebuild of the Debian archive with clang

February 29th, 2012

Recently, I have been working on a side project for Debian. The goal was to rebuild of the Debian archive (the distribution) with clang, a new C/C++ compiler.

clang is now ready to build software for production (either for C, C++ or Objective-C). This compiler is providing many more warnings and interesting errors than the gcc suite while not carrying the same legacy as gcc.
This rebuild has several goals. The first one is to prove (or not) that clang is a viable alternative. Second, building a software with different compilers improves the overall quality of code by providing different checks and alerts.

The result are detailed and explained here:
http://clang.debian.net/

Conclusions
When I had the idea to rebuild Debian with a new compiler, I was expecting many issues and bugs caused by clang but I have been surprised to notice that most of the issues are either difference in C standard supported, difference of interpretation or corner cases.
My personal opinion is that clang is now stable and good enough to rebuild most of the packages in the Debian archive, even if many of them will need minor tweaks to compile properly.
In the next few years, coupled with better static analysis tools, clang might replace gcc/g++ as the C/C++ compiler used by default in Linux and BSD distributions.
The clang developers are progressing very fast: 14.5% of the packages were failing with version 2.9 against 8.8% with version 3.0.
Several major steps in the clang adoptions have been made like chromium/chrome being built by default with clang, Xcode providing clang by default, FreeBSD working on the gcc -> clang switch, etc.
However, on the Debian point of view, one of the important step would be to make sure that clang manages all the Debian architecture/kernel (11 official, 6 unofficial)

Java en Opensource ?

Juin 30th, 2006

Mont Aoraki (NZ)
Mont Aoraki

Ce matin à l'INRIA avait lieu une conférence sur Java. L'intervenant était James Gosling (oui, moi aussi un jour j'aurais une page wikipedia &#58;&#112;) qui est considéré comme le créateur de Java.
Il venait pour parler de Java en tant que plateforme scientifique, Java pour le temps réel et le refactoring (réorganisation) de large Java Code (ie plusieurs millions de lignes de code).
Je reviendrais sur la conférence en soit dans un autre billet.

A la fin de la conf, je lui ai posé une question qu'il doit souvent entendre :
"Sun a changé récemment de PDG, celui-ci parle de plus en plus de passer Java en Opensource (logiciel libre), qu'en pensez-vous ?"
Il a tout d'abord rappelé que les sources de Java étaient publiques un bout de temps. Il a ensuite expliqué pourquoi Java n'avait pas été passé en Logiciel Libre "pur" : Sun garantit le fonctionnement de la Java Virtual Machine sur toutes les plateformes officielles mais cette opération ne serait que difficilement envisageable si cette opération était réalisée par quelque chose de décentralisé.
Aussi qu'il est arrivé dans le passé que des partenaires/concurrents reprennent la JVM et l'adapte à leurs besoins tout en cassant la compatibilité avec les autres plateformes (il a cité la PME situé à Seattle, Redmont plus précisement). On se rappelle des problèmes des applets qui ne fonctionnait pas (bien?) avec la "JVM Microsoft".

Enfin, ce qui va faire plaisir aux fadas des logiciels libres. Il a annoncé qu'il envisageait un fonctionnement à la manière du groupe Apache en terme de licence. C'est-à-dire une licence qui soit libre tout en instaurant l'obligation au logiciel de changer de nom si fork il y a.
Il n'a pas donné de dates mais ça va dans le sens logiciel libre...

Ma vie (piouf)

Mai 25th, 2006

De retour en France début avril, ces deux derniers mois ont été consacrés à la recherche d'un boulot et d'un appartement.
J'ai maintenant les deux et qui ont tout pour me plaire.
Niveau de l'appartement, je me suis installé avec mon amie dans un trois pièces situé à Paris (20 ème) près de la place de Nation. Super appartement, content et bien chez nous dedans. Bon, le seul problème est que l'on a pas encore l'ADSL... Donc je squate la connexion chez Pimentech.

Pour le boulot, après de longues recherches (cf message précédent), j'ai finalement trouvé exactement le boulot que je recherchais. Je vais intégrer le prestigieux institut qu'est l'INRIA - Institut National de Recherche en Informatique et Automate (pour ceux qui ne connaissent pas, c'est comme le CNRS mais appliqué à l'informatique). Régulièrement classé dans le top 3 de 01 informatique des entreprises préférées des informaticiens.
Je vais être amené à travailler sur le projet Scilab, logiciel de calcul scientifique. Mon travail consistera principalement en les développements multi plates-formes en vue de la réalisation des fonctionnalités de Scilab 5 et la responsabilité des versions UNIX et GNU/Linux du logiciel Scilab. Je sens que je vais bien m'amuser !

Ce fut un retour et une réinstallation en France un peu plus longue que je ne l'avais imaginé mais qu'il est au final bien passé !