Re: Buildkernel fails in /usr/obj/usr/src/arm.armv7/sys/GENERIC/vchiq_shim.o

From: Mark Millard <marklmi_at_yahoo.com>
Date: Sat, 01 Nov 2025 16:36:41 UTC
On Nov 1, 2025, at 08:57, Adrian Chadd <adrian@freebsd.org> wrote:

> There's obviously something wrong with my cross building, because when I try cross building armv7 on my laptop it succeeds
> 
> Anyone have any ideas what I'm doing wrong here? thanks!

My guess is that you have something disabling some more strict
type matching checks: you are not getting -Werror,-Wformat

Later notes below somewhat support this as a possibility,
given the error message references -Werror,-Wformat .

> ```
> #!/bin/sh
> 
> OBJ_BASE="/home/adrian/work/freebsd/head/freebsd-obj-arm"
> SRC_BASE="/home/adrian/work/freebsd/head/freebsd-src-arm"
> PORTS_BASE="/home/adrian/work/freebsd/head/freebsd-ports-arm"
> MAKE_FLAGS="-j8 -s"
> X_TARGET_ARCH="armv7"
> KERN_CONFIG="GENERIC"
> BUILD_FLAGS="NO_CLEAN=1"

Do your build logs show the relevant source being compiled?
Use of NO_CLEAN=1 for validation build activity has some
risks. (I'm guessing that this is not the problem.)

> env MAKEOBJDIRPREFIX="${OBJ_BASE}" make ${MAKE_FLAGS} buildkernel KERNCONF=${KERN_CONFIG} ${BUILD_FLAGS} TARGET_ARCH=${X_TARGET_ARCH}
> ```
> 
> On Sat, 1 Nov 2025 at 08:18, bob prohaska <fbsd@www.zefox.net> wrote:
> A Raspberry Pi 2 v1.1 is failing buildkernel with 
> Building /usr/obj/usr/src/arm.armv7/sys/GENERIC/vchiq_shim.o
> --- vchiq_2835_arm.o ---
> /usr/src/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c:549:71: error: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Werror,-Wformat]
>   549 |                 "free_pagelist - %zx, %d (%u bytes @%p)", (size_t)pagelist, actual, pagelist->length, bi->buf);
>       |                                           ~~                                        ^~~~~~~~~~~~~~~~
>       |                                           %lu
> /usr/src/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.h:73:39: note: expanded from macro 'vchiq_log_trace'
>    73 |                 printf(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0)
>       |                                         ~~~         ^~~~~~~~~~~
> 1 error generated.
> *** [vchiq_2835_arm.o] Error code 1

https://cgit.freebsd.org/src/tree/sys/contrib/vchiq/interface/vchiq_arm/vchiq_pagelist.h

shows:

typedef struct pagelist_struct {
        unsigned long length;
. . .

in agreement with the error report's "unsigned long" reference.
 "man arch" reports:

     On all supported architectures:

           Type         Size
           . . .
           int          4

         Architecture   long   void *   long double   time_t
           . . .
           armv7          4      4        8             8

So it is not a actual-size problem. So it is more of a
strict type checking notice.


Side note:

FreeBSD has "Variables of types unsigned long and
size_t have the same representation" but also has
examples like:

           Architecture   long   void *   long double   time_t
           . . .
           aarch64c       8      16       16            8
           . . .
           riscv64c       8      16       16            8

Thus the (size_t)pagelist use looks to be definitely
Machine Dependent code. Any reason that %p and (void*)
were not used? (Not that vchiq use would necessarily
be likely on aarch64c or riscv64c .)

> uname -a reports
> FreeBSD pelorus.zefox.org 16.0-CURRENT FreeBSD 16.0-CURRENT #1 main-n281567-8d5a88ac95b2: Wed Oct 29 18:14:25 PDT 2025     bob@pelorus.zefox.org:/usr/obj/usr/src/arm.armv7/sys/GENERIC arm
> 
> Git reset --hard reported
> HEAD is now at c6e02892bbca bsd-family-tree: add macOS 26
> 
> This has been going on for a couple of days at least. 
> 




===
Mark Millard
marklmi at yahoo.com