# CPack Debian: Package has no dependencies

**URL:** https://discourse.cmake.org/t/cpack-debian-package-has-no-dependencies/4506
**Category:** Code
**Created:** [November 19, 2021, 10:12am UTC](https://discourse.cmake.org/t/cpack-debian-package-has-no-dependencies/4506 "2021-11-19T10:12:04Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Leon0402](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/l/ccd318/32.png) [@Leon0402](https://discourse.cmake.org/u/Leon0402)
#### Post date: [November 19, 2021, 10:12am UTC](https://discourse.cmake.org/t/cpack-debian-package-has-no-dependencies/4506/1 "2021-11-19T10:12:04Z")

</div>

Hi,

I want to generate a .deb package and have `dpkg` installed (on my arch linux system). My code looks something like that:

```cmake
set(CPACK_COMPONENTS_ALL Beans)
set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE)

set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) 
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON)

```

I don’t understand two things here (which might be the cause of my problem):

1. Do I need the `COMPONENT` variables like `CPACK_DEBIAN_<COMP>_PACKAGE_SHLIBDEPS`? I do use components, but don’t generate different packages.

2. What is the difference between `CPACK_DEBIAN_PACKAGE_SHLIBDEPS` and `CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS`. I’ve read the documentation, but I don’t really understand the difference

My actual problem though is that with the current configuration no dependencies are generated. Cmake tells me `CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.`. But shouldn’t dependencies are determined automatically by using `dpkg-shlibdeps`.

There is also no dependency line in `Deb/Controll`. But at least something like `libstdc` should always be found I assumed?

What did I do wrong?

---

<div class="post-metadata">

### Author: ![Leon0402](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/l/ccd318/32.png) [@Leon0402](https://discourse.cmake.org/u/Leon0402)
#### Post date: [November 19, 2021, 1:47pm UTC](https://discourse.cmake.org/t/cpack-debian-package-has-no-dependencies/4506/2 "2021-11-19T13:47:23Z")

</div>

Found out that I can run with debug output:

```auto
CPack: Create package using DEB
CPack: Install projects
CPack: - Install project: BeansServer []
CPack: - Install component: Beans
CPack: Create package
CPackDeb Debug: dpkg-shlibdeps --version output is 'Debian dpkg-shlibdeps version 1.20.9.

This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.'
CPackDeb Debug: dpkg-shlibdeps version is <1.20.9>
CPackDeb: - Generating dependency list
CPackDeb Debug: dpkg-shlibdeps warnings 
dpkg-shlibdeps: warning: package could avoid a useless dependency if ./opt/BeansServer/bin/BeansServer was not linked against libboost_date_time.so.1.76.0 (it uses none of the library's symbols)
dpkg-shlibdeps: warning: package could avoid a useless dependency if ./opt/BeansServer/bin/BeansServer was not linked against libboost_system.so.1.76.0 (it uses none of the library's symbols)

CPackDeb Debug: Found dependency: from output 
-- CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies

```

Also there is a `shlibs` file now. But there is still no `depends` line in the control file. And I think there should be one, right?

---

<div class="post-metadata">

### Author: ![Leon0402](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/l/ccd318/32.png) [@Leon0402](https://discourse.cmake.org/u/Leon0402)
#### Post date: [November 23, 2021, 8:43pm UTC](https://discourse.cmake.org/t/cpack-debian-package-has-no-dependencies/4506/3 "2021-11-23T20:43:39Z")

</div>

Okay it seems it just doesn’t work very well on arch, but only on debian based distro.

There is one problem left though. I want to ship Qt6 as part of the package as the library isn’t available in the package manager. On my Debian I therefore have installed Qt6 somewhere in my home directory and included it with CMAKE\_PREFIX\_PATH. Apart from Qt6.so libraries it contains also all dependencies in the same directory.

To copy the dependencies I do the following with the hint to the Qt6 library

```auto
install(TARGETS BeansServer COMPONENT Beans
  RUNTIME_DEPENDENCIES
  DIRECTORIES $<TARGET_FILE_DIR:Qt6::Core>
)

```

This will install everything properly. It issues a warning though, but as Qt6 is in a local directory, this seems to be right?  
I also set the RPATH accordingly so all dependencies are found.

But when generating the deb I get errors like these:

```auto
CPackDeb: dpkg-shlibdeps: 'dpkg-shlibdeps: error: cannot find library
  libicudata.so.56 needed by
  ./home/leon/beans-server/build-ninja-clang-release/install/lib/libicuuc.so.56.1
  (ELF format: 'elf64-x86-64' abi: '0201003e00000000'; RPATH:
  '/home/qt/icu_install/lib')

```

So first of all all the libraries: Qt6Core.so, libicuuc.so.56.1, libicudata.so.56 are from QT and are installed probably through the command above.  
But it seems when analyzing `libicuuc.so.56.1` it searches in the RPATH of this library. The RPATH is wrong though, the above directory `/home/qt/icu_install/lib` doesn’t even exist.  
Instead it should search in my defined RPATH (for BeansServer), where it would find the library.

What can I do about it?
