# CPack doesn't produce a debian dbgsym package alongside debian binary package

**URL:** https://discourse.cmake.org/t/cpack-doesnt-produce-a-debian-dbgsym-package-alongside-debian-binary-package/1255
**Category:** Usage
**Created:** [May 22, 2020, 9:20am UTC](https://discourse.cmake.org/t/cpack-doesnt-produce-a-debian-dbgsym-package-alongside-debian-binary-package/1255 "2020-05-22T09:20:47Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![manuel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/67e7ee/32.png) [@manuel](https://discourse.cmake.org/u/manuel)
#### Post date: [May 22, 2020, 9:20am UTC](https://discourse.cmake.org/t/cpack-doesnt-produce-a-debian-dbgsym-package-alongside-debian-binary-package/1255/1 "2020-05-22T09:20:48Z")

</div>

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](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.

```auto
    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:

```auto
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:

```auto
    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.

```auto
    install(
        TARGETS add
        ARCHIVE DESTINATION "lib"
        PUBLIC_HEADER DESTINATION "include"
        COMPONENT dev )

```

```auto
    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

```

---

<div class="post-metadata">

### Author: ![manuel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/67e7ee/32.png) [@manuel](https://discourse.cmake.org/u/manuel)
#### Post date: [May 22, 2020, 11:15am UTC](https://discourse.cmake.org/t/cpack-doesnt-produce-a-debian-dbgsym-package-alongside-debian-binary-package/1255/2 "2020-05-22T11:15:21Z")

</div>

In case anyone would like to try this out, you can git-clone the repo I set up: [https://gitlab.com/manuel\_wagesreither/dbgsym-cpack](https://gitlab.com/manuel_wagesreither/dbgsym-cpack)

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 9, 2020, 9:28pm UTC](https://discourse.cmake.org/t/cpack-doesnt-produce-a-debian-dbgsym-package-alongside-debian-binary-package/1255/3 "2020-11-09T21:28:02Z")

</div>

@kyle.edwards This may be of interest to you.

---

<div class="post-metadata">

### Author: ![gmabey](https://discourse.cmake.org/user_avatar/discourse.cmake.org/gmabey/32/1020_2.png) [@gmabey](https://discourse.cmake.org/u/gmabey)
#### Post date: [December 11, 2020, 4:17pm UTC](https://discourse.cmake.org/t/cpack-doesnt-produce-a-debian-dbgsym-package-alongside-debian-binary-package/1255/4 "2020-12-11T16:17:47Z")

</div>

basically identical question …

> <https://stackoverflow.com/questions/65226723/why-doesnt-asserting-cpack-debian-debuginfo-package-result-in-a-ddeb-file>
