Control: severity -1 normal
Control: tags -1 - ftbfs

On Tue, May 26, 2020 at 11:58:19AM +0900, Benjamin Poirier wrote:
> Source: crash
> Severity: serious
> Tags: upstream patch ftbfs
> Justification: fails to build from source (but built successfully in the past)
> 
> Dear Maintainer,
> 
> The crash package sometimes fails to build when dpkg-buildpackage is
> invoked with -j > 1:
> 
>       # dpkg-buildpackage -us -uc -j4
>...

You are not the first person to fall into this trap.

       -j, --jobs[=jobs|auto]
              Number  of jobs allowed to be run simultaneously, number
              of jobs matching the number of online processors if auto
              is  specified  (since dpkg 1.17.10), or unlimited number
              if jobs is not  specified,  equivalent  to  the  make(1)
              option  of the same name (since dpkg 1.14.7, long option
              since dpkg 1.18.8).  Will add itself  to  the  MAKEFLAGS
              environment  variable, which should cause all subsequent
              make invocations to inherit the option, thus forcing the
              parallel  setting  on  the  packaging  (and possibly the
              upstream build system if that uses make)  regardless  of
              their  support  for  parallel  builds, which might cause
              build failures.

-J is the correct dpkg-buildpackage option.


> This is because crash's configure rewrites Makefile via a temporary file
> (Makefile.new) and it is now getting invoked multiple times in parallel.
> This is a problem upstream.

Correct.

> It can be avoided with the following change:
> --- a/debian/rules
> +++ b/debian/rules
> @@ -12,8 +12,7 @@ include /usr/share/dpkg/buildflags.mk
>       dh $@
>  
>  override_dh_auto_build:
> -     dh_auto_build
> -     $(MAKE) extensions lzo snappy
> +     dh_auto_build -- all extensions lzo snappy
>...

This would fix only the "dpkg-buildpackage -j1" case,
"dh $@ --parallel" would still fail due to
  make -j4 all extensions lzo snappy


The correct workaround to enable parallel building is:

%:
        dh $@ --parallel

override_dh_auto_build:
        $(MAKE)
        $(MAKE) extensions
        $(MAKE) lzo
        $(MAKE) snappy


cu
Adrian

Reply via email to