Re: [exim-dev] make fails with -j4

Góra strony
Delete this message
Reply to this message
Autor: Phil Pennock
Data:  
Dla: Brian Candler, exim-dev
Temat: Re: [exim-dev] make fails with -j4
On 2011-11-10 at 04:28 -0500, Phil Pennock wrote:
> I'm trying to pick this apart, but I suspect that the issue might just
> be incompatibility between parallel Make and multiple makefiles.


A nonsense statement, but it is after 4am so I hope you'll forgive me.

In the build-* directory:

% make lookups/lf_quote.o
gcc lookups/lf_quote.c
% ls -ld lf*
-rw-r--r-- 1 phil human 8048 Nov 10 04:29 lf_quote.o
% make -j4 lookups/lf_quote.o
gcc lf_quote.c
gcc: lf_quote.c: No such file or directory
gcc: No input files specified
*** Error code 1
1 error

So, taking the lookups/lf_* dependencies out of $(OBJS) and putting them
in a new variable, which is referenced in $(OBJS) and also used to
coerce a dependency upon buildlookups fixes it.

The attached patch should be applied with "patch -p2" or, if using git,
you can fetch the parallel_make branch from the master repo.

I'd appreciate feedback. It seems strange that we'd have gotten away
with declaring the lookups to depend upon the non-parent config files,
but with linear build ... perhaps.

Regards,
-Phil
>From c6fa5dfa8280de53bfbfd4921bc8bb5945dd5f19 Mon Sep 17 00:00:00 2001
From: Phil Pennock <pdp@???>
Date: Thu, 10 Nov 2011 04:44:04 -0500
Subject: [PATCH] Parallel build fixes for lookups

Make lookups depend upon PHDRS not HDRS.
Make parent dir depend upon child build target for lookups
---
 src/OS/Makefile-Base     |   11 ++++++-
 src/src/lookups/Makefile |   74 +++++++++++++++++++++++-----------------------
 2 files changed, 47 insertions(+), 38 deletions(-)


diff --git a/src/OS/Makefile-Base b/src/OS/Makefile-Base
index deb0e44..de387e0 100644
--- a/src/OS/Makefile-Base
+++ b/src/OS/Makefile-Base
@@ -303,6 +303,8 @@ OBJ_EXPERIMENTAL = bmi_spam.o spf.o srs.o dcc.o
# Targets for final binaries; the main one has a build number which is
# updated each time. We don't bother with that for the auxiliaries.

+OBJ_LOOKUPS = lookups/lf_quote.o lookups/lf_check_file.o lookups/lf_sqlperform.o
+
 OBJ_EXIM = acl.o child.o crypt16.o daemon.o dbfn.o debug.o deliver.o \
         directory.o dns.o drtables.o enq.o exim.o expand.o filter.o \
         filtertest.o globals.o dkim.o \
@@ -311,7 +313,7 @@ OBJ_EXIM = acl.o child.o crypt16.o daemon.o dbfn.o debug.o deliver.o \
         rda.o readconf.o receive.o retry.o rewrite.o rfc2047.o \
         route.o search.o sieve.o smtp_in.o smtp_out.o spool_in.o spool_out.o \
         store.o string.o tls.o tod.o transport.o tree.o verify.o \
-        lookups/lf_quote.o lookups/lf_check_file.o lookups/lf_sqlperform.o \
+        $(OBJ_LOOKUPS) \
         local_scan.o $(EXIM_PERL) $(OBJ_WITH_CONTENT_SCAN) \
         $(OBJ_WITH_OLD_DEMIME) $(OBJ_EXPERIMENTAL)


@@ -458,6 +460,8 @@ PHDRS = ../config.h ../dbfunctions.h ../dbstuff.h ../exim.h ../functions.h ../gl
 version.h::
     @../scripts/reversion


+cnumber.h: version.h
+
version.o: $(HDRS) cnumber.h version.h version.c

 # This is the dummy module for use by test compiles of individual modules. It
@@ -611,6 +615,11 @@ dcc.o:           $(HDRS) dcc.h dcc.c


 drtables.o:      $(HDRS) drtables.c


+# We depend upon object files built as part of building the lookups library
+# When using parallel make, we don't have the dependency to force building
+# in the sub-directory unless we force that dependency:
+
+$(OBJ_LOOKUPS): buildlookups

 # The exim monitor's private modules - the sources live in a private
 # subdirectory. The final binary combines the private modules with some
