Building on multiple coresPosted: 2014-03-16 Filed under: slackbuilds, system | Tags: compiling, make, RAM, slackbuilds, speed up 2 Comments
Sometimes, I want to build a package as fast as possible. I have done this, when I had to make a new SlackBuild for something large and I just want to see if all requirements are met. The UniPro Ugene SlackBuild comes to mind. In this case I modified the
make line within the SlackBuild like this:
My build machine has a quad core CPU and this would utilise all cores for the compilation. This, combined with the compiling in RAM approach will speed up the whole process dramatically.
However, the building of some programs would fail if you use multiple cores, and SBo makes sure that only a single core is used. So, I avoid doing this. Recently there was a discussion concerning this at LQ.
I still haven’t tried setting this globally…
Some 7 years later, I did set it globally. What you need to do is, add this to
export MAKEFLAGS=' -j10'
I’ve heard about the potential of builds failing with -j options, but I have yet to actually witness it. I define it globally, myself, and should ever I experience build problems that I cannot explain, I’ll try switching it off. But for now, and for the past two years, -j8 has been a very good friend.
Yes, i have not had problems either. Yet. Ugene, for example, takes about one hour and a half to compile in a virtual machine on a single core. I do that when I test the SlackBuild for a new update, but when I was making it the first time and wanted to just see _fast_ if it works, I used 4 cores.