Building on multiple cores

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:

make -j4

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 /etc/profile:

export MAKEFLAGS=' -j10'

2 Comments on “Building on multiple cores”

  1. Wantoo Sevin says:

    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.

  2. slackalaxy says:

    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.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s