Hello all,
I have a CMake project which successfully builds a static library and packages it as a debian package. I would like to distribute a dgbsym package along with it. Altough I think I followed all the steps necessary, it still is not created.
Here is some info on dbgsym packages: https://wiki.ubuntu.com/Debug%20Symbol%20Packages
Would you mind giving my CMakeLists a quick look?
I tried these steps in CMake 3.13.4 and 3.16.3.
Unfortunately I have to post it inline, as, being a newly registered user, I cannot upload files yet.
cmake_minimum_required(VERSION 3.13)
#set( CMAKE_TOOLCHAIN_FILE cmake/x86_64.gcc.toolchain.cmake )
project( addition_lib
DESCRIPTION "Encrypts and decrypts some text"
VERSION 1.0.0
LANGUAGES CXX )
####
add_library( add )
target_sources( add
PRIVATE add.cpp )
target_include_directories( add
PUBLIC include )
# Used for install() only
set_target_properties ( add
PROPERTIES
PUBLIC_HEADER "include/add.hpp" )
install(
TARGETS add
ARCHIVE DESTINATION "lib"
PUBLIC_HEADER DESTINATION "include" )
####
message( STATUS "build type is " ${CMAKE_BUILD_TYPE} )
set( CPACK_PACKAGE_NAME ${PROJECT_NAME} )
set( CPACK_PACKAGE_CONTACT "Contact name" )
set( CPACK_PACKAGE_VERSION ${PROJECT_VERSION} )
set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "Description" )
set( CPACK_GENERATOR DEB )
set( CPACK_DEBIAN_PACKAGE_DEPENDS "" )
set( CPACK_DEB_COMPONENT_INSTALL ON )
set( CPACK_DEBIAN_DEBUGINFO_PACKAGE ON )
include( CPack )
CMake/CPack produces the following output:
manuel@debian:~/Documents/repos/dbgsym/build$ cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .. && make package
-- The CXX compiler identification is GNU 8.3.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- build type is RelWithDebInfo
-- Configuring done
-- Generating done
-- Build files have been written to: /home/manuel/Documents/repos/dbgsym/build
Scanning dependencies of target add
[ 50%] Building CXX object CMakeFiles/add.dir/add.cpp.o
[100%] Linking CXX static library libadd.a
[100%] Built target add
Run CPack packaging tool...
CPack: Create package using DEB
CPack: Install projects
CPack: - Run preinstall target for: addition_lib
CPack: - Install project: addition_lib
CPack: Create package
-- CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.
CPack: - package: /home/manuel/Documents/repos/dbgsym/build/addition_lib-1.0.0-Linux.deb generated.
I checked completeness of the debian package with the following command:
manuel@debian:~/Documents/repos/dbgsym/build$ ar xf addition_lib-1.0.0-Linux.deb && tar tf data.tar.gz
./usr/
./usr/include/
./usr/include/add.hpp
./usr/lib/
./usr/lib/libadd.a
I was told that I also need to specify COMPONENT when for the install clause, but then cpack crashes.
install(
TARGETS add
ARCHIVE DESTINATION "lib"
PUBLIC_HEADER DESTINATION "include"
COMPONENT dev )
Run CPack packaging tool...
CPack: Create package using DEB
CPack: Install projects
CPack: - Run preinstall target for: addition_lib
CPack: - Install project: addition_lib
CPack: - Install component: Unspecified
CPack: - Install component: dev
CPack: Create package
-- CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_M_construct null not valid
make: *** [Makefile:98: package] Aborted