Serious problem building LLDB to go with Clang 3.5 on Ubuntu 12.04

I have Clang and use it a lot. I want to move to Clang 3.5 so that I can work with c++1y.

My system is Ubuntu Linux 12.04 which has gcc 4.6 as its standard compiler. This does not have support for c++1y and so I have built libc++. I installed this with libcxxrt which is one of the options for that and have been using libc++ for some time, including an svn release to accompany clang.

My problems have started when I wanted to build LLDB as well, so I obtained the latest trunk SVN (198208).

This will not build with libstdc++ from GCC 4.6 as LLDB uses the 'emplace' member of map which is not supported by GCC 4.6:

I should have added the commands I am running to build LLDB, which is in the LLVM tree in tools.

export CXX=/home/fletcher/LLVM/llvm-3.5.svn/local/bin/clang++
export CC=/home/fletcher/LLVM/llvm-3.5.svn/local/bin/clang
export CPPFLAGS="-I/home/fletcher/LLVM/libcxxDec2013/libcxx/include -I/home/fletcher/LLVM/libcxxDec2013/libcxxabi/include -stdlib=libc++"
export LDFLAGS="-Xlinker -R/home/fletcher/LLVM/libcxxDec2013/libcxx/lib -L/home/fletcher/LLVM/libcxxDec2013/libcxx/lib -lc++ -lc++abi"
../llvm/configure --prefix=/home/fletcher/LLVM/llvm-3.5.svn/local --enable-cxx11=yes --enable-optimized --enable-libcpp=yes --enable-targets=x86_64

If there is anything else I can do please let me know.

John

If you're using libcxxrt you'd also need an unwind fwiw. I also don't quite understand why adding -lc++abi.. (That doesn't make 100% sense I think.) Skipping other issues I don't think g++-4.6 is supported anymore. Why not install 4.8.2 or whatever? I thought there was some big discussion on the list about gcc minimums and it was determined that was generally available enough.

Thank you for the quick reply.

My libc++ was built with libcxxrt and I did supply the unwind headers. When I tried to use it to build LLDB I had undefined references to libc++abi.

I have then built also libc++abi and use that for the LLVM/Clang/LLDB build. I added the libc++abi to make the linkage failures go away.

The whole point of using Ubuntu 12.04 is for long term support (from Ubuntu) for stability and not having to change my operating system very often.

The point of using clang is that it has much superior features and I can add it on top. I don't see why it should have a dependency to gcc when I am using libc++.

This problem would be solved if LLDB did support 4.6 (unlikely from what you say although it seems to be only a few lines of code) or the linking problem could be resolved. I think that this is the very last stage at the end of the build.

Thank you again

John

I think you were using the unwind from libc++abi.. and not this - https://github.com/pathscale/libunwind. Please let me know exactly what undefined references you hit

If I take out the libc++ from my LDPATH

I get this when I run ./config. It is compiling conftest.c

/home/fletcher/LLVM/libcxxDec2013/libcxx/lib/libc++.so: undefined reference to `__cxa_rethrow_primary_exception'
/home/fletcher/LLVM/libcxxDec2013/libcxx/lib/libc++.so: undefined reference to `__cxa_current_primary_exception'
/home/fletcher/LLVM/libcxxDec2013/libcxx/lib/libc++.so: undefined reference to `__cxa_increment_exception_refcount'
/home/fletcher/LLVM/libcxxDec2013/libcxx/lib/libc++.so: undefined reference to `__cxa_decrement_exception_refcount'

I am wondering if I should rebuild libc++ with a consistent use of libc++abi rather than libcxxrt.

One of the problems for a someone who is mainly a user is working out exactly how to get these things built.

Thank you for your help.

John

Sorry, it was -lc++abi which I took out, not -lc++

John

I have worked through the problem and I have built a copy of libc++ with libc++abi, all components built with clang. I have tested that and can use it to build programs.

I have used the new version to build LLVM, clang and LLDB and I still get a failure to build liblldb.so at what I assume is the end or near the end.

The last part of the (very long) error message is like this: