https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/ Issue: sys-boot/tboot-1.10.3 fails to compile. Discovered on: amd64 (internal ref: tinderbox) NOTE: This machine uses CLANG as a compiler and LLD as a linker
Created attachment 763577 [details] build.log build log and emerge --info
I don't think its feasible for Gentoo to support clang for this package. The initial problems - the missing headers (stdbool.h and stdarg.h)- are easy to fix. However, even if those fixed, there are more errors: clang -Wall -Wformat-security -Wstrict-prototypes -Wextra -Winit-self -Wswitch-default -Wunused-parameter -Wwrite-strings -Wno-missing-field-initializers -Wno-address-of-packed-member -fno-strict-aliasing -std=gnu99 -Wno-array-bounds -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -m32 -I/var/tmp/portage/sys-boot/tboot-1.10.3/work/tboot-1.10.3/safestringlib/include -march=i686 -nostdinc -fno-builtin -fno-common -fno-strict-aliasing -fomit-frame-pointer -pipe -iwithprefix include -I/var/tmp/portage/sys-boot/tboot-1.10.3/work/tboot-1.10.3/tboot/include -I/var/tmp/portage/sys-boot/tboot-1.10.3/work/tboot-1.10.3/include -msoft-float -fno-stack-protector -fno-stack-check -DTBOOT_CHANGESET=\""2021-12-08 16:00 +0100 1.10.3"\" -DPOLY1305_ASM -DOPENSSL_IA32_SSE2 -c common/com.c -o common/com.o common/boot.S:247:2: error: ambiguous instructions require an explicit suffix (could be 'cmpb', 'cmpw', or 'cmpl') cmp $0, (aps_exit_guest) ^ This one probably easy to fix too. ps_exit_guest is defined (in tboot/txt/vmcs.c) as a uint32, so its simply a matter of picking the right suffix. But then if THAT is patched, it gets a little further until: clang -Wall -Wformat-security -Wstrict-prototypes -Wextra -Winit-self -Wswitch-default -Wunused-parameter -Wwrite-strings -Wno-missing-field-initializers -Wno-address-of-packed-member -fno-strict-aliasing -std=gnu99 -Wno-array-bounds -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -m32 -I/var/tmp/portage/sys-boot/tboot-1.10.3/work/tboot-1.10.3/safestringlib/include -march=i686 -nostdinc -fno-builtin -fno-common -fno-strict-aliasing -fomit-frame-pointer -pipe -iwithprefix include -I/var/tmp/portage/sys-boot/tboot-1.10.3/work/tboot-1.10.3/tboot/include -I/var/tmp/portage/sys-boot/tboot-1.10.3/work/tboot-1.10.3/include -msoft-float -fno-stack-protector -fno-stack-check -DTBOOT_CHANGESET=\""2021-12-08 16:00 +0100 1.10.3"\" -DPOLY1305_ASM -DOPENSSL_IA32_SSE2 -c common/integrity.c -o common/integrity.o common/integrity.c:146:19: error: fields must have a constant size: 'variable length array in structure' extension will never be supported uint8_t secrets[secrets_size]; ^ common/integrity.c:174:19: error: fields must have a constant size: 'variable length array in structure' extension will never be supported uint8_t secrets[secrets_size]; ^ 2 errors generated. This is a VLAIS that clang will never implement, and must be rewritten. However, this is freestanding code (no malloc or alloca) so doing so is nontrivial.
Thanks for your analysis, I agree with your conclusions. Let's add a pkg_setup check to bail if CC is Clang.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5872ad7b37126df3e8897f3db41e3853e6840d99 commit 5872ad7b37126df3e8897f3db41e3853e6840d99 Author: Christopher Byrne <salah.coronya@gmail.com> AuthorDate: 2022-02-07 20:17:58 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2022-02-09 11:23:36 +0000 sys-boot/tboot: Die if tc-is-clang. Requires VLAIS which is gcc-only. Closes: https://bugs.gentoo.org/832020 Package-Manager: Portage-3.0.30, Repoman-3.0.3 Signed-off-by: Christopher Byrne <salah.coronya@gmail.com> Closes: https://github.com/gentoo/gentoo/pull/24119 Signed-off-by: Sam James <sam@gentoo.org> sys-boot/tboot/tboot-1.10.3.ebuild | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)