<div dir="ltr"><img width="0" height="0" class="mailtrack-img" alt="" style="display:flex" src="https://mailtrack.io/trace/mail/13bd9689815b697fb4038301d7cffb0e5a8106d5.png?u=407906"><span style="font-size:12.8px">Hi Vedant,</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">  I have tried that. Choosing Release build and MinSizeRel does reduce the size, and I have also tried to set static linking off. As, I am currently hacking clang and llvm both, I do need to have the debug metadata attached to the clang and llvm binaries, that's why I was asking if there are other methods to reduce the size. </div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">  Thanks,</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Best Regards,</div><div style="font-size:12.8px">Nitish</div><br><br><br>‌</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 22, 2017 at 2:04 PM, Vedant Kumar <span dir="ltr"><<a href="mailto:vsk@apple.com" target="_blank">vsk@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On Sep 22, 2017, at 10:55 AM, Nitish Srivastava <<a href="mailto:nks45@cornell.edu" target="_blank">nks45@cornell.edu</a>> wrote:</div><br class="m_-7148135927697870314Apple-interchange-newline"><div><div dir="ltr"><img width="0" height="0" class="m_-7148135927697870314mailtrack-img" alt="" style="display:flex" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7">Hi Vedant,<div><br></div><div>  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_<wbr>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.</div></div></div></blockquote><div><br></div></span><div>Some ideas:</div><div><br></div><div>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.</div><div><br></div><span>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.<br></span><span><br></span><span>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").</span></div><div><span><br></span></div><div><span>4. If you're building a Release clang, you can use -Os or -Oz, instead of -O3 which is the default.</span></div><span class="HOEnZb"><font color="#888888"><div><span><br></span></div></font></span><div><span class="HOEnZb"><font color="#888888"><span>vedant<br></span></font></span><span class=""><span><br></span><blockquote type="cite"><div><div dir="ltr"><div><br></div><div>  Thanks,</div><div><br></div><div>Best Regards,</div><div>Nitish</div><div><br><br><br>‌</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 22, 2017 at 1:47 PM, Vedant Kumar <span dir="ltr"><<a href="mailto:vsk@apple.com" target="_blank">vsk@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">- llvm-dev, + cfe-dev (moving off llvm-dev)<div><br></div><div>Hi Nitish,</div><div><br><div><span><blockquote type="cite"><div>On Sep 22, 2017, at 10:32 AM, Nitish Srivastava via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="m_-7148135927697870314m_3209270154627821229Apple-interchange-newline"><div><div dir="ltr"><img width="0" height="0" class="m_-7148135927697870314m_3209270154627821229mailtrack-img" alt="" style="display:flex" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"><div>Hi,<br><br> I am trying to build clang, however the build size is quite large. As clang supports non-C family languages as well ( e.g. Java, Fortran ),</div></div></div></blockquote><div><br></div></span><div>Clang does not accept Java or Fortran code. It links llvm, which has some language-specific support for calling conventions, but excising this support might not save you much in terms of binary size.</div><span><br><blockquote type="cite"><div><div dir="ltr"><div> is there a way to turn that off during the build. I just want to have support for C and C++ and don't care about other languages.<br><br>Is there a CMake option that needs to be set to do that??<br></div></div></div></blockquote><div><br></div></span><div>What are you measuring exactly? Is it the size of the build directory, the size of the clang binary itself, or something else?</div><div><br></div><div>How small does clang need to be for your purposes?</div><div><br></div><div>vedant</div><br><blockquote type="cite"><div><span><div dir="ltr"><div><br>Thanks a lot!<br><br>Best Regards, <br><br>Nitish<br><br><br>‌</div></div></span>
______________________________<wbr>_________________<br>LLVM Developers mailing list<br><a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br></div></blockquote></div><br></div></div></blockquote></div><br></div>
</div></blockquote></span></div><br></div></blockquote></div><br></div>