[CMake] Parallel jobs failed for cmake

Attila Krasznahorkay attila.krasznahorkay at gmail.com
Mon Dec 14 03:17:15 EST 2015


Hi Igor,

At this point it's really not a CMake question, but a GNU Make one... The answer is actually right there in the first warning that you got.

make[4]: warning: jobserver unavailable: using -j1.  Add `+' to parent make rule.

I have to admit that I'm not absolutely sure about all the subtleties of this, but I defined my own build rules in the past that call make themselves, like:

core::
        +(cd core; make)

With this, GNU Make is able to distribute the jobs between the subdirectories. (I have a number of such targets in my main Makefile.)

Cheers,
              Attila

> On 14 Dec 2015, at 07:34, Igor Sobinov <sluge at mail.ru> wrote:
> 
> Hello Bill,
> 
> Thanks, that's clear.
> 
> So, If I write in makefile
> 
> 
> build_release: $(RELEASE_DIR)
>     @cd $(RELEASE_DIR); $(MAKE) release
> 
> I got an error
> 
> Also if I write
> 
> build_release: $(RELEASE_DIR)
>     $(MAKE) release -C  $(RELEASE_DIR)
> 
> I got an error too
> 
> But this is successfull command:
> # cd $RELEASE_DIR; make release -j10
> 
> Why make doesn't support jobs for subdirs?
> 
> 
> Пятница, 11 декабря 2015, 14:14 -05:00 от Bill Hoffman <bill.hoffman at kitware.com>:
> 
> On 12/11/2015 7:24 AM, Igor Sobinov wrote:
> > Hello Bill,
> >
> > yes, make release is a custom command but that's not important.
> > I do the following:
> > # cd /home/igor/build_root/release_target
> > # make release -j5
> Yes, it is important, it is the reason it is not working. The custom 
> command needs to use $(MAKE) and not make to call make or you will get 
> this error. Child make calls need environment variables to get parallel 
> builds to work. The MAKE env var is used to pass them around.
> 
> -Bill
> 
> 
> 
> Bye, Igor
> 
> -- 
> 
> Powered by www.kitware.com
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
> 
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake



More information about the CMake mailing list