I've set up my own package repository and have published a .deb package to it using reprepo. The code was cross-compiled for Raspberry Pi4 on an Ubuntu x86-64 machine using CMake and CPack. That much works. But it doesn't work on a PiW and fails with an Illegal instruction, as expected.

When I look in /etc/apt/sources.list the sources listed appear to be the same for a PiW and a Pi4, e.g. deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi

So how do I create my own .deb packages that work on both PiW and Pi3/4?

  • I believe you will need to compile a separate version for the PiW. Jan 22, 2021 at 3:09
  • @SteveRobillard Agreed, but then how do I package it so that it works on both PiW and Pi3/4?
    – Ian Mercer
    Jan 22, 2021 at 4:03
  • You will have two different packages based on the architecture and depending on how you created your apt repo may have to make changes there as well. If is kind of like i386 and x64. Jan 22, 2021 at 4:07
  • @SteveRobillard and what's the magic in sources.list that determines which one PiW vs Pi3/4 pulls down? Architecture is 'armhf' for both but 'ARMv6' and 'ARMv7' are different. How do the Rpi deb packages manage with just one?
    – Ian Mercer
    Jan 22, 2021 at 5:34
  • I'm vamping a little here, but it probably depends on having a compiler target that works for both (armv6). Perhaps targeting the PiW with the compiler (which you didn't specify here, we can assume GCC) will execute correctly on both the W and the 4. Jan 22, 2021 at 7:16


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.