[cfe-dev] [llvm-dev] Build clang front end only for few languages ( say C and C++ )
Vedant Kumar via cfe-dev
cfe-dev at lists.llvm.org
Fri Sep 22 18:04:35 PDT 2017
> On Sep 22, 2017, at 6:03 PM, Mehdi AMINI <joker.eph at gmail.com> wrote:
>
>
>
> 2017-09-22 11:04 GMT-07:00 Vedant Kumar via cfe-dev <cfe-dev at lists.llvm.org>:
>
>> On Sep 22, 2017, at 10:55 AM, Nitish Srivastava <nks45 at cornell.edu> wrote:
>>
>> Hi Vedant,
>>
>> Clang + llvm build together takes around 26 GB. I was curious if there are any tricks to reduce the size as I need only C and C++ languages in frontend and RISCV ISA for llvm backend. For the backend I am already passing -DLLVM_TARGETS_TO_BUILD=RISCV to generate the backend only for RISCV. I was curious if I can do something to reduce the size of the clang build.
>
> Some ideas:
>
> 1. It sounds like you might have configured a Debug build. If you don't need to debug clang, you can configure a Release build instead, which will be much smaller.
>
> 2. You can enable a shared-library build to cut down on binary size (-DBUILD_SHARED_LIBS=On). That means there will be just one copy of the code from each llvm library in your build directory, instead of two.
>
> 3. You can pare down the list of targets you build. Just building the "clang" target is much faster, and takes much less space, than building the full suite of llvm tools (which is what you get if you run "ninja" or "make").
>
> 4. If you're building a Release clang, you can use -Os or -Oz, instead of -O3 which is the default.
>
> I'd add on top of this to enable only the backend you care about, for example `-DLLVM_TARGETS_TO_BUILD=X86`, disable plugins `-CLANG_PLUGIN_SUPPORT=OFF` and try to enable LTO `-DLLVM_ENABLE_LTO=ON` (the latter may not be a win though, but with -Os hopefully it will!).
>
> The clang binary can get down to ~50MB, but I suspect getting it smaller is likely gonna require more intrusive work.
Yeah. I also forgot about -DCLANG_ENABLE_ARCMT=Off and -DCLANG_ENABLE_STATIC_ANALYZER=Off, which can cut down on build-time a bit.
vedant
>
> Best,
>
> --
> Mehdi
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170922/38767d5e/attachment.html>
More information about the cfe-dev
mailing list