`bzr builddeb -- -us -uc` fails

[PS: What I really want to achieave here is learn how to package new software]

I was following the instruction in https://packaging.ubuntu.com/html/packaging-new-software.html#building-the-package.

When I executed bzr builddeb -- -us -uc, these errors show:

❯ bzr builddeb -- -us -uc
Building using working tree
Building package in normal mode
Purging the build dir: /home/xxx/test/build-area/hello-2.10
Looking for a way to retrieve the upstream tarball
Upstream tarball already exists in build directory, using that
Building the package in /home/song/test/build-area/hello-2.10, using debuild -us -uc
 dpkg-buildpackage -rfakeroot -us -uc -ui
dpkg-buildpackage: info: source package hello
dpkg-buildpackage: info: source version 2.10-1
dpkg-buildpackage: info: source distribution unstable
dpkg-buildpackage: info: source changed by xxx <[email protected]>
 dpkg-source --before-build hello-2.10
dpkg-buildpackage: info: host architecture amd64
 fakeroot debian/rules clean
dh clean
   dh_auto_clean
    make -j16 -O distclean
make[1]: Entering directory '/home/xxx/test/build-area/hello-2.10'
There seems to be no Makefile in this directory.
You must run ./configure before running 'make'.
GNUmakefile:106: recipe for target 'abort-due-to-no-makefile' failed
make[1]: *** [abort-due-to-no-makefile] Error 1
make[1]: Leaving directory '/home/xxx/test/build-area/hello-2.10'
dh_auto_clean: make -j16 -O distclean returned exit code 2
debian/rules:18: recipe for target 'clean' failed
make: *** [clean] Error 25
dpkg-buildpackage: error: fakeroot debian/rules clean subprocess returned exit status 2
debuild: fatal error at line 1152:
dpkg-buildpackage -rfakeroot -us -uc -ui failed
bzr: ERROR: The build failed.

Then take a look into the build directory:

❯ ls
ABOUT-NLS  aclocal.m4  AUTHORS  build-aux  ChangeLog  ChangeLog.O  config.in  configure  configure.ac  contrib  COPYING  debian  doc  GNUmakefile  hello.1  INSTALL  lib  m4  maint.mk  Makefile.am  Makefile.in  man  NEWS  po  README  README-dev  README-release  src  tests  THANKS  TODO

Anyone can take a look and give some suggestions?


Solution 1:

There is a workaround by Benjamin Allot in the Launchpad bug @steeldriver posted in the comments.

The issue is that dh_auto_clean calls for a "make -j4 distclean" but the Makefile is not generated by "configure" yet.

A workaround is to add

override_dh_auto_clean:

in your debian/rules file.