LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Compiling Speed (https://www.linuxquestions.org/questions/slackware-14/compiling-speed-4175457723/)

bmarley83 04-10-2013 04:48 PM

Compiling Speed
 
Hello, just signed up today and this is my first post, I hope it is in the right place. I have just started using Slackware last week and I have to say it is fantastic! After trying Ubuntu, Fedora, and Debian I have settled on Slackware and I'm quite pleased. It really seems to support the ideas and the structure of "old school" distributions from the 90's. I have had no crashes, and with help from Alien Bob (creating a multilib system) and slackbuilds.org, I have been able to get all my software not only up and running, but also running much smoother than any other distro, while learning many new things. Anyways enough jabbering! My question is related to compiling programs from source and specifically the speed of compilation. My PC specs are as follows; Intel Q9400 @ 3.2ghz, 6GB DDR2 800mhz, 3 1TB WD Black HD's, and a GTX260 sp216 896MB running the proprietary NVIDIA driver 310.44. When compiling programs from source I notice I am using only one core. I am actually compiling wine in a terminal as I type this. It is hoping from core to core and using 80-100% of that core while compiling. Can I make gcc, or what ever library is used to compile programs, use more than 1 core in order to compile things more quickly, and is there any way to optimize this process? Wine has now been compiling for more than 30 minutes. I'm not in any rush, just want it to be faster and use my system optimally. Can anyone help me?

willysr 04-10-2013 04:50 PM

use make -j <n> where n depends on your cores

bmarley83 04-10-2013 04:55 PM

Thanks willysr! Damn that was quick! lol. Is there anyway I can automate that command so that whenever any script uses the make command it will use the defined number of cores automatically?

volkerdi 04-10-2013 04:58 PM

I'm not aware of any way other than passing the -j option to make. By the way, I usually use n+1 or n+2 for better core utilization (especially if you have a decent amount of RAM). You'll probably cut 10% off the compile time that way.

saulgoode 04-10-2013 05:03 PM

Quote:

Originally Posted by bmarley83 (Post 4929330)
Thanks willysr! Damn that was quick! lol. Is there anyway I can automate that command so that whenever any script uses the make command it will use the defined number of cores automatically?

export MAKEFLAGS=" -j6"

(I add the command to my .bashrc)

bmarley83 04-10-2013 05:04 PM

Okay, so if wanted a particular script to use more cores I could go through it and replace the make with make -j 2 and it would work?

---------- Post added 04-10-13 at 05:05 PM ----------

:D thanks saulgoode! I am gonna try that now.

TobiSGD 04-10-2013 05:12 PM

You can either run a a Slackbuild manually with
Code:

MAKEFLAGS=" -j6" package.Slackbuild
if you want to use more than one core (replace the number with the appropriate number for your system, I use -j10 on my 6-core and -j3 on my 2-core), or you use the suggestion from saulgoode.

I do the latter for quite sopme time now and it works great. Be aware that some software will not compile when using more than one core (for example webkitgtk), but usually the package maintainer adds a
Code:

MAKEFLAGS=" -j1"
to those packages. I never had to manually edit a script for that.

bmarley83 04-10-2013 05:42 PM

You guys are awesome! Doing exactly what saulgoode said I am currently compiling chromium with the slackbuilds script with all four cores at 100% ! Thank you so much fellas this site is great, cant believe all the responses that came so quickly.


All times are GMT -5. The time now is 05:57 PM.