[cfe-dev] Building LLVM+Clang with Clang+libc++

David Blaikie dblaikie at gmail.com
Wed Aug 3 08:20:55 PDT 2011


> on Ubuntu linux - after using
> symlinks to work around some weird binary/include placement in
> Ubuntu

To come back to this point as a tangent to the main thread - is it
just me, or is clang broken on Ubuntu? The workaround was simple, but
I'm wondering if there was something obvious I missed.

Step 1) Lib directories.
The big if/else block in tools/clang/lib/Driver/ToolChains.cpp:1500
doesn't seem to work on Ubuntu as it puts the triple twice in the gcc
path. For example crtbegin.o is
    /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.4/crtbegin.o (
http://packages.ubuntu.com/search?searchon=contents&keywords=crtbegin.o&mode=exactfilename&suite=natty&arch=any
)
Whereas on Debian, the file location looks like it'd be one that
clang's code would find:
    /usr/lib/gcc/i486-linux-gnu/4.4/crtbegin.o (
http://packages.debian.org/search?searchon=contents&keywords=crtbegin.o&mode=path&suite=stable&arch=any
)

I worked around this by adding a symlink /usr/lib/gcc ->
/usr/lib/i386-linux-gnu/gcc

It looks like there might be one case of the Ubuntu layout supported,
under x86_64, line 1555 of ToolChains.cpp
(/usr/lib/x86_64-linux-gnu/gcc) - perhaps I should just add a similar
case for other architectures?

Step 2) machine specific include paths (asm/errno.h, being the
first/obvious thing that fails when this is wrong)

Again, using Debian as an example that (visual estimate based on clang
source, I haven't run it to confirm), with asm/errno.h in
/usr/include/asm/errno.h I expect clang works fine. (
http://packages.ubuntu.com/search?mode=exactfilename&suite=natty&section=all&arch=any&searchon=contents&keywords=asm%2Ferrno.h
)
But Ubuntu has it in /usr/include/i386-linux-gnu/asm/errno.h & clang
fails to find this path (
http://packages.ubuntu.com/search?mode=exactfilename&suite=natty&section=all&arch=any&searchon=contents&keywords=asm%2Ferrno.h
)

Again, a symlink workaround was to link /usr/include/asm ->
/usr/include/i386-linux-gnu/asm

I haven't looked into the source code enough to see where the include
path is generated to see if there's a reasonable fix, so I'm open to
suggestions.

- David



More information about the cfe-dev mailing list