LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-07-2014, 09:18 AM   #1
irgunII
Member
 
Registered: Jan 2012
Location: Directly above the center of the earth
Distribution: Slackware. There's something else?
Posts: 383

Rep: Reputation: 72
How do I build a pkg using more than one cpu core?


I found this answer once, a good while ago, but for the life of me can't find it now.

Someone told me or another poster where to put something like '-j<# of cores to use>' so that any time I built a package from slackbuilds.org, it would use the number of cores I specified every time so that I didn't have to constantly keep inserting it into the <package>.SlackBuild script.
 
Old 03-07-2014, 09:20 AM   #2
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,584
Blog Entries: 15

Rep: Reputation: 2140Reputation: 2140Reputation: 2140Reputation: 2140Reputation: 2140Reputation: 2140Reputation: 2140Reputation: 2140Reputation: 2140Reputation: 2140Reputation: 2140
make -j2

Note that some packages can't build with parallel building.
 
2 members found this post helpful.
Old 03-07-2014, 09:25 AM   #3
moisespedro
Senior Member
 
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223

Rep: Reputation: 195Reputation: 195
I think you can set the make variable on /etc/profile. Or maybe use a bash alias?
alias make='make -j4' (for example)
 
Old 03-07-2014, 09:36 AM   #4
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Quote:
Originally Posted by ReaperX7 View Post
Note that some packages can't build with parallel building.
This is the most important thing to remember.
 
2 members found this post helpful.
Old 03-07-2014, 10:26 AM   #5
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,860

Rep: Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230
The MAKEFLAGS environmental variable is honored by make:
Code:
export MAKEFLAGS=' -j10'
But as others have pointed out, some packages cannot be built in parallel. clisp comes to mind.
 
2 members found this post helpful.
Old 03-07-2014, 10:43 AM   #6
dederon
Member
 
Registered: Oct 2013
Posts: 110

Rep: Reputation: 56
Quote:
Originally Posted by Richard Cranium View Post
The MAKEFLAGS environmental variable is honored by make:
Code:
export MAKEFLAGS=' -j10'
But as others have pointed out, some packages cannot be built in parallel. clisp comes to mind.
thats the way to go. this won't break any slackbuild - the slackbuilds which need non parallel build use "make -j1".

@moisespedro: alias make='make -j4'? are you serious?
 
Old 03-07-2014, 10:55 AM   #7
genss
Member
 
Registered: Nov 2013
Posts: 748

Rep: Reputation: Disabled
Quote:
Originally Posted by Richard Cranium View Post
The MAKEFLAGS environmental variable is honored by make:
Code:
export MAKEFLAGS=' -j10'
i never put the space before -j
is that for a good habit ?
 
Old 03-07-2014, 11:09 AM   #8
granth
Member
 
Registered: Jul 2004
Location: USA
Distribution: Slackware64
Posts: 212

Rep: Reputation: 55
Here's a way to determine your CPU count and adjust accordingly.

Code:
CORES=`nproc`
JOBS=`expr $CORES + 1`
export MAKEFLAGS="-j${JOBS}"
I've come across one Slackbuild that doesn't work with this, so I override it in the sqf.

Code:
$ cat avr-libc.sqf
@avr-gcc
avr-libc | MAKEFLAGS='-j1'
 
1 members found this post helpful.
Old 03-07-2014, 11:30 AM   #9
moisespedro
Senior Member
 
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223

Rep: Reputation: 195Reputation: 195
Quote:
Originally Posted by dederon View Post
thats the way to go. this won't break any slackbuild - the slackbuilds which need non parallel build use "make -j1".

@moisespedro: alias make='make -j4'? are you serious?
What?
 
Old 03-07-2014, 07:50 PM   #10
irgunII
Member
 
Registered: Jan 2012
Location: Directly above the center of the earth
Distribution: Slackware. There's something else?
Posts: 383

