Re: Personal aarch64 FreeBSD OS build gets SIGSEGV during: ./pmu-events/jevents arm64 /usr/main-src/lib/libpmc/pmu-events/arch libpmc_event [lists the jevents file mismatches]

From: Mark Millard <marklmi_at_yahoo.com>
Date: Tue, 22 Sep 2026 18:18:07 UTC
On 9/22/26 09:00, Mark Millard wrote:
> On 9/22/26 08:25, Mark Millard wrote:
>> On 9/22/26 08:21, Mark Millard wrote:
>>> On 9/22/26 06:43, Alan Somers wrote:
>>>> On Sun, Sep 20, 2026 at 10:46 PM Mark Millard <marklmi@yahoo.com> wrote:
>>>>>
>>>>> On 9/20/26 18:54, Mark Millard wrote:
>>>>>> On 9/20/26 11:13, Mark Millard wrote:
>>>>>>> [I have CC'd a could of authors with recent libpmc commits. I did not
>>>>>>> list any recent libc authors.]
>>>>>>>
>>>>>>> . . .
>>>>>>>
>>>>>>
>>>>>> I found the type of problem --but it is not a obvious extension of
>>>>>> the prior material: META_MODE recorded something that indicates the
>>>>>> actual problem . . .
>>>>>>
>>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/lib/libpmc/pmu-events/jevents.pieo.meta:R
>>>>>> 12651 /usr/include/fts.h
>>>>>>
>>>>>> The build is using the /usr/include/fts.h from the live old system
>>>>>> while trying to build the new system.
>>>>>>
>>>>>> Given the FTSENT change of layout from old to new, that does not
>>>>>> work. Also, this is not something that clearing out /usr/obj/ . . .
>>>>>> and rebuilding fixes.
>>>>>>
>>>>>> The build of lib/libpmc/pmu-events/jevents.* should get the fts.h
>>>>>> file from the source tree being built, in my case I was working in
>>>>>> /usr/main-src/ so:
>>>>>>
>>>>>> # find -s /usr/main-src/ -name fts.h -print
>>>>>> /usr/main-src/include/fts.h
>>>>>>
>>>>>> lists a path to the file that should have been used for the build.
>>>>>>
>>>>>> I expect that this would be a libpmc development issue, not a fts
>>>>>> development issue for who solves it.
>>>>>>
>>>>>>
>>>>>> Also: this turns out to not be an arm specific problem.
>>>>>>
>>>>>>
>>>>>
>>>>> The problematic include handling for building system updates extends far
>>>>> beyond the specific example in jevents.pieo.meta : All but 8 of the many
>>>>> include file usages were strictly tied to the old live system instead of
>>>>> to the new system's source tree (to some degree):
>>>>> (The ones that mention main-src are those that involve the source tree
>>>>> that I was doing the build for.)
>>>>>
>>>>> # grep -e /include/ -e '\.h$'
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/lib/libpmc/pmu-events/jevents.pieo.meta
>>>>> R 12651 /usr/include/sys/param.h
>>>>> R 12651 /usr/include/sys/_null.h
>>>>> R 12651 /usr/include/sys/_param.h
>>>>> R 12651 /usr/include/sys/types.h
>>>>> R 12651
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/tmp/legacy/usr/include/sys/cdefs.h
>>>>> R 12651
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/tmp/legacy/usr/include/sys/_decls.h
>>>>> R 12651
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/tmp/legacy/usr/include/sys/_visible.h
>>>>> R 12651 /usr/include/machine/endian.h
>>>>> R 12651 /usr/include/sys/_types.h
>>>>> R 12651 /usr/include/machine/_types.h
>>>>> R 12651 /usr/include/sys/_endian.h
>>>>> R 12651 /usr/include/sys/_offsetof.h
>>>>> R 12651 /usr/include/sys/_pthreadtypes.h
>>>>> R 12651 /usr/include/sys/_stdint.h
>>>>> R 12651 /usr/include/sys/bitcount.h
>>>>> R 12651 /usr/include/sys/select.h
>>>>> R 12651 /usr/include/sys/_sigset.h
>>>>> R 12651 /usr/include/sys/_timeval.h
>>>>> R 12651 /usr/include/sys/timespec.h
>>>>> R 12651 /usr/include/sys/_timespec.h
>>>>> R 12651 /usr/include/sys/syslimits.h
>>>>> R 12651 /usr/include/sys/signal.h
>>>>> R 12651 /usr/include/sys/_sigaltstack.h
>>>>> R 12651 /usr/include/sys/_sigval.h
>>>>> R 12651 /usr/include/machine/_limits.h
>>>>> R 12651 /usr/include/machine/signal.h
>>>>> R 12651 /usr/include/machine/param.h
>>>>> R 12651 /usr/include/sys/_align.h
>>>>> R 12651 /usr/include/sys/limits.h
>>>>> R 12651 /usr/include/sys/_maxphys.h
>>>>> R 12651 /usr/include/sys/resource.h
>>>>> R 12651 /usr/include/sys/stat.h
>>>>> R 12651 /usr/include/sys/time.h
>>>>> R 12651 /usr/include/sys/_clock_id.h
>>>>> R 12651 /usr/include/time.h
>>>>> R 12651 /usr/include/xlocale/_time.h
>>>>> R 12651 /usr/include/ctype.h
>>>>> R 12651 /usr/include/_ctype.h
>>>>> R 12651 /usr/include/runetype.h
>>>>> R 12651 /usr/include/xlocale/_ctype.h
>>>>> R 12651 /usr/include/dirent.h
>>>>> R 12651 /usr/include/sys/dirent.h
>>>>> R 12651 /usr/include/errno.h
>>>>> R 12651 /usr/include/libgen.h
>>>>> R 12651 /usr/include/limits.h
>>>>> R 12651 /usr/include/stdarg.h
>>>>> R 12651 /usr/include/sys/_stdarg.h
>>>>> R 12651
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/tmp/legacy/usr/include/stddef.h
>>>>> R 12651 /usr/include/stddef.h
>>>>> R 12651 /usr/include/stdio.h
>>>>> R 12651 /usr/include/stdlib.h
>>>>> R 12651 /usr/include/string.h
>>>>> R 12651 /usr/include/strings.h
>>>>> R 12651 /usr/include/xlocale/_strings.h
>>>>> R 12651 /usr/include/xlocale/_string.h
>>>>> R 12651 /usr/include/unistd.h
>>>>> R 12651 /usr/include/sys/unistd.h
>>>>> R 12651 /usr/include/ftw.h
>>>>> R 12651 /usr/main-src/lib/libpmc/pmu-events/list.h
>>>>> R 12651 /usr/main-src/lib/libpmc/pmu-events/jsmn.h
>>>>> R 12651 /usr/main-src/lib/libpmc/pmu-events/json.h
>>>>> R 12651 /usr/include/stdbool.h
>>>>> R 12651 /usr/main-src/lib/libpmc/pmu-events/pmu-events.h
>>>>> R 12651 /usr/include/fts.h
>>>>>
>>>>>
>>>>> Some of those may be lower risk of incompatible changes than others but
>>>>> the general trend is not good for doing system builds when layout
>>>>> changes or other incompatibilities are introduced.
>>>>>
>>>>> Of course, there are some things that are built for operation on the
>>>>> older system instead of the newer one. So the classification is case by
>>>>> case across the various *.meta files.
>>>>>
>>>>>
>>>>> Taking a quick stab at finding other examples (incomplete because of the
>>>>> failed build):
>>>>>
>>>>> # find -s /usr/obj/BUILDs/main-CA76-nodbg-clang/ -name \*.meta -exec
>>>>> grep -l -e ' /usr/include/' {} \; | grep -v /tmp/obj-tools/
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/bin/csh/gethost.meta
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/bin/sh/mknodes.meta
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/bin/sh/mksyntax.meta
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/host-osreldate.h.meta
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/lib/libmagic/mkmagic.meta
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/lib/libpmc/pmu-events/jevents.pieo.meta
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/lib/libpmc/pmu-events/jsmn.pieo.meta
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/lib/libpmc/pmu-events/json.pieo.meta
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/lib/ncurses/tinfo/make_hash.meta
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/lib/ncurses/tinfo/make_keys.meta
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/rescue/rescue/usr/main-src/bin/csh/gethost.meta
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/rescue/rescue/usr/main-src/bin/sh/mknodes.meta
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/rescue/rescue/usr/main-src/bin/sh/mksyntax.meta
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/share/syscons/scrnmaps/armscii8-2haik8.mk.meta
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/share/syscons/scrnmaps/iso-8859-1_to_cp437.mk.meta
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/share/syscons/scrnmaps/iso-8859-4_for_vga9.mk.meta
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/share/syscons/scrnmaps/iso-8859-7_to_cp437.mk.meta
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/share/syscons/scrnmaps/koi8-r2cp866.mk.meta
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/share/syscons/scrnmaps/koi8-u2cp866u.mk.meta
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/share/syscons/scrnmaps/us-ascii_to_cp437.mk.meta
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/usr.bin/awk/maketab.meta
>>>>> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/usr.bin/vi/catalog/dump.meta
>>>>>
>>>>>
>>>>> --
>>>>> ===
>>>>> Mark Millard
>>>>> marklmi at yahoo.com
>>>>
>>>> Interesting find.  And I can reproduce it, partially.  If I build
>>>> 16.0-CURRENT from a 15.1 host, and look at the generated symbols:
>>>>
>>>>> objdump -T /usr/obj/.../amd64.amd64/lib/libpmc/pmu-events/jevents.full | grep fts_
>>>> 0000000000000000      DF *UND*  0000000000000000 (FBSD_1.5)   fts_open
>>>> 0000000000000000      DF *UND*  0000000000000000 (FBSD_1.5)   fts_read
>>>> 0000000000000000      DF *UND*  0000000000000000 (FBSD_1.5)   fts_close
>>>>
>>>> I see the FBSD_1.5 version of those symbols.  It should be FBSD_1.9
>>>> instead.  Indeed, if I build from a 16.0 host I do see the FBSD_1.9
>>>> symbols.  So the build is definitely wrong.  But that doesn't quite
>>>> explain why you would get a segfault.  Linking to the FBSD_1.5 symbols
>>>> while using the old header files should work fine.  So I wonder if the
>>>> build is somehow including a mixture of old header files and new ones.
>>>> That would explain a segfault.
>>>>
>>>>
>>>
>>> Yes, it is getting a mnixture: one place gets /usr/inbclude/fts.h .
>>>
>>> Using find for .meta files in the build directorty tree and grep for
>>> fts.h in such files I find:
>>>
>>> ) The odd:
>>>
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/lib/libpmc/pmu-events/jevents.pieo.meta:R
>>> 77658 /usr/include/fts.h
>>>
>>> ) Mostly reference to: /usr/main-src/include/fts.h
>>>   (I'll not show the list of places.)
>>>
>>> For reference:
>>>
>>> # diff -u /usr/include/fts.h /usr/main-src/include/fts.h
>>> --- /usr/include/fts.h	2025-05-11 07:29:42.791259000 -0700
>>> +++ /usr/main-src/include/fts.h	2026-09-18 16:13:35.766402000 -0700
>>> @@ -1,4 +1,4 @@
>>> -/*-
>>> +/*
>>>   * SPDX-License-Identifier: BSD-3-Clause
>>>   *
>>>   * Copyright (c) 1989, 1993
>>> @@ -92,6 +92,8 @@
>>>  	char *fts_path;			/* root path */
>>>  	int fts_errno;			/* errno for this node */
>>>  	int fts_symfd;			/* fd for symlink */
>>> +	int fts_dirfd;                  /* fd for this directory, if a
>>> directory */
>>> +	int __fts_reserved[3];          /* reserved for future use */
>>>  	__size_t fts_pathlen;		/* strlen(fts_path) */
>>>  	__size_t fts_namelen;		/* strlen(fts_name) */
>>>
>>> @@ -146,6 +148,8 @@
>>>  #define	 fts_get_stream(ftsent)	((ftsent)->fts_fts)
>>>  FTS	*fts_open(char * const *, int,
>>>  	    int (*)(const FTSENT * const *, const FTSENT * const *));
>>> +FTS	*fts_openat(int, char * const *, int,
>>> +	    int (*)(const FTSENT * const *, const FTSENT * const *));
>>>  #ifdef __BLOCKS__
>>>  FTS	*fts_open_b(char * const *, int,
>>>  	    int (^)(const FTSENT * const *, const FTSENT * const *));
>>>
>>> ) A rereference:
>>>
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/lib/libsysdecode/ioctl.c.tmp.meta:R
>>> 64787 ./fts.h
>>>
>>> There are a lot of ./. . ./*.h paths in this meta file. If I gatehr
>>> right, these are relative to:
>>>
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/tmp/usr/include/
>>>
>>> For reference:
>>>
>>> # diff -u
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/tmp/usr/include/fts.h
>>> /usr/main-src/include/fts.h
>>> #
>>>
>>>
>>> ) There are references:
>>>
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/lib/libclang_rt/asan/sanitizer_common_sanitizer_platform_limits_freebsd.o.meta:R
>>> 60898
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/tmp/usr/include/fts.h
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/lib/libclang_rt/asan_dynamic/sanitizer_common_sanitizer_platform_limits_freebsd.pico.meta:R
>>> 61150
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/tmp/usr/include/fts.h
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/lib/libclang_rt/cfi/sanitizer_common_sanitizer_platform_limits_freebsd.o.meta:R
>>> 60129
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/tmp/usr/include/fts.h
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/lib/libclang_rt/cfi_diag/sanitizer_common_sanitizer_platform_limits_freebsd.o.meta:R
>>> 60241
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/tmp/usr/include/fts.h
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/lib/libclang_rt/msan/sanitizer_common_sanitizer_platform_limits_freebsd.o.meta:R
>>> 61596
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/tmp/usr/include/fts.h
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/lib/libclang_rt/stats/sanitizer_common_sanitizer_platform_limits_freebsd.o.meta:R
>>> 61726
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/tmp/usr/include/fts.h
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/lib/libclang_rt/tsan/sanitizer_common_sanitizer_platform_limits_freebsd.o.meta:R
>>> 61835
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/tmp/usr/include/fts.h
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/lib/libclang_rt/ubsan_standalone/sanitizer_common_sanitizer_platform_limits_freebsd.o.meta:R
>>> 62121
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/tmp/usr/include/fts.h
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/lib/libclang_rt/xray/sanitizer_common_sanitizer_platform_limits_freebsd.o.meta:R
>>> 62367
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/tmp/usr/include/fts.h
>>>
>>> For reference:
>>>
>>> # diff -u
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/tmp/usr/include/fts.h
>>> /usr/main-src/include/fts.h
>>> #
>>>
>>> ) I ignore here references in . . ./include/_INCSINS.meta
>>>
>>>
>>> So, just the one example:
>>
>> Sorry, poor wording above. Missing: of fts.h
>>
>>>
>>> /usr/obj/BUILDs/main-CA76-dbg-clang/usr/main-src/arm64.aarch64/lib/libpmc/pmu-events/jevents.pieo.meta:R
>>> 77658 /usr/include/fts.h
>>>
>>>
>>
>> jevents.pieo.meta shows lots of other *.h files incorrectly from the
>> /usr/include/ area as well.
>>
> 
> My hypothesis is that the:
> 
> -I/usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/tmp/legacy/usr/include
> 
> in the below CMD line from the .meta file is ineffective because what it
> references has not been populated yet and so /usr/include/ is being used
> by default.


jevents is built as a build tool (from the Makefile):

build-tools: jevents


So it seems that some of the /usr/include/ prefixed paths in the .meta
file's listing of files read need to have been populated into:

/usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/tmp/legacy/usr/include

But were not --and so end up from the live (older) system's
/usr/include/ . fts.h is an example with actual chnages that matter.

> 
> # Meta data file
> /usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/lib/libpmc/pmu-events/jevents.pieo.meta
> CMD cc -fpie -DPIC   -O2 -pipe -fno-common -Wno-cast-qual
> -mcpu=cortex-a76 -fPIE -DNDEBUG  -g -gz=zlib -std=gnu17
> -Wno-format-zero-length  -Wsystem-headers -Wall -Wno-format-y2k -W
> -Wno-unused-paramet
> er -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
> -Wno-uninitialized -Wno-pointer-sign -Wdate-time -Wno-empty-body
> -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-p
> arameter -Wno-error=cast-function-type-mismatch
> -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality
> -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef
> -Wno-address-o
> f-packed-member  -Qunused-arguments
> -I/usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/tmp/legacy/usr/include
>  -c /usr/main-src/lib/libpmc/pmu-events/jevents.c -o jevents.pieo
> . . .
> 
> Also note that there is only the one -I . The
> lib/libpmc/pmu-events/Makefile has only:
> 
> PROG=	jevents
> SRCS=	jevents.c jsmn.c json.c
> CFLAGS+= -Wno-cast-qual
> MAN=
> 
> build-tools: jevents
> 
> .include <bsd.prog.mk>
> 
> 
> The Makefile.depends has only:
> 
> # Autogenerated - do NOT edit!
> 
> DIRDEPS = \
> 
> 
> .include <dirdeps.mk>
> 
> .if ${DEP_RELDIR} == ${_DEP_RELDIR}
> # local dependencies - needed for -jN in clean tree
> .endif
> 
> 
> Nothing is supplying an appropriate -I usage for the context

The above about -I usage seems to be wrong.

The below about sequencing seems to also be wrong:

> --or
> something is out of sequence so that the include files needed are not
> yet in place.


Instead, lots of header files that are used simply are not populated
into the likes of:

/usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/tmp/legacy/usr/include

so that the new ones end up being unavailable when there are changes in
the FreeBSD source code.

For comparison/contrast:

# ls -aC1
/usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/tmp/legacy/usr/include/
| grep '\.h$'
a.out.h
bitstring.h
com_err.h
elf.h
err.h
gssapi.h
kdb.h
krad.h
krb5.h
md4.h
md5.h
mpool.h
ndbm.h
nl_types.h
nlist.h
ripemd.h
sha.h
sha224.h
sha256.h
sha384.h
sha512.h
sha512t.h
skein.h
skein_freebsd.h
skein_iv.h
skein_port.h
stddef.h
stringlist.h
verto-module.h
verto.h

vs.:

# grep ' /usr/include/[^/]*$'
/usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/lib/libpmc/pmu-events/jevents.pieo.meta
| sort -u
R 12651 /usr/include/_ctype.h
R 12651 /usr/include/ctype.h
R 12651 /usr/include/dirent.h
R 12651 /usr/include/errno.h
R 12651 /usr/include/fts.h
R 12651 /usr/include/ftw.h
R 12651 /usr/include/libgen.h
R 12651 /usr/include/limits.h
R 12651 /usr/include/runetype.h
R 12651 /usr/include/stdarg.h
R 12651 /usr/include/stdbool.h
R 12651 /usr/include/stddef.h
R 12651 /usr/include/stdio.h
R 12651 /usr/include/stdlib.h
R 12651 /usr/include/string.h
R 12651 /usr/include/strings.h
R 12651 /usr/include/time.h
R 12651 /usr/include/unistd.h


# ls -aC1
/usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/tmp/legacy/usr/include/machine/
| grep '\.h$'
elf.h
exec.h
reloc.h

vs.

# grep ' /usr/include/machine/'
/usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/lib/libpmc/pmu-events/jevents.pieo.meta
| sort -u
R 12651 /usr/include/machine/_limits.h
R 12651 /usr/include/machine/_types.h
R 12651 /usr/include/machine/endian.h
R 12651 /usr/include/machine/param.h
R 12651 /usr/include/machine/signal.h


# ls -aC1
/usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/tmp/legacy/usr/include/sys/
| grep '\.h$'
_decls.h
_nv.h
_visible.h
bitstring.h
cdefs.h
cnv.h
consio.h
ctf.h
dnv.h
elf.h
elf32.h
elf64.h
elf_common.h
elf_generic.h
fnv_hash.h
font.h
imgact_aout.h
kbio.h
md4.h
md5.h
module.h
nlist_aout.h
nv.h
nv_namespace.h
queue.h
sbuf.h
tree.h

vs.

# grep ' /usr/include/sys/'
/usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/lib/libpmc/pmu-events/jevents.pieo.meta
| sort -u
R 12651 /usr/include/sys/_align.h
R 12651 /usr/include/sys/_clock_id.h
R 12651 /usr/include/sys/_endian.h
R 12651 /usr/include/sys/_maxphys.h
R 12651 /usr/include/sys/_null.h
R 12651 /usr/include/sys/_offsetof.h
R 12651 /usr/include/sys/_param.h
R 12651 /usr/include/sys/_pthreadtypes.h
R 12651 /usr/include/sys/_sigaltstack.h
R 12651 /usr/include/sys/_sigset.h
R 12651 /usr/include/sys/_sigval.h
R 12651 /usr/include/sys/_stdarg.h
R 12651 /usr/include/sys/_stdint.h
R 12651 /usr/include/sys/_timespec.h
R 12651 /usr/include/sys/_timeval.h
R 12651 /usr/include/sys/_types.h
R 12651 /usr/include/sys/bitcount.h
R 12651 /usr/include/sys/dirent.h
R 12651 /usr/include/sys/limits.h
R 12651 /usr/include/sys/param.h
R 12651 /usr/include/sys/resource.h
R 12651 /usr/include/sys/select.h
R 12651 /usr/include/sys/signal.h
R 12651 /usr/include/sys/stat.h
R 12651 /usr/include/sys/syslimits.h
R 12651 /usr/include/sys/time.h
R 12651 /usr/include/sys/timespec.h
R 12651 /usr/include/sys/types.h
R 12651 /usr/include/sys/unistd.h


# ls -aC1
/usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/tmp/legacy/usr/include/xlocale/
| grep '\.h$'
ls:
/usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/tmp/legacy/usr/include/xlocale/:
No such file or directory

vs.

# grep ' /usr/include/xlocale/'
/usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/arm64.aarch64/lib/libpmc/pmu-events/jevents.pieo.meta
| sort -u
R 12651 /usr/include/xlocale/_ctype.h
R 12651 /usr/include/xlocale/_string.h
R 12651 /usr/include/xlocale/_strings.h
R 12651 /usr/include/xlocale/_time.h


I do not know enough to classify each each /usr/include/ prefixed file
as should-be-host/older-freebsd vs. should-be-newer-freebsd but some are
clear to me based on the specific failure, such as:

R 12651 /usr/include/fts.h
R 12651 /usr/include/ftw.h

There could well be more of them that should be under
legacy/usr/include/ someplace in order for jevents to be a always-valid
build-tool.

A similar comparison/constrast for other programs showing /usr/include/
prefixed paths in .meta files could be appropriate.


-- 
===
Mark Millard
marklmi at yahoo.com