clang installation size

Hi,

I just cloned a llvm repo from github monolithic repo (release/8.x) and
compiled with under ArchLinux with the following arguments:
cmake -DCMAKE_INSTALL_PREFIX=/home/pmatos/installs/llvm-8x-head
-DCLANG_ANALYZER_ENABLE_Z3_SOLVER=ON -DLLVM_TARGETS_TO_BUILD=X86
-DLLVM_ENABLE_PROJECTS=clang ../llvm-project/llvm

I make and make install. Then I am shocked by the resulting install tree
size. That's 32Gb where bin is the largest folder with binaries as large
as 1.8 Gb, with clang and clangd being the largest ones.
-rwxr-xr-x 1 pmatos pmatos 1821621048 Mar 12 10:38 clang-8
-rwxr-xr-x 1 pmatos pmatos 1493399376 Mar 12 10:35 clangd

This is just ridiculously large. How can I reduce the size of these
binaries and the overall tree? I am compiling this to use `scan-build`
and `clang`, so is there a way to disable all the stuff I might not need?

Hi,

I just cloned a llvm repo from github monolithic repo (release/8.x) and
compiled with under ArchLinux with the following arguments:
cmake -DCMAKE_INSTALL_PREFIX=/home/pmatos/installs/llvm-8x-head
-DCLANG_ANALYZER_ENABLE_Z3_SOLVER=ON -DLLVM_TARGETS_TO_BUILD=X86
-DLLVM_ENABLE_PROJECTS=clang ../llvm-project/llvm

You did not specify the build type, therefore it defaulted to Debug,
which results in both ridiculously slow runtime,
and huge file sizes (due to the debug info).

I make and make install. Then I am shocked by the resulting install tree
size. That's 32Gb where bin is the largest folder with binaries as large
as 1.8 Gb, with clang and clangd being the largest ones.
-rwxr-xr-x 1 pmatos pmatos 1821621048 Mar 12 10:38 clang-8
-rwxr-xr-x 1 pmatos pmatos 1493399376 Mar 12 10:35 clangd

This is just ridiculously large. How can I reduce the size of these
binaries and the overall tree? I am compiling this to use `scan-build`
and `clang`, so is there a way to disable all the stuff I might not need?

--
Paulo Matos

Roman.

I don't see it in your list, so it appears that you're building debug mode. Try adding the cmake flag:
-DCMAKE_BUILD_TYPE=Release

Alternatively, you can use MinSizeRel, which will sacrifice some performance for size.

Argh, yes, I forgot that option. Thanks.