0

I'm trying to build linux docker image, that will use clang and llvm libs (compiler-rt, libunwind, libc++, ...) for build always by default. I've seen this question, but it uses CMake variables. I want to not have to make any edits to the projects themselves, so that llvm is always used by default. How can I achieve this?

Marioanzas
  • 1,663
  • 2
  • 10
  • 33
Igor Pugachev
  • 604
  • 1
  • 5
  • 14

1 Answers1

2

You have to build llvm with special flags (full info):

-DLIBCXX_USE_COMPILER_RT=YES      # compiler-rt in libc++
-DLIBCXXABI_USE_LLVM_UNWINDER=YES # libunwind in libc++
-DCLANG_DEFAULT_CXX_STDLIB=libc++ # libc++ as std lib in clang by default
-DCLANG_DEFAULT_RTLIB=compiler-rt # compiler-rt in clang by default

And update cc/c++ links:

update-alternatives --install /usr/bin/cc cc /usr/bin/clang 800 \ 
                    --slave /usr/bin/c++ c++ /usr/bin/clang++ 
Igor Pugachev
  • 604
  • 1
  • 5
  • 14