diff --git a/src/src/lookups/Makefile b/src/src/lookups/Makefile
index 5a90cf3..035f6f2 100644
--- a/src/src/lookups/Makefile
+++ b/src/src/lookups/Makefile
@@ -24,44 +24,44 @@ lookups.a:       $(OBJ)
 .c.so:;          @echo "$(CC) -shared $*.c"
          $(FE)$(CC) $(LOOKUP_$*_INCLUDE) $(LOOKUP_$*_LIBS) -DDYNLOOKUP $(CFLAGS_DYNAMIC) $(CFLAGS) $(INCLUDE) $(DLFLAGS) $*.c -o $@


-lf_check_file.o: $(HDRS) lf_check_file.c  lf_functions.h
-lf_quote.o:      $(HDRS) lf_quote.c       lf_functions.h
-lf_sqlperform.o: $(HDRS) lf_sqlperform.c  lf_functions.h
+lf_check_file.o: $(PHDRS) lf_check_file.c  lf_functions.h
+lf_quote.o:      $(PHDRS) lf_quote.c       lf_functions.h
+lf_sqlperform.o: $(PHDRS) lf_sqlperform.c  lf_functions.h


-cdb.o:           $(HDRS) cdb.c
-dbmdb.o:         $(HDRS) dbmdb.c
-dnsdb.o:         $(HDRS) dnsdb.c
-dsearch.o:       $(HDRS) dsearch.c
-ibase.o:         $(HDRS) ibase.c
-ldap.o:          $(HDRS) ldap.c
-lsearch.o:       $(HDRS) lsearch.c
-mysql.o:         $(HDRS) mysql.c
-nis.o:           $(HDRS) nis.c
-nisplus.o:       $(HDRS) nisplus.c
-oracle.o:        $(HDRS) oracle.c
-passwd.o:        $(HDRS) passwd.c
-pgsql.o:         $(HDRS) pgsql.c
-spf.o:           $(HDRS) spf.c
-sqlite.o:        $(HDRS) sqlite.c
-testdb.o:        $(HDRS) testdb.c
-whoson.o:        $(HDRS) whoson.c
+cdb.o:           $(PHDRS) cdb.c
+dbmdb.o:         $(PHDRS) dbmdb.c
+dnsdb.o:         $(PHDRS) dnsdb.c
+dsearch.o:       $(PHDRS) dsearch.c
+ibase.o:         $(PHDRS) ibase.c
+ldap.o:          $(PHDRS) ldap.c
+lsearch.o:       $(PHDRS) lsearch.c
+mysql.o:         $(PHDRS) mysql.c
+nis.o:           $(PHDRS) nis.c
+nisplus.o:       $(PHDRS) nisplus.c
+oracle.o:        $(PHDRS) oracle.c
+passwd.o:        $(PHDRS) passwd.c
+pgsql.o:         $(PHDRS) pgsql.c
+spf.o:           $(PHDRS) spf.c
+sqlite.o:        $(PHDRS) sqlite.c
+testdb.o:        $(PHDRS) testdb.c
+whoson.o:        $(PHDRS) whoson.c


-cdb.so:           $(HDRS) cdb.c
-dbmdb.so:         $(HDRS) dbmdb.c
-dnsdb.so:         $(HDRS) dnsdb.c
-dsearch.so:       $(HDRS) dsearch.c
-ibase.so:         $(HDRS) ibase.c
-ldap.so:          $(HDRS) ldap.c
-lsearch.so:       $(HDRS) lsearch.c
-mysql.so:         $(HDRS) mysql.c
-nis.so:           $(HDRS) nis.c
-nisplus.so:       $(HDRS) nisplus.c
-oracle.so:        $(HDRS) oracle.c
-passwd.so:        $(HDRS) passwd.c
-pgsql.so:         $(HDRS) pgsql.c
-spf.so:           $(HDRS) spf.c
-sqlite.so:        $(HDRS) sqlite.c
-testdb.so:        $(HDRS) testdb.c
-whoson.so:        $(HDRS) whoson.c
+cdb.so:           $(PHDRS) cdb.c
+dbmdb.so:         $(PHDRS) dbmdb.c
+dnsdb.so:         $(PHDRS) dnsdb.c
+dsearch.so:       $(PHDRS) dsearch.c
+ibase.so:         $(PHDRS) ibase.c
+ldap.so:          $(PHDRS) ldap.c
+lsearch.so:       $(PHDRS) lsearch.c
+mysql.so:         $(PHDRS) mysql.c
+nis.so:           $(PHDRS) nis.c
+nisplus.so:       $(PHDRS) nisplus.c
+oracle.so:        $(PHDRS) oracle.c
+passwd.so:        $(PHDRS) passwd.c
+pgsql.so:         $(PHDRS) pgsql.c
+spf.so:           $(PHDRS) spf.c
+sqlite.so:        $(PHDRS) sqlite.c
+testdb.so:        $(PHDRS) testdb.c
+whoson.so:        $(PHDRS) whoson.c


# End
--
1.7.7