Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 832020 - sys-boot/tboot-1.10.3 fails to compile: acpi.c:36:10: fatal error: stdbool.h file not
Summary: sys-boot/tboot-1.10.3 fails to compile: acpi.c:36:10: fatal error: stdbool.h ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Jason Zaman
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2022-01-25 08:40 UTC by Agostino Sarubbo
Modified: 2022-02-09 11:25 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,55.58 KB, text/plain)
2022-01-25 08:40 UTC, Agostino Sarubbo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2022-01-25 08:40:06 UTC
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
Comment 1 Agostino Sarubbo gentoo-dev 2022-01-25 08:40:08 UTC
Created attachment 763577 [details]
build.log

build log and emerge --info
Comment 2 Christopher Byrne 2022-02-06 04:55:19 UTC
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.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-02-07 04:06:58 UTC
Thanks for your analysis, I agree with your conclusions. Let's add a pkg_setup check to bail if CC is Clang.
Comment 4 Larry the Git Cow gentoo-dev 2022-02-09 11:25:09 UTC
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(-)