Original Poster
Rep: Reputation: 72
Quote:
Originally Posted by dederon View Post
thats the way to go. this won't break any slackbuild - the slackbuilds which need non parallel build use "make -j1".
So you mean then that if I forget to use -j1 during a build of foo.SlackBuild, and it's one of those builds that can't use the '-jX', it *won't* break and will automatically us -j1?
 
Old 03-07-2014, 08:20 PM   #11
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,860

Rep: Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230
Quote:
Originally Posted by genss View Post
i never put the space before -j
is that for a good habit ?
It helps when someone puts...
Code:
MAKEFLAGS=-m64${MAKEFLAGS}
...but I should probably put a space after the -j4 too.
 
Old 03-08-2014, 01:40 AM   #12
dederon
Member
 
Registered: Oct 2013
Posts: 110

Rep: Reputation: 56
Quote:
Originally Posted by irgunII View Post
So you mean then that if I forget to use -j1 during a build of foo.SlackBuild, and it's one of those builds that can't use the '-jX', it *won't* break and will automatically us -j1?
slackbuilds are ordenary shell scripts, just look into the code. if the build process requires a sequencial build you will find a "make -j1" line in the slackbuild. this will overwrite MAKEFLAGS. example: webkitgtk.

if not, complain to the maintainer. or even better: provide a git patch.
 
Old 03-08-2014, 07:17 AM   #13
Drakeo
Senior Member
 
Registered: Jan 2008
Location: Urbana IL
Distribution: Slackware, Slacko,
Posts: 3,716
Blog Entries: 3

Rep: Reputation: 483Reputation: 483Reputation: 483Reputation: 483Reputation: 483
if you take a look at Pat's build scripts for Slackware you will see how he does it. looks to me like he been asking it to do -j7 for a long time.

-j2,3,4, etc etc doesn't really mean cores because it means how it stacks up the build instructions to the cores.

many programs that built fast and clean I can do a -j12 on my 8 core . and for years doing a make -j one over the amount of cores you have
has been used for a long time to make sure all cores are at 100 percent through the build.

if you have a 8 core machine and your setting up to run -j4 that will push the stack to 4 at a time.

since I like to play games and do stuff during long and large compiling jobs. I will set mine to -j6 so as to keep resources for other process
with out grinding to a halt.

Last edited by Drakeo; 03-08-2014 at 07:25 AM.
 
Old 03-08-2014, 01:24 PM   #14
irgunII
Member
 
Registered: Jan 2012
Location: Directly above the center of the earth
Distribution: Slackware. There's something else?
Posts: 383

Original Poster
Rep: Reputation: 72
Thanks everyone. Got the answers I needed and all were a great help and very informational.
 
Old 03-09-2014, 04:26 AM   #15
Martinus2u
Member
 
Registered: Apr 2010
Distribution: Slackware
Posts: 497

Rep: Reputation: 119Reputation: 119
Quote:
Originally Posted by granth View Post
Here's a way to determine your CPU count and adjust accordingly.

...
on a side note, with a decent CPU scheduler like BFS it is totally sufficient to say

Code:
CORES=`nproc`
export MAKEFLAGS="-j${CORES}"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
TOP output Cpu(s) and %CPU don't fit on single core AchimRS Linux - General 2 11-03-2011 03:32 PM
why does SCHED_FIFO task on one CPU affects other CPU tasks on a multy core system? reg13 Linux - Kernel 2 07-31-2011 09:48 PM
[SOLVED] SOS: Skim pkg/build for Slackware 13? How do I know if I have scim-lib installed? ShellyCat Slackware 10 07-07-2010 01:34 AM
cpu frequency scaling with Pentium(R) Dual-Core CPU E5200 @ 2.50GHz tramni1980 Slackware 5 08-16-2009 08:29 AM
Intel DG33FB motherboard - cannot run second core on cpu (core 2 duo) rmitev Linux - Enterprise 2 09-28-2007 04:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration