Ubuntu – debuild failed at dh_install with cp: cannot stat `debian/tmp//path/to/install/bin/’: No such file or directory

12.04debianpackaging

I am creating a binary package for local usage by reading http://chat.stackexchange.com/transcript/message/1313226#1313226 chat session. I followed the steps mentioned in the list.

My environment:
ubuntu 12.04
Project: MakeFile based C++ project which contains several sub directories and creating several shared libraries.

Below are the steps followed.

  1. create a gpg key using gpg –gen-key
  2. create necessary directories for packaging (folder for package with name-version, debian sub folder) and run dh_make --createorig in console. This step generated required files for packaging inside debian folder
  3. edit necessary files in ./debian folder

list of files in ./debian folder

source //folder
compat
rules
copyright
changelog
control
install

Below are the contents of important files.

$ cat control

Source: cscore
Section: misc
Priority: extra
Maintainer: dwft78 <aaaa@bbbb.com>
Build-Depends: debhelper (>= 8.0.0), autotools-dev
Standards-Version: 3.9.2
Homepage: <insert the upstream URL, if relevant>

Package: cscore
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: CoreScanner
CoreScanner for Ubuntu-12.04

$ cat install

/opt/installation-dir/bin/

this is where the binary files should be installed.

cat changelog

cscore (1.0-1) precise; urgency=low

  * Initial release (Closes: #nnnn)  <nnnn is the bug number of your ITP>

 -- name <name@xxx.com>  Wed, 28 May 2014 14:16:29 +0530

$ cat rules

#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
    dh $@ 

finally I run debuild command but I got bellow error.

find /home/dwft78/project/cscore/cscore-1.0/lib -name "libcs*" -type f -exec cp -f {} /home/dwft78/project/cscore/cscore-1.0/debian/cscore/opt/motorola-scanner//bin \;
find /home/dwft78/project/cscore/cscore-1.0/lib -name "libcs*" -type l -exec cp -Rf {} /home/dwft78/project/cscore/cscore-1.0/debian/cscore/opt/motorola-scanner//bin \;
make[1]: Leaving directory `/home/dwft78/project/cscore/cscore-1.0'
   dh_install
cp: cannot stat `debian/tmp//opt/motorola-scanner/bin/': No such file or directory
dh_install: cp -a debian/tmp//opt/motorola-scanner/bin/ debian/cscore///opt/motorola-scanner/ returned exit code 1
make: *** [binary] Error 2
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2

actually there is no folder created called tmp inside debian folder.
debhelper noted the status of debuild command execution it has continued till dh_install level. output files also created excepting above set of files.

$ cat cscore.debhelper.log

dh_auto_configure
dh_auto_build
dh_auto_test
dh_prep
dh_installdirs
dh_auto_install

Please somebody help to go forward.
-Thanks.

Best Answer

As the man page for dh_install says, the purpose of dh_install and the files that it reads are typically used for one of two purposes:

  • Specify which files go into multiple binary packages from a single source; or
  • Install files not handled by the package build system or move files to different directories

If you have a build system that can already build and install all the files needed for the binary package in the right directories, and you are only building one binary package from your source, then you don't need a debian/install file at all.

You mentioned that you are working with a Makefile-based project. As long as it supports standard targets like make all and make install and respects the $DESTDIR variable for installing, there's no need for a debian/install at all.

In fact, in the output you posted you can see a couple lines starting with find executing immediately before dh_install. I assume that is your project's make install target executing, and it looks to me like it is already installing files in the correct path, namely debian/cscore/opt/motorola-scanner/bin. So I think your build might work without a debian/install.

Related Question