[GRASS-dev] [grass-code I][359] GRASS fails to build with make -j3

Glynn Clements glynn at gclements.plus.com
Thu Apr 5 09:05:53 EDT 2007


grass-codei at wald.intevation.org wrote:

> code I item #359, was opened at 2007-04-05 12:01
> Status: Open
> Priority: 4
> Submitted By: Maciej Sieczka (msieczka)
> Assigned to: Nobody (None)
> Summary: GRASS fails to build with make -j3 
> Issue type: other bug
> Issue status: None
> GRASS version: CVS HEAD
> GRASS component: build
> Operating system: all
> Operating system version: 
> GRASS CVS checkout date, if applies (YYMMDD): 050407
> 
> 
> Initial Comment:
> On multi cpu machines it is possible to speed up compilation time
> greatly using the -j switch with make (eg. -j3 for 2 cpus).
> 
> make -j3 works fine on my dual core Intel with all the software I'm
> building from source (including eg. PROJ, GEOS, HDF4, POSTGIS, GDAL,
> QT4).
> 
> But when I build GRASS with make -j3, plenty of errors crop out
> after "Waiting for unfinished jobs...." information. In a result, no
> single GRASS module is build properly. However, GRASS builds fine on
> the same machine if -j3 is not used.
> 
> configure and make logs attached.

The first thing I notice is that the first error is usually a missing
header file, e.g.:

copy.c:7:28: error: grass/datetime.h: No such file or directory

adj_cellhd.c:14:23: error: grass/gis.h: No such file or directory

This is due to the "headers" target in the "libs" directory being run
in parallel with other jobs.


This specific issue can probably be solved by changing lib/Makefile
from:

	default: headers subdirs
to:

	default: subdirs

	subdirs: headers

This should prevent the subdirs target from being run before the
headers target has completed.

However: I'm not sure whether parallel make will actually be useful
with the existing Makefiles, due to the use of a shell "for" loop for
building subdirectories:

	subdirs:
		@list='$(SUBDIRS)'; \
		for subdir in $$list; do \
		    echo $$subdir ; \
		    $(MAKE) -C $$subdir || echo $(CURDIR)/$$subdir >> $(GRASS_HOME)/error.log; \
		done

[From include/Make/Dir.make]

To have the subdirectories built in parallel, you would need to use
something like:

	.PHONY: subdirs $(SUBDIRS)

	subdirs: $(SUBDIRS)

	$(SUBDIRS):
		$(MAKE) -C $@

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list