I have a lot of different type files in my project (on Ubuntu 22.04, cmake-3.22).
I trying to create a DEB file I’ve got an error in CPack.
CPackDeb.cmake file look through all install file and show fatal error with empty string:
error: CPackDeb: dpkg-shlibdeps: ‘’
code with error:
Then I try to show more info about the variable called SHLIBDEPS_RESULT, it has value: ‘Argument list too long’
I have added more logout messages and see that the loop through FILE_PATHS_:
foreach(FILE_ IN LISTS FILE_PATHS_)
cannot parse some .bin (binary with custom data) files correctly.
The cicle stumbles on .bin file and gums all other filenames together to variable CPACK_DEB_INSTALL_FILES.
I don’t have same error on another linux-machine with cmake-3.15
Can you provide an example of what the file
command output is for one of the files it chokes on? It would also be useful to see what CPACK_DEB_INSTALL_FILES
ends up being set to.
I add log message “file —” in the loop through all elements of CPACK_DEB_INSTALL_FILES, that show name and info about every file:
# Only dynamically linked ELF files are included
# Extract only file name infront of ":"
foreach(_FILE IN LISTS CPACK_DEB_INSTALL_FILES)
message("_file --- ${_FILE}")
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()
if(_FILE MATCHES "ELF.*not stripped")
string(REGEX MATCH "(^.*):" _FILE_NAME "${_FILE}")
list(APPEND CPACK_DEB_UNSTRIPPED_FILES "${CMAKE_MATCH_1}")
endif()
endforeach()
Several files are parsed correctly, but parsing process is broken on one .bin file.
After that all other filenames are gum together
MODERATOR NOTE: Please copy the actual output as text, not a screenshot. This makes the text searchable and easier for others to copy-and-paste if needed.
I think I see the problem (well, a couple of problems). The output of the problematic file command contains a string that includes a [
with no matching ]
after it. The way CMake’s parsing rules work, semicolons are treated as list separators, except between [
and ]
characters. Since the output has no closing ]
, it effectively makes the rest of what should have been a list part of the output of that file command. This is why you see all subsequent file output “gummed together”, as you called it.
It looks like CPackDeb.cmake
should be sanitising the output from the file
command to prevent problems like what you’ve observed. That would be considered a bug to me. Could you please open a new bug report in the CMake issue tracker. You can add a link to this forum thread for context, but do please make the bug report self contained.