Re: poudriere-devel based aarch64 llvm16-16.0.0.r3 build got: bad make -VBE_FREEBSD_PLIST_FILES result leads to "pkg-static: pkg_checksum_hash_sha256_file(read failed): Is a directory"

From: Mark Millard <marklmi_at_yahoo.com>
Date: Mon, 06 Mar 2023 01:12:50 UTC
[I found a related partial edit in the llvm16 Makefile.]

On Mar 5, 2023, at 15:53, Mark Millard <marklmi@yahoo.com> wrote:

> [Looks like the problem is not on the pkg side of things.
> I adjusted the subject to indicate the newly identified
> context as well.]
> 
> On Mar 5, 2023, at 01:52, Mark Millard <marklmi@yahoo.com> wrote:
> 
>> On Mar 5, 2023, at 00:03, Mark Millard <marklmi@yahoo.com> wrote:
>> 
>>> My poudriere-devel based ports update got:
>>> 
>>> =======================<phase: package        >============================
>>> . . .
>>> ===>  Building package for llvm16-16.0.0.r3
>>> pkg-static: pkg_checksum_hash_sha256_file(read failed): Is a directory
>>> *** Error code 1
>>> 
>>> Stop.
>>> make: stopped in /usr/ports/devel/llvm16
>>> 
>>> FYI: This was my first time attempting to build llvm16
>>> as one of the ports.
>>> 
>>> I see that, for example,
>>> 
>>> http://ampere3.nyi.freebsd.org/build.html?mastername=131arm64-default&build=d0f8db852755
>>> 
>>> reports success with building (and, so, packaging)
>>> llvm16-16.0.0.r3 . I've no clue why the distinction.
>>> 
>>> For reference:
>>> 
>>> port directory: /usr/ports/devel/llvm16
>>> package name: llvm16-16.0.0.r3
>>> building for: FreeBSD CA72_ZFS 13.1-RELEASE-p7 FreeBSD 13.1-RELEASE-p7 arm64
>>> . . .
>>> Poudriere version: poudriere-git-3.3.99.20220831
>>> Host OSVERSION: 1400081
>>> Jail OSVERSION: 1301000
>>> 
>>> Of 227 ports, this was the only one to fail to build.
>>> llvm15 and gcc12 were built.
>>> 
>>> This was on a HoneyComb (16 Cortex-A72's).
>>> 
>>> poudriere-devel is now building ports, targeting main
>>> instead of targeting releng/13.1 . We will see how
>>> that goes building the same 227 ports.
>>> 
>>> It will be some time before I'll retest building for
>>> releng/13.1 in order to check on repeatability.
>>> 
>>> # uname -apKU
>>> FreeBSD CA72_16Gp_ZFS 14.0-CURRENT FreeBSD 14.0-CURRENT #88 main-n261230-e78dc78e517a-dirty: Wed Mar  1 16:17:45 PST 2023     root@CA72_16Gp_ZFS:/usr/obj/BUILDs/main-CA72-nodbg-clang/usr/main-src/arm64.aarch64/sys/GENERIC-NODBG-CA72 arm64 aarch64 1400081 1400081
>>> 
>> 
>> The build for main also failed.
>> 
>> One difference in my build vs. the FreeBSD build
>> servers is the use of BE_NATIVE instead of
>> BE_STANDARD . May be the pkg-plist is mishandled
>> for BE_NATIVE ?
> 
> I think I finally figured out what to look at to see
> the basic problem for devel/llvm16 used via BE_NATIVE
> for aarch64 (and, so, arm* as well).
> 
> In the below, note the "llvm16/lib/clang/16/include/"
> which is a directory
> 
> # make -VBE_NATIVE_PLIST_FILES
> llvm16/lib/libLLVMAArch64AsmParser.a llvm16/lib/libLLVMAArch64CodeGen.a llvm16/lib/libLLVMAArch64Desc.a llvm16/lib/libLLVMAArch64Disassembler.a llvm16/lib/libLLVMAArch64Info.a llvm16/lib/libLLVMAArch64Utils.a llvm16/lib/libLLVMAMDGPUAsmParser.a llvm16/lib/libLLVMAMDGPUCodeGen.a llvm16/lib/libLLVMAMDGPUDesc.a llvm16/lib/libLLVMAMDGPUDisassembler.a llvm16/lib/libLLVMAMDGPUInfo.a llvm16/lib/libLLVMAMDGPUTargetMCA.a llvm16/lib/libLLVMAMDGPUUtils.a llvm16/lib/libLLVMExegesisAArch64.a llvm16/lib/libLLVMWebAssemblyAsmParser.a llvm16/lib/libLLVMWebAssemblyCodeGen.a llvm16/lib/libLLVMWebAssemblyDesc.a llvm16/lib/libLLVMWebAssemblyDisassembler.a llvm16/lib/libLLVMWebAssemblyInfo.a llvm16/lib/libLLVMWebAssemblyUtils.a  llvm16/lib/clang/16/include/
> 
> (For reference, llvm15 does not end up with a llvm15/lib/clang/15/include/ listed.)
> 
> By contrast for llvm16, -VBE_FREEBSD_PLIST_FILES ends up listing explicit files
> inside the directory:
> 
> . . . llvm16/lib/clang/16/include/arm_bf16.h llvm16/lib/clang/16/include/arm_cde.h llvm16/lib/clang/16/include/arm_fp16.h llvm16/lib/clang/16/include/arm_mve.h llvm16/lib/clang/16/include/arm_neon.h llvm16/lib/clang/16/include/arm_sve.h llvm16/lib/clang/16/include/riscv_vector.h
> 
> It would appear to me that the llvm16/lib/clang/16/include/arm_*.h files possibly
> be present for AArch64 because of its coverage of arm* as well, just like for
> BE_FREEBSD . (But such does not seem to be the case for devel/llvm15 's 
> BE_NATIVE either, so I may be wrong. For both llvm16 and llvm15 , _NATIVE_BACKENDS
> does not list ARM for aarch64 , just AArch64 . I do not know why since armv7 is
> listed in kern.supported_archs: aarch64 armv7 .)
> 
> I'll note that there is no _BE_INCS_AArch64 in the Makefile (both llvm16 and llvm15)
> and there is:
> 
> .for BE in FREEBSD NATIVE STANDARD
> .for BE_ARCH in ${${BE}_BACKENDS}
> _BE_LIBS_${BE}+=        ${_BE_LIBS_COMMON:S/^/${BE_ARCH}/} \
>                        ${_BE_LIBS_${BE_ARCH}:S/^/${BE_ARCH}/} \
>                        ${_BE_LIBS_BACKWARDS_${BE_ARCH}:S/$/${BE_ARCH}/}
> _BE_INCS_${BE}+=        ${_BE_INCS_${BE_ARCH}}
> .endfor
> .endfor
> 
> but NATIVE_BACKENDS excludes ARM (in both llvm16 and llvm15).
> 
> At least the "llvm16/lib/clang/16/include/" (no file listed) for
> -VBE_NATIVE_PLIST_FILES should be eliminated. Possibly the arm_*.h
> files under that path should be present.

Only the first instance of LLVM_RELEASE from llvm15 has been
replaced by LLVM_MAJOR in the below text from the Makefile.
So the :N part does not look for the right thing for llvm16:
(whitespace may not have been preserved via the E-mail)

.for BE in FREEBSD NATIVE STANDARD
BE_${BE}_PLIST_FILES=   ${_BE_LIBS_${BE}:O:S/$/.a/:S|^|${LLVM_DIR}/lib/libLLVM|} \
                       ${_BE_INCS_${BE}:S|^|${LLVM_DIR}/lib/clang/${LLVM_MAJOR}/include/|:N${LLVM_DIR}/lib/clang/${LLVM_RELEASE}/include/$}
.endfor

The LLVM_RELELASE should be LLVM_MAJOR instead.

===
Mark Millard
marklmi at yahoo.com