[postgis-devel] on parallel and recursive make

Sandro Santilli strk at kbt.io
Wed Nov 4 02:50:57 PST 2020


On Wed, Nov 04, 2020 at 10:13:48AM +0100, rmrodriguez at carto.com wrote:
> This is breaking building other sublibs, which worked before.
> 
> $ pwd
> /home/raul/dev/public/postgis/postgis
> $ make -j11
> make: *** No rule to make target '../liblwgeom/.libs/liblwgeom.a',
> needed by 'postgis_module.o'.  Stop.

Is that the postgis/ subdir ?
I expected this behaviour, yes.
The thing is that encoding deps in subdirs means that parallel
builds from top-level dir may end up building the same dependency
twice (think liblwgeom), which results in instabilities.

The change ensures the caller calls `make` from the top-level dir.

> It also makes building everything in parallel unstable:
> 
> $ ./autogen.sh && ./configure CC=clang CXX=clang++ CFLAGS="$CFLAGS"
> CXXFLAGS="$CXXFLAGS" CPPFLAGS="$C
> PPFLAGS" LDFLAGS="$LDFLAGS" && make -j11 check
> [...]
> PostGIS was built successfully. Ready to install.
> $ echo $?
> 2

You did run 'check' here, which still has the dependencies
encoded (due to staged-install). It works if you only run
the "all" rule in parallel.

> Note that tests weren't executed and it failed, although the last
> message is saying everything was built successfully.

The fact that you get the "success" message last is a consequence
of parallel build... ONE of the (multiple) thread attempting
to build the application succeeded, but others failed.

I guess a possible fix to make parallel-check work would be
making "all" a dependency of "check", can you see if that helps
on your side ?

--strk;


More information about the postgis-devel mailing list