Boost logo

Boost Users :

Subject: Re: [Boost-users] Using c++11 features in clang
From: Roland Bock (rbock_at_[hidden])
Date: 2012-07-11 09:17:42


On 2012-07-06 09:31, John Maddock wrote:
>> In response to a some questions on the boost-users list (and boost
>> bug reports), I wrote up this:
>> http://marshall.calepin.co/llvmclang-and-standard-libraries-on-mac-os-x.html
>>
>>
>> I don't know if this should be a FAQ entry for Boost, or for clang.
>> Suggestions/comments/edits welcome.
>
> So.... is there a similarly idiot proof procedure for Clang on Linux?
>
> I ask because every time I've tried it, the compiler chokes on
> libstdc++'s headers, and since there's no libc++ support option for
> Linux it make's it hard to test/diagnose Clang issues for those of us
> that don't have a Mac :-(
>
> John.

I use clang like this under Linux:

$ clang -std=c++11 -stdlib=libc++ -lc++ test.cpp
$ ldd ./a.out
        linux-vdso.so.1 => (0x00007fffe2bff000)
        libc++.so.1 => /usr/local/lib/libc++.so.1 (0x00007f54ea1d7000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1
(0x00007f54e9fc1000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f54e9c2b000)
        libcxxrt.so => /usr/local/lib/libcxxrt.so (0x00007f54e9a0d000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007f54e97ef000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f54e95e6000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f54e93e2000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f54ea49a000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
(0x00007f54e90dc000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f54e8e56000)

For building the library, I found the essential hint here:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-March/020381.html

I chose libcxxrt. Works fine in the examples I tried so far.

Without specifying the ABI library, the c++11 code would compile but not
run, e.g. using std::cerr would crash the program.

Hope that helps and please: Next one to succeed under Linux: Write down
the exact procedure (I forgot to do so myself).

Regards,

Roland


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net