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 18:59:10 UTC
On Nov 1, 2025, at 11:26, Mark Millard <marklmi@yahoo.com> wrote:

> On Nov 1, 2025, at 10:45, Mark Millard <marklmi@yahoo.com> wrote:
> 
>> On Nov 1, 2025, at 10:22, Adrian Chadd <adrian@freebsd.org> wrote:
>> 
>>> Here's my suggested solution:
>>> 
>>> ===
>>> diff --git a/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c b/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c
>>> index 96c3a0db8aa5..7e105a6b3b77 100644
>>> --- a/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c
>>> +++ b/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c
>>> @@ -628,7 +628,9 @@ free_pagelist(BULKINFO_T *bi, int actual)
>>>       pagelist = bi->pagelist;
>>> 
>>>       vchiq_log_trace(vchiq_arm_log_level,
>>> -               "free_pagelist - %zx, %d (%u bytes @%p)", (size_t)pagelist, actual, pagelist->length, bi->buf);
>>> +           "free_pagelist - %zx, %d (%lu bytes @%p)",
>>> +           (size_t)pagelist, (int)actual, (unsigned long)pagelist->length,
>>> +           bi->buf);
>>> 
>>>       num_pages =
>>>               (pagelist->length + pagelist->offset + PAGE_SIZE - 1) /
>>> ===
>>> 
>>> The code /is/ being compiled on my arm64 and armv7 builds, I verified this by using #error in this source file. But the format strings aren't eliciting a type violation when I cross compile.
>> 
>> The CI builds are on the likes of butler4.nyi.freebsd.org which
>> are amd64 as far as I know: also cross builds.
>> 
>> The CI build infrastructure may be public enough to check for if
>> anything special is specified for those builds. For example, I do
>> not know if they use /dev/null or empty files relative to the
>> likes of environment variables:
>> 
>> __MAKE_CONF
>> SRCCONF
>> SRC_ENV_CONF
>> 
>> or what the related file content might be like otherwise.
> 
> In:
> 
> https://ci.freebsd.org/job/FreeBSD-main-armv7-build/26181/consoleFull
> 
> I see:
> 
> . . .
> export 'MAKEOBJDIRPREFIX=/workspace/obj'
> rm -fr /workspace/obj
> . . .
> sudo make -j 12 -DWITHOUT_CLEAN buildworld 'TARGET=arm' 'TARGET_ARCH=armv7' '__MAKE_CONF=/workspace/freebsd-ci/jobs/FreeBSD-main-armv7-build/make.conf' 'SRCCONF=/dev/null'
> . . .
> sudo make -j 12 -DWITHOUT_CLEAN buildkernel 'TARGET=arm' 'TARGET_ARCH=armv7' '__MAKE_CONF=/workspace/freebsd-ci/jobs/FreeBSD-main-armv7-build/make.conf' 'SRCCONF=/dev/null'
> . . .
> 
> In:
> 
> https://github.com/freebsd/freebsd-ci/blob/main/jobs/FreeBSD-main-armv7-build/make.conf
> 
> I see just:
> 
> QUOTE
> KERNCONF=GENERIC GENERIC-MMCCAM
> END QUOTE
> 
> I do not see anything explicit related to what SRC_ENV_CONF is for
> binding to, so a default context for that binding.

Looking at the official CI build log, I see:

cc -target armv7-gnueabihf-freebsd16.0 --sysroot=/usr/obj/usr/src/arm.armv7/tmp -B/usr/obj/usr/src/arm.armv7/tmp/usr/bin -c -O2 -pipe -fno-strict-aliasing -g -nostdinc -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -I/usr/src/sys/contrib/libfdt -I/usr/src/sys/contrib/device-tree/include -I/usr/src/sys/dts/include -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -march=armv7a -DLINUX_DTS_VERSION=\""6.12"\" -funwind-tables -MD -MF.depend.vchiq_kmod.o -MTvchiq_kmod.o -fdebug-prefix-map=./machine=/usr/src/sys/arm/include -ffreestanding -fwrapv -fstack-protector -gdwarf-4 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wswitch -Wno-error=tautological-compare -Wno-error=empty-body -Wno-error=parentheses-equality -Wno-error=unused-function -Wno-error=pointer-sign -Wno-error=shift-negative-value -Wno-address-of-packed-member -Wno-format-zero-length -mfpu=none -std=gnu17 -Werror /usr/src/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I/usr/src/sys/contrib/vchiq

It appears that the -Werror is from:

/usr/src/sys/conf/kern.pre.mk:WERROR?=  -Werror
. . .
/usr/src/sys/conf/kern.pre.mk:NORMAL_C= ${CC} -c ${CFLAGS} ${WERROR} ${.IMPSRC}

via a:

/usr/src/sys/arm/broadcom/bcm2835/files.bcm283x:        compile-with "${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq"

In other words, the official build's WERROR contains -Werror .

What do your build logs show for the compile of:

/usr/src/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c

? It would appear that there is some prior definition of
WERROR in your environment, such that "WERROR?=  -Werror"
would no-op and use your environment's definition instead.

===
Mark Millard
marklmi at yahoo.com