notwaldorf / ama

:raising_hand: Ask @notwaldorf anything!
94 stars 13 forks source link

Compile time of Chromium and other questions #34

Closed shimakazekai closed 8 years ago

shimakazekai commented 8 years ago

Hi,

I want to start contributing to chromium, (I am a beginner with regards to C++ and programming in general) and I read that the compile time can take a few hours and that's on a decent PC (and I have just an overclocked i5, 8gb ram, and no SSD), so I'm concerned that if each compilation will have to take hours then, how can you get anything done?

Also, I'm using visual studio and I read that chromium is using a different compiler, I read on your site that you debug with printfs, but to where does those printfs go? The chrome console? (I'm used to console applications)

Also, don't you ever need to step into the programs sometimes to follow the bug? How does Chromium devs debug and step into this huge project?

Thanks for doing this. S

notwaldorf commented 8 years ago

Oh boy, all of these are great questions. First, yay! :tada: Welcome to Chromium! :tada:

This ended up being an enormous reply, so I broke it in sections. 🐳

Hardware

Most Chrome developers that work for Google have incredibly beefy machines under their desks, that build Chromium really, really fast. I had a Z620 with a buuunch of cores, and it was magical. Even then, a complete rebuild would be about 20-25 minutes. I've also successfully built Chromium on my laptop, which is a 2.3 GHz retina MBP with 16GB of RAM and a 256 GB SSD.

The official build instructions say that the minimum recommended setup is 4-8 cores and 16-32 GB of RAM are best. An SSD helps a ton. I think you should give your setup a try, and see what happens; worst case scenario, it will just take 10 hours. You'll also notice that just downloading the code will take a very long time -- there's like 10+ gigs of Chromium code, syncing all of it ain't a walk in the park 😅

Faster builds

A lot of "being productive" comes from tricks that make you rebuild less code:

Edit: @nico just pointed out he has more tricks to make incremental builds super fast. His full answer is here, but the TL; DR is:

Debugging

Here's the instructions on debugging on Windows. I can't remember if printfs work on Windows anymore (they used to not, because the Windows command prompt is not actually a terminal; I mostly used a Mac, and there they definitely go to the console), but if they do, they would either go to the command prompt, or the chrome_debug.log file (the link should help you with that), or both.

I also sometimes used lldb (which is the llvm equivalent to gdb). I wrote a bunch of bare minimum instructions on how to use llvm for literally just setting breakpoints, stepping through code, and inspecting variables, which is usually what I need the most.

Hope this helps, and good luck! ✨