Building clang/llvm without libstdc++ or GPLv3 tools/libraries

Greetings!!!

Could you please suggest ways to build clang/llvm without libstdc++?

In short, to avoid using GPLv3 libraries or tools while building clang/llvm.

Thank you in advance.

-Hiral

Have a look at libc++ (http://libcxx.llvm.org/), you can use it in
place of libstdc++.

ismail

Thank Ismail for quick reply.

I read that Linux, we need to build...
(1) libcxx (without libcxxabi) ==> done
(2) build libcxxabi ==> failing with following error
(3) and then re-build libcxx

By the way I am building libcxx and libcxxabi Out-of-tree llvm build.

Please correct me if I am missing something.

Thank you.
-Hiral

(Removing llvmdev from CC since this is probably off topic there)

Thank Ismail for quick reply.

I read that Linux, we need to build...
(1) libcxx (without libcxxabi) ==> done
(2) build libcxxabi ==> failing with following error
(3) and then re-build libcxx

By the way I am building libcxx and libcxxabi Out-of-tree llvm build.

Please correct me if I am missing something.

Easiest way to do this is doing an in-tree build hence a directory
structure like

/toplevel-llvm-src-directory
                                          /tools/clang
                                          /projects/libcxx
                                          /projects/libcxxabi
                                          /projects/compiler-rt

and build as-usual. This will get you a libcxx/libcxxabi build. But to
get clang to use it you need to build it once more with the installed
libcxx with -DLLVM_ENABLE_LIBCXX=ON option.

Hope that helps.

ismail

Thank Ismail for quick reply.

I read that Linux, we need to build...
  (1) libcxx (without libcxxabi) ==> done
(2) build libcxxabi ==> failing with following error

What's the error?

(3) and then re-build libcxx

I don't think you need to build & rebuild libcxx. The correct order is:

   1) build libcxxabi
   2) build libcxx
   3) test libcxxabi
   4) test libcxx

This is because of some unfortunate layering violations in libcxxabi, where it depends on the c++ library's headers. Also, the libcxxabi tests depend on libcxx being built.

Cheers,

Jon

We ship PNaCl’s LLVM on Linux and Mac with libc++ and libc++abi. We build a libc++.so/dylib that includes the libc++abi files directly and doesn’t depend on libstdc++ at all (it does depend on libc.so and libgcc_s.so; on mac it only depends on libSystem.B.dylib and not on any external libc++abi). Doing it this way sidesteps any layering issues with libc++ and libc++abi.

I will try your suggestions and get back you in case of any queries.

Thank you for suggestions.

-Hiral