CPackDeb dpkg-shlibdeps with sysroot while cross-compiling
Hi, I'm cross-compiling to target armhf (raspberry-pi) using an amd64 docker host.
Details: sysroot is /sysroot
so CMAKE_SYSROOT
is set to /sysroot
CMakeList.txt
has
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
I have problem when running cpack:
CMake Error at /usr/share/cmake-3.13/Modules/Internal/CPack/CPackDeb.cmake:256 (message):
CPackDeb: dpkg-shlibdeps: 'dpkg-shlibdeps: warning: cannot determine CC
system type, falling back to default (native compilation)
dpkg-shlibdeps: error: cannot find library libboost_filesystem.so.1.67.0
needed by ./usr/bin/roper-file-rename-daemon (ELF format: 'elf32-little'
abi: '0101002800000000'; RPATH: '')
dpkg-shlibdeps: error: cannot find library libdl.so.2 needed by
./usr/bin/roper-file-rename-daemon (ELF format: 'elf32-little' abi:
'0101002800000000'; RPATH: '')
dpkg-shlibdeps: error: cannot find library libpthread.so.0 needed by
./usr/bin/roper-file-rename-daemon (ELF format: 'elf32-little' abi:
'0101002800000000'; RPATH: '')
...
Well that's just horrid because those libs that it cannot find are in
-
/sysroot
(e.g./sysroot/lib/arm-linux-gnueabihf/...
;/sysroot/usr/lib/arm-linux-gnueabihf/...
)
and in the -
native crosscompiler-locations
(/usr/arm-linux-gnueabihf/lib/...
e.g. libstdc++.so.6)
Now... running command (see #17447 (comment 347535)) :
LD_LIBRARY_PATH=/sysroot/usr/lib/arm-linux-gnueabihf:/sysroot/lib/arm-linux-gnueabihf:/usr/arm-linux-gnueabihf/lib:${LD_LIBRARY_PATH} cpack
it works, but if I inspect the generated deb's controlfile like this:
mkdir tmp
cd tmp
ar x ../*.deb
tar xf control.tar.gz
cat control
I see the control
file has
Architecture: armhf
Depends: libc6:armhf (>= 2.28), libgcc1-armhf-cross (>= 1:4.0), libstdc++6:armhf
That's still not entirely correct, because it's only listing "native" packages, not packages from /sysroot
.
If I compile pseudo-natively in a chroot with qemu (or as a fool-with-endless-time-on-his-hands on the real raspberry pi), then it looks differently:
Architecture: armhf
Depends: libboost-filesystem1.67.0, libboost-system1.67.0, libc6 (>= 2.28), libgcc1 (>= 1:4.0), libhdf5-103, libhdf5-cpp-103 (>= 1.10.4), libsqlite3-0 (>= 3.5.9), libstdc++6 (>= 7), libsz2, zlib1g (>= 1:1.1.4)
Any way of fixing this?