I am trying to debian package my C++ application developed with aid of Netbeans 7.3. Here is bit of Makefile of it.

    install config.xml /etc/${APPNAME}.conf.xml
    install devices.rules /etc/udev/rules.d/${APPNAME}.rules
    install error.log /var/log/${APPNAME}.log
    install init.conf /etc/init/${APPNAME}.conf
    install init.d /etc/init.d/${APPNAME}
    install ${CND_ARTIFACT_NAME_${CONF}} /usr/local/bin/${APPNAME}
    chmod u+x ${CND_ARTIFACT_NAME_${CONF}}

I am following HOW TO CREATE A .DEB PACKAGE and Debian New Maintainer's Guide. When I run dpkg-buildpackage -rfakeroot after successfully completing all the above steps I encountered following error

$ dpkg-buildpackage -rfakeroot
dpkg-buildpackage: source package remotedevicecontroller
dpkg-buildpackage: source version 1.0-1
dpkg-buildpackage: source changed by satya gowtham kudupudi (gowtham) <gowthamk@newmeksolutions.com>
dpkg-buildpackage: host architecture i386
 dpkg-source --before-build remotedevicecontroller-1.0
 fakeroot debian/rules clean
dh clean
dh: No packages to build.
 dpkg-source -b remotedevicecontroller-1.0
dpkg-source: info: using source format `3.0 (quilt)'
dpkg-source: info: building remotedevicecontroller using existing ./remotedevicecontroller_1.0.orig.tar.gz
dpkg-source: info: building remotedevicecontroller in remotedevicecontroller_1.0-1.debian.tar.gz
dpkg-source: info: building remotedevicecontroller in remotedevicecontroller_1.0-1.dsc
 debian/rules build
dh build
dh: No packages to build.
 fakeroot debian/rules binary
dh binary
dh: No packages to build.
 signfile remotedevicecontroller_1.0-1.dsc

You need a passphrase to unlock the secret key for
user: "satya gowtham kudupudi (gowtham) <gowthamk@newmeksolutions.com>"
2048-bit RSA key, ID 9A2853A0, created 2013-08-22

gpg: gpg-agent is not available in this session

 dpkg-genchanges  >../remotedevicecontroller_1.0-1_i386.changes
dpkg-genchanges: error: cannot read files list file: No such file or directory
dpkg-buildpackage: error: dpkg-genchanges gave error exit status 2

at http://www.debian.org/doc/manuals/maint-guide/dreq.en.html#defaultrules there is no explaination for what the role of rules file is. What does

    dh $@

mean? Why does dpkg-buildpackage -rfakeroot say dh: No packages to build.?


The rules file is what does all the work for actually creating the package. It is a Makefile with targets to compile and install the application, then create the .deb file from the installed files. It also has a target to clean up all the build files so you end up with just a source package again. As the Debian Policy Manual puts it:

This file must be an executable makefile, and contains the package-specific recipes for compiling the package and building binary package(s) from the source.

That's nice and all, but what is actually going on here:

    dh $@

dh is a helper command that calls other Make targets and runs a series of debhelper commands. As its manpage Manpage icon describes it:

   dh runs a sequence of debhelper commands. The supported sequences
   correspond to the targets of a debian/rules file: build-arch, build-
   indep, build, clean, install-indep, install-arch, install, binary-arch,
   binary-indep, and binary.

Again, it's just a helper file to simplify things. You don't actually need to use it, but it makes your life much easier. To see what commands are actually run in each target, run:

dh binary-arch --no-act

Now to your specific problem... I don't think it has anything to do with your rules file. Without seeing the actual source package, it is hard to say with certainty what the issue is. Though I'd hazard to guess that there is no binary package stanza in your debian/control file. In the following snippet, the first 'stanza' describes the source package while the second describes the binary package it will build:

Source: hello
Section: devel
Priority: optional
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
XSBC-Original-Maintainer: Jane Doe <packager@example.com>
Standards-Version: 3.9.1
Build-Depends: debhelper (>= 7)
Homepage: http://www.gnu.org/software/hello/

Package: hello
Architecture: any
Depends: ${shlibs:Depends}
Description: The classic greeting, and a good example
 The GNU hello program produces a familiar, friendly greeting. It
 allows non-programmers to use a classic computer science tool which
 would otherwise be unavailable to them. Seriously, though: this is
 an example of how to do a Debian package. It is the Debian version of
 the GNU Project's `hello world' program (which is itself an example
 for the GNU Project).
  • $ dh binary-arch --no-act says dh: No packages to build.
    – Necktwi
    Aug 25 '13 at 4:06
  • @neckTwi Is the packaging a vcs somewhere? Aug 26 '13 at 20:34
  • sry i made a mistake. I didn't remove orig tarball created in previous trial. But I crashed into other problem posted here
    – Necktwi
    Sep 3 '13 at 8:55

The very important mistake I made in the Makefile is not using $(DESTDIR). I am posting it to help those who struggle to build debian package with this common mistake. So the correct Makefile should be:

    install config.xml ${DESTDIR}/etc/${APPNAME}.conf.xml
    install devices.rules ${DESTDIR}/etc/udev/rules.d/${APPNAME}.rules
    install error.log ${DESTDIR}/var/log/${APPNAME}.log
    install init.conf ${DESTDIR}/etc/init/${APPNAME}.conf
    install init.d ${DESTDIR}/etc/init.d/${APPNAME}
    install ${CND_ARTIFACT_NAME_${CONF}} ${DESTDIR}/usr/local/bin/${APPNAME}
    chmod u+x ${CND_ARTIFACT_NAME_${CONF}}

If some make targets fail overriding the corresponding dh_make target in rules file might help in successful packaging.

    dh clean
    dh binary

the test target in my application is giving error and it is not important, so I've overridden dh_auto_test.

And remember to cleanup all the trace files left by your failed trials before a new try.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.