The ideal case is having a directory (called a sysroot or root filesystem) for each of your targets. They're just normal directories, you can have multiple on the same system.
If you want to target Debian/Ubuntu/Raspberry Pi OS, you can use apt with (s)chroot to install packages into those sysroots. See e.g. https://tttapa.github.io/Pages/Raspberr ... filesystem. I've only ever set this up on Ubuntu, you can definitely do something similar on Raspberry Pi OS, but I don't have any specific instructions, but in broad strokes:
If you want to target Debian/Ubuntu/Raspberry Pi OS, you can use apt with (s)chroot to install packages into those sysroots. See e.g. https://tttapa.github.io/Pages/Raspberr ... filesystem. I've only ever set this up on Ubuntu, you can definitely do something similar on Raspberry Pi OS, but I don't have any specific instructions, but in broad strokes:
- Create a directory for your sysroot and install Raspberry Pi OS into it, either by extracting one of the images from the RPi website, or by using the debootstrap script (see the link above).
- Use (s)chroot to execute apt update/install in that sysroot to install the packages you need.
- Create a CMake toolchain file that specifies the compiler and points to the sysroot, so the right versions of your libraries are picked up. It is important to use set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) etc. to prevent CMake from trying to locate libraries in /usr/lib of the build system. See the links in my first post for details.
Statistics: Posted by tttapa — Sun Aug 25, 2024 6:15 pm