[cfe-dev] How to build libc++ under Linux

Michael Spencer bigcheesegs at gmail.com
Mon Dec 24 14:10:11 PST 2012


On Fri, Dec 21, 2012 at 1:47 PM, François Dumont <frs.dumont at gmail.com> wrote:
> Hi
>
>     I can't find a help mailing list so here is my message on the dev one.
>
>     I built llvm/clang SVN trunk without any problem under my Linux box. But
> building libc++ is not so easy. I try
>
> 1. Run lib/buildit
>
> It ends up with a:
>
> + case $TRIPLE in
> + clang algorithm.o bind.o chrono.o condition_variable.o debug.o exception.o
> future.o hash.o ios.o iostream.o locale.o memory.o mutex.o new.o random.o
> regex.o stdexcept.o string.o strstream.o system_error.o thread.o typeinfo.o
> utility.o valarray.o -fPIC -o libc++.so.1.0 -shared -nodefaultlibs
> -Wl,-soname,libc++.so.1 -lpthread -lrt -lc -lstdc++ -std=c++0x
> -fstrict-aliasing -Wall -Wextra -Wshadow -Wconversion -Wnewline-eof -Wpadded
> -Wmissing-prototypes -Wstrict-aliasing=2 -Wstrict-overflow=4
> /usr/bin/ld: cannot find crtbeginS.o: No such file or directory
> clang-3: error: linker command failed with exit code 1 (use -v to see
> invocation)
>
> 2. Put libcxx within llvm/tools
>
>     Like must be done for clang. It has no effect when building llvm.
>
> 3. Use cmake
>
>     I have created a build-libcxx folder next to ibcxx and call
>
> cmake ../libcxx
>
>   from it. The result is:
>
> -- Looking for __gcc_personality_v0 in gcc_s
> -- Looking for __gcc_personality_v0 in gcc_s - found
> CMake Error at lib/CMakeLists.txt:34 (add_dependencies):
>   add_dependencies called with incorrect number of arguments
>
>
> -- Found PythonInterp: /usr/bin/python2.7
> -- Configuring incomplete, errors occurred!

I have a fix for this that I will commit sometime soon. However
currently you can do it via:

1) Configure libc++ with CMAKE_INSTALL_PREFIX=/usr (clang only looks
for libc++ here on Linux)
2) Set LIBCXX_CXX_ABI to libsupc++ and reconfigure.
3) Set LIBCXX_LIBSUPCXX_INCLUDE_PATHS to a ; separated list of paths
to the libsupc++ headers. On my linux machine this is
"usr/include/c++/4.6;/usr/include/c++/4.6/x86_64-linux-gnu"
4) Reconfigure
5) Generate, build, install

I have been using libc++ with clang on Linux for over a year now and
I've only found one bug (that was fixed in less than 24 hours).

- Michael Spencer

>
>
> So I am stuck, can someone help ?
>
> Thank you
>
> François
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list