Hi, the CPack DEB generator executes the file tool to determine whether a file is executable
this is a snippet from CPackDeb.cmake from cmake gitlab master: # 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() # Only dynamically linked ELF files are included # Extract only file name infront of ":" foreach(_FILE IN LISTS CPACK_DEB_INSTALL_FILES) if(_FILE MATCHES "ELF.*dynamically linked") string(REGEX MATCH "(^.*):" _FILE_NAME "${_FILE}") list(APPEND CPACK_DEB_BINARY_FILES "${CMAKE_MATCH_1}") set(CONTAINS_EXECUTABLE_FILES_ TRUE) endif() if(_FILE MATCHES "ELF.*shared object") string(REGEX MATCH "(^.*):" _FILE_NAME "${_FILE}") list(APPEND CPACK_DEB_SHARED_OBJECT_FILES "${CMAKE_MATCH_1}") endif() endforeach() The problem is that execute_process(COMMAND file) may fail, and if it does, we do not add the dependencies of that executable to the generated deb file. This issue happened to us because our continuous integration system tried building inside a minimal docker image, where /usr/bin/file was simply not available, but it might fail for other reasons too: for example strange things in the user's path, open file limit exceeded or out of memory conditions. I would therefore much prefer if the above code: 1) uses a variable ${FILE_EXECUTABLE} for the file tool defaulting to /usr/bin/file similar to the way it uses the variable ${READELF_EXECUTABLE} for the readelf tool 2) checks the return code on every iteration of the foreach() loop, and calls message(FATAL_ERROR) if it is non-zero. I would be willing to implement this in a branch. Regards, Henning PS: I reported this as a packing issue (file is a missing dependency of cmake) to ubuntu at https://bugs.launchpad.net/ubuntu/+source/cmake/+bug/1647868 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake