Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
03-07-2014, 09:18 AM
|
#1
|
Member
Registered: Jan 2012
Location: Directly above the center of the earth
Distribution: Slackware. There's something else?
Posts: 383
Rep:
|
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.
|
|
|
03-07-2014, 09:20 AM
|
#2
|
LQ Guru
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,584
|
make -j2
Note that some packages can't build with parallel building.
|
|
2 members found this post helpful.
|
03-07-2014, 09:25 AM
|
#3
|
Senior Member
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223
Rep: 
|
I think you can set the make variable on /etc/profile. Or maybe use a bash alias?
alias make='make -j4' (for example)
|
|
|
03-07-2014, 09:36 AM
|
#4
|
Senior Member
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278
|
Quote:
Originally Posted by ReaperX7
Note that some packages can't build with parallel building.
|
This is the most important thing to remember.
|
|
2 members found this post helpful.
|
03-07-2014, 10:26 AM
|
#5
|
Senior Member
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,860
|
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.
|
03-07-2014, 10:43 AM
|
#6
|
Member
Registered: Oct 2013
Posts: 110
Rep:
|
Quote:
Originally Posted by Richard Cranium
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?
|
|
|
03-07-2014, 10:55 AM
|
#7
|
Member
Registered: Nov 2013
Posts: 748
Rep: 
|
Quote:
Originally Posted by Richard Cranium
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 ?
|
|
|
03-07-2014, 11:09 AM
|
#8
|
Member
Registered: Jul 2004
Location: USA
Distribution: Slackware64
Posts: 212
Rep:
|
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.
|
03-07-2014, 11:30 AM
|
#9
|
Senior Member
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223
Rep: 
|
Quote:
Originally Posted by dederon
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?
|
|
|
03-07-2014, 07:50 PM
|
#10
|
Member
Registered: Jan 2012
Location: Directly above the center of the earth
Distribution: Slackware. There's something else?
Posts: 383
Original Poster
Rep:
|
Quote:
Originally Posted by dederon
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?
|
|
|
03-07-2014, 08:20 PM
|
#11
|
Senior Member
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,860
|
Quote:
Originally Posted by genss
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.
|
|
|
03-08-2014, 01:40 AM
|
#12
|
Member
Registered: Oct 2013
Posts: 110
Rep:
|
Quote:
Originally Posted by irgunII
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.
|
|
|
03-08-2014, 07:17 AM
|
#13
|
Senior Member
Registered: Jan 2008
Location: Urbana IL
Distribution: Slackware, Slacko,
Posts: 3,716
|
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.
|
|
|
03-08-2014, 01:24 PM
|
#14
|
Member
Registered: Jan 2012
Location: Directly above the center of the earth
Distribution: Slackware. There's something else?
Posts: 383
Original Poster
Rep:
|
Thanks everyone. Got the answers I needed and all were a great help and very informational.
|
|
|
03-09-2014, 04:26 AM
|
#15
|
Member
Registered: Apr 2010
Distribution: Slackware
Posts: 497
Rep: 
|
Quote:
Originally Posted by granth
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}"
|
|
|
All times are GMT -5. The time now is 04:36 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|