tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[ANALYSED] MKUPDATE=yes build.sh release failures with multiple jobs in parallel



On Mon, May 17, 2010 at 05:15:12PM +0200, Nicolas Joly wrote:
> 
> Hi,
> 
> Since quite some time now, i'm seeing MKUPDATE=yes build failures when
> multiples jops are run in parallel with -j option. On my -current
> amd64 machine, with 2 CPUs, i never see a successful release build for
> `./build -u -j 4' command.
> 
> In the mean time, there seems to be no problem for MKUPDATE=no builds.

Looking closer into this show that this is a problem with MKDEBUG
parallel builds.

> Not sure where it comes from, but it looks like library installation
> triggers a rebuild of the same library in parallel.

The problem arise when building .debug objects (both for programs and
libraries).

${_LIB.debug}: ${_LIB.so}
        ${_MKTARGET_CREATE}
        ${OBJCOPY} --only-keep-debug ${_LIB.so} ${_LIB.debug}
        ${OBJCOPY} --strip-debug \
            -R .gnu_debuglink --add-gnu-debuglink=${_LIB.debug}
            ${_LIB.so} \
            || rm -f ${_LIB.debug}

The commands sequence does not ensure that, at the end, the
XX.so.debug object will have a newer date than the XX.so file. Then,
the .debug installation rule, when verifying dependancies will
triggers a full rebuild (XX.so.debug + XX.so).

Not sure if there is a better way to handle it, but a simple extra
command `touch xx.debug' at the end make the problem goes away ...

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.
Index: share/mk/bsd.lib.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.lib.mk,v
retrieving revision 1.307
diff -u -p -r1.307 bsd.lib.mk
--- share/mk/bsd.lib.mk 27 Apr 2010 14:32:14 -0000      1.307
+++ share/mk/bsd.lib.mk 21 May 2010 17:44:59 -0000
@@ -599,6 +599,7 @@ ${_LIB.debug}: ${_LIB.so}
        ${OBJCOPY} --strip-debug \
            -R .gnu_debuglink --add-gnu-debuglink=${_LIB.debug} ${_LIB.so} \
            || rm -f ${_LIB.debug}
+       touch ${_LIB.debug}
 .endif
 
 .if !empty(LOBJS)                                                      # {
Index: share/mk/bsd.prog.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.prog.mk,v
retrieving revision 1.248
diff -u -p -r1.248 bsd.prog.mk
--- share/mk/bsd.prog.mk        24 Apr 2010 07:57:04 -0000      1.248
+++ share/mk/bsd.prog.mk        21 May 2010 17:44:59 -0000
@@ -324,8 +324,10 @@ ${_P}.ro: ${OBJS.${_P}} ${DPADD}
 ${_PROGDEBUG.${_P}}: ${_P}
        ${_MKTARGET_CREATE}
        ${OBJCOPY} --only-keep-debug ${_P} ${_PROGDEBUG.${_P}}
-       ${OBJCOPY} --strip-debug -R .gnu_debuglink 
--add-gnu-debuglink=${_PROGDEBUG.${_P}} ${_P} \
+       ${OBJCOPY} --strip-debug \
+           -R .gnu_debuglink --add-gnu-debuglink=${_PROGDEBUG.${_P}} ${_P} \
            || rm -f ${_PROGDEBUG.${_P}}
+       touch ${_PROGDEBUG.${_P}}
 .endif
 
 .endif # defined(OBJS.${_P}) && !empty(OBJS.${_P})                     # }


Home | Main Index | Thread Index | Old Index