Re: sysbuild of netbsd-10 from netbsd-10 fails after upgrade of itself

Brian Buhrow <[email protected]>
Newsgroups gmane.os.netbsd.current,gmane.os.netbsd.general
Message-ID <[email protected]>
	hello.  I think this is the same issue I wrote about last week trying to build 9.99.77 on
a 10.99.12 system.
-thanks
-Brian

On Oct 7,  2:43pm, "Greg A. Woods" wrote:
} Subject: sysbuild of netbsd-10 from netbsd-10 fails after upgrade of itsel
} --pgp-sign-Multipart_Tue_Oct__7_14:43:48_2025-1
} Content-Type: text/plain; charset=US-ASCII
} Content-Transfer-Encoding: quoted-printable
} 
} [[ I'm not sure where to direct this, so I'm CCing current-users... ]]
} 
} I've been running sysbuild daily on a stock NetBSD/i386-10.0 system
} since 2024/08/09.  There have been very few failures since then and none
} without obvious related changes coming from CVS, and they've all
} resolved themselves with subsequent updates.
} 
} Yesterday (2024/10/06) I finally did an upgrade of the system itself
} from yesterday's build, and this morning I find the following failure in
} the latest log:
} 
} #      link  binstall/xinstall
} cc -O -I/home/sysbuild/i386/obj/home/sysbuild/src/tools/compat -I/home/sysb=
} uild/i386/obj/home/sysbuild/src/tools/compat/include -I/home/sysbuild/src/t=
} ools/compat -DHAVE_NBTOOL_CONFIG_H=3D1 -D_FILE_OFFSET_BITS=3D64 -I/home/sys=
} build/src/tools/binstall/../compat/sys -DTARGET_STRIP=3D\"/home/sysbuild/i3=
} 86/tools/bin/i486--netbsdelf-strip\" -I/home/sysbuild/src/usr.sbin/mtree   =
} -o xinstall xinstall.lo getid.lo -L/home/sysbuild/i386/obj/home/sysbuild/sr=
} c/tools/compat -lnbcompat -lrt -lz
} ld: /home/sysbuild/i386/obj/home/sysbuild/src/tools/compat/libnbcompat.a(sh=
} a2.lo): in function `SHA256_Transform':
} sha2.c:(.text+0x11b): undefined reference to `be32dec'
} ld: /home/sysbuild/i386/obj/home/sysbuild/src/tools/compat/libnbcompat.a(sh=
} a2.lo): in function `SHA224_256_Final':
} sha2.c:(.text+0x4fe): undefined reference to `be32enc'
} ld: /home/sysbuild/i386/obj/home/sysbuild/src/tools/compat/libnbcompat.a(sh=
} a2.lo): in function `SHA512_Transform':
} sha2.c:(.text+0xaf9): undefined reference to `be64dec'
} ld: /home/sysbuild/i386/obj/home/sysbuild/src/tools/compat/libnbcompat.a(sh=
} a2.lo): in function `SHA512_Final':
} sha2.c:(.text+0x1665): undefined reference to `be64enc'
} ld: /home/sysbuild/i386/obj/home/sysbuild/src/tools/compat/libnbcompat.a(sh=
} a2.lo): in function `SHA384_Final':
} sha2.c:(.text+0x1824): undefined reference to `be64enc'
} *** Failed target: xinstall
} *** Failed commands:
}         ${_MKTARGET_LINK}
}         =3D> @echo '#  ' "   link " binstall/xinstall
}         ${HOST_LINK.c} ${HOST_LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}
}         =3D> cc -O -I/home/sysbuild/i386/obj/home/sysbuild/src/tools/compat=
}  -I/home/sysbuild/i386/obj/home/sysbuild/src/tools/compat/include -I/home/s=
} ysbuild/src/tools/compat -DHAVE_NBTOOL_CONFIG_H=3D1 -D_FILE_OFFSET_BITS=3D6=
} 4 -I/home/sysbuild/src/tools/binstall/../compat/sys -DTARGET_STRIP=3D\"/hom=
} e/sysbuild/i386/tools/bin/i486--netbsdelf-strip\" -I/home/sysbuild/src/usr.=
} sbin/mtree   -o xinstall xinstall.lo getid.lo -L/home/sysbuild/i386/obj/hom=
} e/sysbuild/src/tools/compat -lnbcompat -lrt -lz
} *** [xinstall] Error code 1
} nbmake[7]: stopped in /home/sysbuild/src/tools/binstall
} 1 error
} 
} 
} 
} There were no related source changes in the daily "cvs update", but this
} is part of the tools build, so I assume it's something that changed
} during the upgrade.
} 
} My libnbcompat.a is not stale -- it was rebuilt today.  Indeed the
} object causing the failure was also rebuilt today:
} 
} $ ll /home/sysbuild/i386/obj/home/sysbuild/src/tools/compat/sha2.lo
} 24 -rw-r--r--  1 sysbuild  sysbuild  10500 Oct  7 00:20 /home/sysbuild/i386=
} /obj/home/sysbuild/src/tools/compat/sha2.lo
} 
} 
} Those beNNXXc() functions should be inlined, I think -- they are defined
} in <sys/endian.h> via a set of macros for any compiler since gcc-2.95.
} 
} However they do not get inlined:
} 
} $ nm /home/sysbuild/i386/obj/home/sysbuild/src/tools/compat/sha2.lo
} 00000340 r K256
} 00000080 r K512
} 000002d5 t SHA224_256_Final
} 00000914 T SHA224_Final
} 00000834 T SHA224_Init
} 000008f8 T SHA224_Transform
} 000008d5 T SHA224_Update
} 0000081f T SHA256_Final
} 00000000 T SHA256_Init
} 000000a1 T SHA256_Transform
} 0000056e T SHA256_Update
} 000017ef T SHA384_Final
} 000016bd T SHA384_Init
} 000017d3 T SHA384_Transform
} 000017b0 T SHA384_Update
} 00001630 T SHA512_Final
} 00000929 T SHA512_Init
} 00000fec t SHA512_Last
} 00000a1c T SHA512_Transform
} 000012ad T SHA512_Update
}          U be32dec
}          U be32enc
}          U be64dec
}          U be64enc
} 00000320 r sha224_initial_hash_value
} 00000300 r sha256_initial_hash_value
} 00000040 r sha384_initial_hash_value
} 00000000 r sha512_initial_hash_value
} 
} 
} =46rom a little earlier in the build log I see that indeed the inline
} definitions were not used:
} 
} #   compile  compat/sha2.lo
} cc -O   -I. -I./include -I/home/sysbuild/src/tools/compat -I/home/sysbuild/=
} src/tools/compat/sys  -DHAVE_NBTOOL_CONFIG_H=3D1 -D_FILE_OFFSET_BITS=3D64 -=
} I. -I./include -I/home/sysbuild/src/tools/compat -I/home/sysbuild/src/tools=
} /compat/sys -DHAVE_NBTOOL_CONFIG_H=3D1 -D_FILE_OFFSET_BITS=3D64 -D__DBINTER=
} FACE_PRIVATE -c -o sha2.lo.o    /home/sysbuild/src/tools/compat/../../commo=
} n/lib/libc/hash/sha2/sha2.c
} /home/sysbuild/src/tools/compat/../../common/lib/libc/hash/sha2/sha2.c: In =
} function 'SHA256_Transform':
} /home/sysbuild/src/tools/compat/../../common/lib/libc/hash/sha2/sha2.c:388:=
} 13: warning: implicit declaration of function 'be32dec' [-Wimplicit-functio=
} n-declaration]
}   388 |   W256[j] =3D be32dec(data);
}       |             ^~~~~~~
} /home/sysbuild/src/tools/compat/../../common/lib/libc/hash/sha2/sha2.c: In =
} function 'SHA224_256_Final':
} /home/sysbuild/src/tools/compat/../../common/lib/libc/hash/sha2/sha2.c:564:=
} 4: warning: implicit declaration of function 'be32enc' [-Wimplicit-function=
} -declaration]
}   564 |    be32enc(digest + 4 * i, context->state[i]);
}       |    ^~~~~~~
} /home/sysbuild/src/tools/compat/../../common/lib/libc/hash/sha2/sha2.c: In =
} function 'SHA512_Transform':
} /home/sysbuild/src/tools/compat/../../common/lib/libc/hash/sha2/sha2.c:729:=
} 13: warning: implicit declaration of function 'be64dec' [-Wimplicit-functio=
} n-declaration]
}   729 |   W512[j] =3D be64dec(data);
}       |             ^~~~~~~
} /home/sysbuild/src/tools/compat/../../common/lib/libc/hash/sha2/sha2.c: In =
} function 'SHA512_Final':
} /home/sysbuild/src/tools/compat/../../common/lib/libc/hash/sha2/sha2.c:912:=
} 4: warning: implicit declaration of function 'be64enc' [-Wimplicit-function=
} -declaration]
}   912 |    be64enc(digest + 8 * i, context->state[i]);
}       |    ^~~~~~~
} 
} 
} So this appears to be due to fallout from the following change:
} 
} 
} revision 1.31.4.2
} date: 2025-04-12 05:56:47 -0700;  author: martin;  state: Exp;  lines: +16 =
} -16;  commitid: yyI3PgWxFB7QjLQF;
} Pull up following revision(s) (requested by rin in ticket #1095):
} 
} 	sys/sys/endian.h: revision 1.36
} 	sys/sys/endian.h: revision 1.37
} 
} endian.h: Consistently use __CAST() where appropriate, NFC
} 
} In preparation for PR lib/57478
} endian.h: Cast to suitable type when byte order conversion is NOP
} 
} Otherwise, e.g., following examples do not work as expected on
} big-endian machines:
} - printf("%x\n", ntohl(0x01234567890abcdefULL);
} - uint64_t u64 =3D ntohl(0x01234567890abcdefULL);
} - etc.
} 
} Fix PR lib/57478
} 
} I've been tested this patch both on big-/little-endian and
} LP64/ILP32 environments over a year without troubles.
} 
} 
} But I don't understand why!  It's looking more like a compiler bug!
} 
} When I look at the post-CPP output of the compiler for sha2.c I find
} that it drops out of including <machine/bswap.h> and suddenly instead of
} continuing in <sys/endian.h> it is jumping into <i386/endian.h> and then
} on to <sys/types.h>!!!:
} 
} # 12 "/usr/include/i386/bswap.h" 2 3 4
} # 110 "/usr/include/sys/endian.h" 2 3 4
} # 4 "/usr/include/i386/endian.h" 2 3 4
} # 99 "/usr/include/sys/types.h" 2 3 4
} 
} There is obviously no include of <machine/endian.h> or <i386/endian.h>
} after line 100 of <sys/endian.h>!  In fact there are no more #include
} lines in <sys/endian.h> after the include of <machine/bswap.h>.  Where
} did the rest of <sys/endian.h> go?!?!??
} 
} 
} That's from:
} 
} cc -E -I. -I./include -I/home/sysbuild/src/tools/compat -I/home/sysbuild/sr=
} c/tools/compat/sys  -DHAVE_NBTOOL_CONFIG_H=3D1 -D_FILE_OFFSET_BITS=3D64 -I.=
}  -I./include -I/home/sysbuild/src/tools/compat -I/home/sysbuild/src/tools/c=
} ompat/sys -DHAVE_NBTOOL_CONFIG_H=3D1 -D_FILE_OFFSET_BITS=3D64 -D__DBINTERFA=
} CE_PRIVATE   /home/sysbuild/src/tools/compat/../../common/lib/libc/hash/sha=
} 2/sha2.c 2>&1 | less
} 
} I'm at a loss.
} 
} --=20
} 					Greg A. Woods <[email protected]>
} 
} Kelowna, BC     +1 250 762-7675           RoboHack <[email protected]>
} Planix, Inc. <[email protected]>     Avoncote Farms <[email protected]>
} 
} --pgp-sign-Multipart_Tue_Oct__7_14:43:48_2025-1
} Content-Type: application/pgp-signature
} Content-Transfer-Encoding: 7bit
} Content-Description: OpenPGP Digital Signature
} 
} -----BEGIN PGP SIGNATURE-----
} 
} iF0EABECAB0WIQRuK6dmwVAucmRxuh9mfXG3eL/0fwUCaOWJlwAKCRBmfXG3eL/0
} f61AAKDWtsTyXdT+jsSolgvmIVWeKH+HPgCgl0PJz61Yac6UlLWikLhzBx6A7Yg=
} =bdWQ
} -----END PGP SIGNATURE-----
} 
} --pgp-sign-Multipart_Tue_Oct__7_14:43:48_2025-1--
>-- End of excerpt from "Greg A. Woods"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.