Search code examples
linuxcompilationclang

Clang huge compilation?


Good Morning.

I am compiling Clang, following the instructions here Getting Started: Building and Running Clang

I am on linux and the compilation goes smoothly. But I think I am missing out something...

I want to compile ONLY clang, not all the related libraries. The option -DLLVM_ENABLE_PROJECTS=clang seems doing what I want (check LLVM_ENABLE_PROJECTS here) If I use the instructions written there, I can compile, but I think I am compiling too much....a build directory of 70GB seems too much to me...

I tried to download the official debian source and compile the debian package (same source code! just using the "debian way" to create a package from official debian source), just to compare...The compilation goes smoothly, is very fast, and the build directory is much much smaller...as I expected...

I noticed in the first link I provided the phrase "This builds both LLVM and Clang for debug mode."...

So, anyone knows if my problem is due to the fact that I am compiling a "debug mode" version? if so, how could I compile the default version? and is there a way to compile ONLY clang without LLVM?


Solution

  • Yes, debug mode binaries are typically much larger than release mode binaries.

    Cmake normally uses CMAKE_BUILD_TYPE to determine he build type. It can be set from the command line with -DCMAKE_BUILD_TYPE="Release" o -DCMAKE_BUILD_TYPE="Debug" (sometimes there are other build types as well).