Using all cores during compile

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
jwong
Level 2
Level 2
Posts: 27
Joined: Thu Feb 17, 2011 4:58 pm

Using all cores during compile

Post by jwong »

Is there anyway to use all 4 cores on my quad core during compilation? It appears I am only using 1 core. I am hoping there is a flag I can pass to the makefile.

Alternatively, I could probably break the makefile in four different makefiles for compiling and a separate makefile for linking. From there I could execute the compile makefiles seperately and finally the link makefile when the others are done.

Has anyone tried this? I'd really like to speed up compilations, especially when doing regression testing.
ryan woodsmall

Using all cores during compile

Post by ryan woodsmall »

Is there anyway to use all 4 cores on my quad core during compilation? It appears I am only using 1 core. I am hoping there is a flag I can pass to the makefile.
Look at the "-j" option to the make command. It takes a numeric argument that signifies how many simultaneous jobs should be running.

ccache is another useful project that can considerably speed up compilation by caching previous compiler output:

http://ccache.samba.org/
User avatar
André H.
Moderator
Moderator
Posts: 202
Joined: Sun Dec 07, 2008 8:33 am

Post by André H. »

beside ccache there is also distcc, but on a quadcore a "make -j4" is all you need
Frédéric Delanoy

Using all cores during compile

Post by Frédéric Delanoy »

On Thu, Oct 13, 2011 at 21:26, jwong <[email protected]> wrote:
Is there anyway to use all 4 cores on my quad core during compilation? It appears I am only using 1 core. I am hoping there is a flag I can pass to the makefile.

Alternatively, I could probably break the makefile in four different makefiles for compiling and a separate makefile for linking. From there I could execute the compile makefiles seperately and finally the link makefile when the others are done.

Has anyone tried this? I'd really like to speed up compilations, especially when doing regression testing.
You can also pass --disable-tests to ./configure
Also "-O0" in CFLAGS can help
User avatar
blaiseg07
Level 2
Level 2
Posts: 31
Joined: Mon Sep 26, 2011 4:08 pm

Re: Using all cores during compile

Post by blaiseg07 »

jwong wrote: Has anyone tried this? I'd really like to speed up compilations, especially when doing regression testing.
make -j5(one more than you physically have) and --disable-tests in the configure.

handy dandy bash script I use...adjust to your needs.

Code: Select all

#! /bin/sh

CC="gcc-4.6 -m32" LDFLAGS="-L/lib32 -L/usr/lib32 -Wl,-rpath,/lib32 -Wl,-rpath,/usr/lib32" ./configure -v --prefix=/usr --without-capi --without-cups --without-jack --without-sane --with-x --without-openal --disable-tests --without-nas --without-v4l --without-gphoto --with-opencl
make depend && make -j4
echo {your password} | sudo -S make install
Frédéric Delanoy

Using all cores during compile

Post by Frédéric Delanoy »

On Fri, Oct 14, 2011 at 04:39, blaiseg07 <[email protected]> wrote:
jwong wrote:
Has anyone tried this? I'd really like to speed up compilations, especially when doing regression testing.
make -j5(one more than you physically have) and --disable-tests in the configure.

handy dandy bash script I use...adjust to your needs.

Code:
#! /bin/sh

CC="gcc-4.6 -m32" LDFLAGS="-L/lib32 -L/usr/lib32 -Wl,-rpath,/lib32 -Wl,-rpath,/usr/lib32" ./configure -v --prefix=/usr --without-capi --without-cups --without-jack --without-sane --with-x --without-openal --disable-tests --without-nas --without-v4l --without-gphoto --with-opencl
make depend && make -j4
echo {your password} | sudo -S make install
Using ccache gcc instead of gcc would help even more
jwong
Level 2
Level 2
Posts: 27
Joined: Thu Feb 17, 2011 4:58 pm

Post by jwong »

Thanks everyone. Using the -j flag has dropped compiles significantly.
Locked