[CMake] Building CMake in parallel problem

Marcel Loose loose at astron.nl
Fri Apr 9 04:08:03 EDT 2010


Hi Michael,

This is a well-known problem with parallel make. When using -j<N> you
should NEVER specify multiple targets, because each target could be
built independently in a separate make process even if they have
dependencies. Here, you're using the implicit target 'all' and the
target 'install'. The "proper" way to write this in a one-liner would
be:

make -j2 && make -j2 install

You might consider to set MAKEFLAGS=-j2.

HTH,
Marcel Loose.

On Fri, 2010-04-09 at 07:50 +0200, Michael Wild wrote:
> Hi all
> 
> While creating a formula for Homebrew on Mac OS X 10.6.2 I happened
across a problem when I tried to build CMake 2.8.1 in parallel (-j2) and
directly invoked the "install" target where libcmsys.a and libCMakeLib.a
get built twice. I.e. I did the following:
> 
> $ <path/to/source>/bootstrap --prefix=<prefix> --system-libs
--datadir=/share/cmake \
>   --docdir=/share/doc/cmake --mandir=/share/man
> 
> $ make -j2 install
> 
> 
> Looking through the log, I found that both libcmsys.a and
libCMakeLib.a get built twice, where sometimes the second thread
interferes with the first, especially during the linking stage. If I
split the build and install steps, i.e
> 
> $ make -j2
> $ make install
> 
> I don't observe this weirdness. Is this a bug in the generated
Makefiles or in Make?
> 
> Michael
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake




More information about the CMake mailing list