LLVM questions

Hi folks!

I have a couple of questions:
1. Why is LLVM_LINK_LLVM_DYLIB not ON by default? Who needs a 2+GB bin/clang?
2. Why is BUILD_SHARED_LIBS output smaller than the one generated with
   LLVM_LINK_LLVM_DYLIB? Shouldn't it be the other way since the latter saves
   a lot of header information?
3. To make things easier for people who only want to compile llvm, clang and
   libcxx*, a small snippet like the following on a prominent place would be
   nice:
=== snip ===
VERSION=8.0.1
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${VERSION}/llvm-${VERSION}.src.tar.xz
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${VERSION}/cfe-${VERSION}.src.tar.xz
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${VERSION}/libcxx-${VERSION}.src.tar.xz
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${VERSION}/libcxxabi-${VERSION}.src.tar.xz
tar xf llvm-${VERSION}.src.tar.xz
tar xf cfe-${VERSION}.src.tar.xz
tar xf libcxx-${VERSION}.src.tar.xz
tar xf libcxxabi-${VERSION}.src.tar.xz
mv cfe-${VERSION}.src llvm-${VERSION}.src/projects
mv libcxx-${VERSION}.src llvm-${VERSION}.src/projects
mv libcxxabi-${VERSION}.src llvm-${VERSION}.src/projects
mkdir build
cd build
cmake \
  -DLLVM_ENABLE_FFI=ON \
  -DCMAKE_BUILD_TYPE=Release \
  -DLLVM_ENABLE_RTTI=ON \
  -DLLVM_TARGETS_TO_BUILD="host" \
  -DBUILD_SHARED_LIBS=ON \
  ../llvm-${VERSION}.src
cmake --build .
cmake -DCMAKE_INSTALL_PREFIX=/some/where -P cmake_install.cmake
=== snap ===

Greetings,
Fabiano

Hi folks!

I have a couple of questions:

  1. Why is LLVM_LINK_LLVM_DYLIB not ON by default? Who needs a 2+GB bin/clang?

Because dynamic linking is slow - last I checked, at least for me/my setup, the extra time spent in static linking was less than the time spent dynamic linking when running all of LLVM & Clang’s regression tests.

(that said, my clang binary is only 687MB - I guess yours is 2GB because you’re using debug info without split-dwarf (try LLVM_USE_SPLIT_DWARF if it’s suitable for your needs))