Tim Northover
2014-Jun-02 14:18 UTC
[LLVMdev] How much memory clang llvm needs for debug compiling?
Hi,> What should I do to make debug enabled compiling successful? Anyone > can tell me a tiny configuration which can save memory? I only have 3G > RAM, Ubuntu kylin.3GB is probably going to be painful no matter what you do, but there are a few things to try. First, you could switch to ld.gold instead of ld.bfd. It uses much less memory when linking. It can also be helpful to reduce the parallelism of the build so that only one thing is linking at any one time. Finally, you can build clang with the debug info in separate files. This needs a newer gdb & gcc/clang to work properly, but 14.04 should be fine. This made a massive difference to me, so I'm really keen on the idea. I think for autoconf you need ".../configure --enable-split-dwarf" to use this. Good luck! Tim.
Nancy
2014-Jun-03 14:59 UTC
[LLVMdev] How much memory clang llvm needs for debug compiling?
> First, you could switch to ld.gold instead of ld.bfd. It uses much$ln -s `which gold` /usr/local/bin/ld> the idea. I think for autoconf you need ".../configure > --enable-split-dwarf" to use this. >$.../configure --enable-targets=x86 --enable-split-dwarf $ make -j2 $ sudo make install It works for me. Thanks a lot! I want to use emacs+gdb to trace the code work flow. M-x gdb Run like gdb --annotate=3 clang (gdb) set args test.c (gdb) b main (gdb) b /home/nancy/work/llvm/tools/clang/lib/Lex/Lexer.cpp:57 (gdb) r It block at llvm/tools/clang/tools/driver/driver.cpp main() fucntion. (gdb) c program exit normally why? why it not call Lexer.cpp:InitLexer()? And I really can't find any entry point to clang/lib/*.cpp files within help of SourceInsight code view start from llvm/tools/clang/tools/driver/driver.cpp main() function. What's wrong with me? -- Best Regards, Yu Rong Tan
Eric Christopher
2014-Jun-03 21:16 UTC
[LLVMdev] How much memory clang llvm needs for debug compiling?
On Tue, Jun 3, 2014 at 7:59 AM, Nancy <nancydreaming at gmail.com> wrote:>> First, you could switch to ld.gold instead of ld.bfd. It uses much > $ln -s `which gold` /usr/local/bin/ld > >> the idea. I think for autoconf you need ".../configure >> --enable-split-dwarf" to use this. >> > $.../configure --enable-targets=x86 --enable-split-dwarf > $ make -j2 > $ sudo make install > > It works for me. Thanks a lot! > > I want to use emacs+gdb to trace the code work flow. > M-x gdb > Run like gdb --annotate=3 clang > (gdb) set args test.c > (gdb) b main > (gdb) b /home/nancy/work/llvm/tools/clang/lib/Lex/Lexer.cpp:57 > (gdb) r > It block at llvm/tools/clang/tools/driver/driver.cpp main() fucntion. > (gdb) c > program exit normally > why? why it not call Lexer.cpp:InitLexer()? And I really can't find > any entry point to clang/lib/*.cpp files within help of SourceInsight > code view start from llvm/tools/clang/tools/driver/driver.cpp main() > function. > > What's wrong with me? >You need to use the -cc1 option that clang is being reinvoked with, use the -v option on your original command line to take a look at it. Also, if you're just doing development you don't need to install the binary. The clang in build/Debug+Asserts/bin/clang will work just fine. -eric