[Soc-coordination] Report 5: Provide an alternative to libstdc++ with libc++

Andrej Belym white.wolf.2105 at gmail.com
Sun Aug 19 08:06:05 UTC 2012


Hello,
it is last report for project "Provide alternative to libstdc++ with
libc++", mentored by Sylvestre Ledru.

I've found bug in clang header <stdin.h>, that failed building compiler-rt,
and succesfully fixed it. Now clang package in Debian experimental provides
compiler-rt too (but currently Debian GNU/Linux i386 & amd64 only).

I've installed Debian/Hurd (i386), Debian/kfreebsd (i386/amd64) in
qemu-kvm, and tried building my package. Unfortunaly, my package failed to
build:
on Hurd clang is completely unusable. Looks like assembler(compiler)
command isn't defined for this platform, so it fails when compiling any
program with message:

> error: unable to execute command: posix_spawn failed: No such file or
> directory
> error: clang frontend command failed due to signal (use -v to see
> invocation)
> note: diagnostic msg: Please submit a bug report to http://llvm.org/bugs/ and
> include command line arguments and all diagnostic information.
> error: unable to execute command: posix_spawn failed: No such file or
> directory
> note: diagnostic msg: Error generating preprocessed source(s).


on kFreeBSD clang has multiple bugs:
a) clang try use gcc as assembler(compiler) instead of internal clang/LLVM
compiler.
b)  when specifying '-std=c++0x' flag for clang++, it breaks using advanced
C standard, and looks like will be using: some functions
requires C99, C95 standards and checks it with defined macroses like
__USE_ISOC99, __USE_C95. So, when flag '-std=c++0x' specified for clang++,
it breaks defining these macroses; without this flag all fine.
c) in Debian clang headers located in  /usr/include/clang/3.1/include, and
that path is append (normally) to default include search path by
patch  21-searchPathHeaders.diff, Looks like on kFreeBSD-i386 clang
compiled  without this patch, so it's finding headers (and stddef.h) in
/usr/lib/clang/3.1/include instead of /usr/include/clang/3.1/include.

We've fixed most of these bugs.

I've sent direct mail to libunwind maintainer, but have not received reply.
Also bugs opened on BTS don't have progress.

Now I'm writing documentation, that accumulates all information collected
about  C++ stack on Linux, as default and available libraries, compiler
support, and so on.

----Conclusion----

I've created Debian package of libc++. Now it is placed in experimental
repository. Package can be builded manually with svn-buildpackage; package
follows Debian multiarch recommendations. Great libc++ test suite (4300+)
tests packaged in libc++-src. libc++abi that packaged too allows build
applications with libc++ without dependency of libstdc++. So in future
(very far future :) libc++ can replace libstdc++.

Also I tried replace another parts of standard C++ stack (and a bit of C
too). I've written patches for libunwind; with these patches it can be used
as stack unwinding library of C++ stack. Also I've created patch for
compiler-rt, and it'll be provided now in clang package.

libc++-dev package provides scripts (clang++-libc++, g++-libc++) that
allows easy compilation with libc++. These scripts also installed as
default compiler (/usr/bin/c++) using update-alternatives.

I've tested building package on Debian GNU/Hurd, Debian GNU/kFreeBSD. Not
all was good during bugs in clang on these platforms, but now it'll be
well.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/soc-coordination/attachments/20120819/bd7a996f/attachment.html>


More information about the Soc-coordination mailing list