The past few days I have been trying, without success, to create a deb package for a programme with a Qt interface. The previous steps I have done so far:

  1. Created a gpg key and registered it at Launchpad;
  2. Identified myself with the DEBEMAIL and DEBFULLNAME variables in ~/.bashrc;
  3. Checked out the source code from GitHub;
  4. Successfully built the programme (it uses qmake to generate a Makefile), identifying all its dependencies;
  5. Created a source folder including the Makefile, plus a .desktop file and an .xpm icon.
  6. Created a tarball from this folder named packagename-version.tar.gz.

With this preparatory work I have tried to follow two different guides:

  • The official Ubuntu packaging guide - it concludes successfully, but the final .deb file only includes the doc folder.

  • A more detailed guide from xpressrazor - which fails when running debuild, with the following cryptic messages:

    make: *** [build] Error 2 dpkg-buildpackage: error: debian/rules build gave error exit status 2 debuild: fatal error at line 1364: dpkg-buildpackage -rfakeroot -D -us -uc failed

These and other guides out there invariably present simple examples where the programme to package is composed by a single source file (sometimes it is only a bash script). I suspect they are too simplistic for a proper programme with an elaborate GUI. In this case, what are the precise steps from dh_make onwards?

Update I: I posted to PasteBin an anonymised version of the full debuild output.

Update II: The debuild output, now with DH_VERBOSE=1.

  • 1
    Could you post the full log? it seems there are some details about the errors up in the log. The portion you mention is just a resume.
    – user.dz
    Jan 15, 2016 at 10:45
  • Could you try again with export DH_VERBOSE=1 uncommented or add it if is not in the debian/rules files. The build fails at dh_auto_configure step. exactly trying to run qmake -makefile -nocache ... . You may also try running that command directly to see if it will raise some errors.
    – user.dz
    Jan 15, 2016 at 15:13
  • Apparently, qmake is simply printing the help page and quitting without executing (I get the same in the command line). If there is a Makefile present already, why is qmake being run again? Jan 15, 2016 at 16:11
  • 1
    There is an obvious reason why qmake is failing: no .pro file is given in that long command. Jan 15, 2016 at 16:17
  • Qt is already using CMake, would you try with dh and CMake instead of cdbs?
    – Viet
    Jun 25, 2017 at 18:39

1 Answer 1


As it happens, dh can not possibly be used to package a Qt programme in the traditional way presented in most guides and tutorials out there. More specifically, the rules file must be informed of which snippets it must use to include in the final Makefile.

One way of achieving this is using the cdbs package:

sudo apt-get install cdbs

Then the rules file must be edited to include the snippets from this package:

#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/qmake.mk

These should be the only contents in the rules file, any direct references to dh must be removed or commented out.

At this time, debuild should be operational, it can be run like:

debuild -S

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .