Re: Cross compiling user applications for armv7

From: Warner Losh <imp_at_bsdimp.com>
Date: Sun, 14 Sep 2025 14:54:12 UTC
On Sun, Sep 14, 2025 at 6:47 AM Michał Kruszewski <mkru@protonmail.com>
wrote:

> I have finally managed
>   poudriere jail -c -x -j armv7 -m git+https -a arm.armv7 -v releng/14.3
> -K GENERIC
> to work.
> I see that it cross compiles the systems.
> This is pointless and redundant as I have already cross compiled the
> system on my own.
> How can I tell poudriere to use the system I have compiled on my own?
>
> I also started wondering why is qemu even required?
>

Because it's the only way to run armv7 binaries on x86.


> The cross compiler toolchain is already prepared and ready-to-use after
> system compilation.
> The ports descriptions already exist.
> Why can't I simply cross compile ports?
>

The ports system doesn't really support cross building directly because the
number of ways that ports can cross build is huge. The errors from cross
building also is huge. So they are built natively, but with a trick. The
jail has the system's compiler built such that it runs natively on the
system, but produces target code. One common problem is that many packages
build tools that are then used to build the rest of the system. It's
primarily those tools that run with qemu.


> This task does not require qemu, as I don't want to run resulting binaries
> on host.
> I just wont to cross compile ports and place them on the target file
> system.
> Qemu shouldn't be required for that.
>

Ideally, no. However, attempts to cross compile things in the manner that
each package expects ran into a lot of problems, so this fallback is used
instead.

Warner


> Regards,
> Michał Kruszewski
>
>
> Sent with Proton Mail secure email.
>
> On Sunday, September 14th, 2025 at 2:33 PM, void <void@f-m.fm> wrote:
>
> > Hello,
> >
> > On Sun, Sep 14, 2025 at 09:24:07AM +0000, Michał Kruszewski wrote:
> >
> > > I actually build system from the current main branch.
> > > How do I set up poudriere in such a case?
> >
> >
> > I'd do it like this, on amd64:
> >
> > install poudriere-devel and configure poudriere.conf for your system.
> > (copy /usr/local/etc/poudriere.conf.sample to poudriere.conf and
> > edit it)
> > install qemu-user-static
> > run this: 'binmiscctl enable armv7'
> > then
> >
> > poudriere jail -c -j armv7 -J10 -a arm.armv7 -m git+https -K
> GENERIC-NODEBUG -v main
> >
> > the -J corresponding to the number of cores you may have.
> >
> > Note that poudriere uses qemu-user-static for cross-compilation and
> > you can't build rust (or anything that uses rust) with it, as far as
> > I'm aware.
> > --
>
>