Ubuntu – Dh_auto_configure with buildsystem=cmake failing

cmakecompilingpackagingpbuilder-distppa

I am trying to publish my cmake built project to my launchpad ppa. While I am doing fake build below is the error being thrown.

gowtham@ubuntu:~/Packages/build-area$ pbuilder-dist xenial build base_1.1-0ubuntu1.dsc
...
...
dh_auto_configure -O--buildsystem=cmake
    mkdir -p obj-x86_64-linux-gnu
    cd obj-x86_64-linux-gnu
    cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var
dh_auto_configure: cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var failed to to execute: No such file or directory
        cd /build/base-1.1
debian/rules:11: recipe for target 'build' failed
make: *** [build] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2
...
...

The error message doesn't say what file is missing. my project doesn't have a configure file to do ./configure.

my debian/rules file

#!/usr/bin/make -f
# -*- makefile -*-

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

override_dh_auto_test:
override_dh_usrlocal:

%:
    dh $@ --buildsystem=cmake

I was able to successfully publish my library with my hand written Makefile. But I am having troubles when I opted cmake. Unfortunately I didn't find any beginner friendly guide for packaging a cmake built project.

my normal build procedure:

cd ~/Packages/base
mkdir build
cd build
cmake ..
make
sudo make install

Instructions I am following to package and publish to my ppa

cd ~/Packages/base
bzr dh-make base 1.1 base-1.1.tar.gz
cd base/debian/
rm *ex *EX
bzr commit -m "Initial commit of Debian packaging."
bzr builddeb -- -us -uc -sd
bzr builddeb -S -- -sd
bzr tag release-1.1
cd ../../build-area
pbuilder-dist xenial build base_1.1-0ubuntu1.dsc
cd ../base 
bzr push lp:~satyagowtham-k-gmail/+junk/base-package
cd ../build-area
dput ppa:satyagowtham-k-gmail/ferryfair.ppa base_1.1-0ubuntu1_source.changes

Best Answer

  • Couldn't expect the issue so I downloaded your code to try it directly:

    bzr branch lp:~satyagowtham-k-gmail/+junk/base-package
    

    I would thank you too for sharing those notes about packaging cmake projects. I'm sure many need it.

  • This error:

    dh_auto_configure: cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var failed to to execute: No such file or directory

    can mean that the command (cmake) could be missing not just target file ../ . I was expecting Command not found message but I was wrong as the command here actually was dh_auto_configure.

  • So cmake was missing in Build-Depends: (debian/control file). Add it then try again, it should build just fine.