Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build size for LLVM 6.0.0 is huge (42G)

Tags:

build

llvm

I built llvm-6.0.0 from source and everything works fine. I'm just wondering how come its size is so huge (42G). Can I easily erase some object files or other to make the build directory smaller?

$ du -hs ~/GIT/llvm-6.0.0/build/
42G /home/oren/GIT/llvm-6.0.0/build/
like image 550
OrenIshShalom Avatar asked May 07 '19 06:05

OrenIshShalom


People also ask

Why is LLVM so large?

An LLVM-only build will need about 1-3 GB of space. A full build of LLVM and Clang will need around 15-20 GB of disk space. The exact space requirements will vary by system. (It is so large because of all the debugging information and the fact that the libraries are statically linked into multiple tools).

How long does it take to build LLVM?

The server this runs on only has 2 cores, so a full LLVM build can take more than two hours. For smaller changes, building LLVM from ccache and compiling the benchmarks takes about 20 minutes.

Does LLVM include Clang?

The Clang project provides a language front-end and tooling infrastructure for languages in the C language family (C, C++, Objective C/C++, OpenCL, CUDA, and RenderScript) for the LLVM project. Both a GCC-compatible compiler driver (clang) and an MSVC-compatible compiler driver (clang-cl.exe) are provided.


1 Answers

You're building without shared libraries, which means that a number of very large libraries are linked statically into a large number of (otherwise small) tools. I'm guessing that you may also be building for all targets (32-bit ARM, 64-bit ARM, a few dozens more, 32-bit X86, 64-bit X86).

If you run cmake -DLLVM_TARGETS_TO_BUILD=HOST -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=on ., you should reduce the space use to about 10G. (At least I have a 10G build tree produced from a similar command line. I also have bigger trees, because those settings aren't the best match for all purposes.)

like image 170
arnt Avatar answered Sep 29 '22 23:09

arnt