[Pkg-cmake-team] Bug#847307: cmake: missing runtime dependency on "file" tool

Gianfranco Costamagna locutusofborg at debian.org
Wed Dec 7 08:03:23 UTC 2016


Source: cmake
Version: 3.7.1-1
Severity: important
Justification: silently breaks cpack usage and dependency calculation on minimal installations

Tags: patch

Hi Cmake developers and packagers!
I got a bug report on Ubuntu launchpad tracker, but this seems to be a specific packaging
issue, so I would like to discuss/fix it in Debian :)

https://bugs.launchpad.net/ubuntu/+source/cmake/+bug/1647868

Basically, the "make package" from cpack fails to calculate dependencies if "file" is not installed, quoting
the (possible involved code) on CPackDeb.cmake


# get file info so that we can determine if file is executable or not
unset(CPACK_DEB_INSTALL_FILES)
foreach(FILE_ IN LISTS FILE_PATHS_)
execute_process(COMMAND file "./${FILE_}"
WORKING_DIRECTORY "${WDIR}"
OUTPUT_VARIABLE INSTALL_FILE_)
list(APPEND CPACK_DEB_INSTALL_FILES "${INSTALL_FILE_}")
endforeach()


below the original bug report:


Target to milestone
Also affects project (?) Also affects distribution/package Nominate for series
Edit
Bug Description

I use CPack to build a debian package

I use CPACK_DEBIAN_PACKAGE_SHLIBDEPS to let dpkg-shlibdeps figure out shared library dependencies

this only works when the package "file" is installed and fails silently otherwise

"file" is not a package dependency of the cmake package

this bug report is about the packaging dependency, not that cpack silently fails, which should be fixed upstream

How to reproduce

Source File: main.cxx

#include <iostream>
int main(int,char**) {
std::cout << "Hello\n";
return 0;
}

CMakeList.txt:
cmake_minimum_required(VERSION 2.6)

PROJECT(Hello)

ADD_EXECUTABLE(hello main.cxx)
INSTALL(TARGETS hello DESTINATION hello)

SET(CPACK_GENERATOR "DEB")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Hello Kitty") #required
SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
INCLUDE(CPack)

commands to trigger
apt install cmake
cmake .
make package
dpkg -I Hello-0.1.1-Linux.deb | grep Depends

expected output:
Depends: libc6 (>= 2.2.5), libstdc++6 (>= 4.1.1)

actual output of grep if /usr/bin/file is not installed is empty (missing Depends line)

affects Ubuntu version: Ubuntu 16.04 (probably all others too)
affects cmake version: 3.5.1-1ubuntu1

Work-around: apt install file (almost everyone has that installed, but minimal docker containers for package building do not)

suggested solution: make the cmake package depend on the file package

thanks for caring

Gianfranco



More information about the Pkg-cmake-team mailing list