Issue #663 has been updated by Maximilian Brune.

This is likely a yet again problem with the coreboot toolchains (GCC 15) trying 
to build other projects (e.g. payloads like grub).
I have the same issue as you. But when I use my host toolchain (GCC 15 also) by 
using my host toolchain in the TARGET_CC parameter of the configure command in 
the grub build, it kinda works (gets much further than before). Nothing new. It 
happens regularly that the coreboot crosstoolchain can't build other projects 
for various reasons.
For reference I used the following commands manually (without makefile) to test 
it:
```
./bootstrap
./autogen.sh
cd build
../configure \
  CC="gcc" LD="/home/max/coreboot/util/crossgcc/xgcc/bin/i386-elf-ld.bfd" \
  FREETYPE="pkg-config freetype2" BUILD_FREETYPE="pkg-config freetype2" \
  TARGET_CC="/home/max/coreboot/util/crossgcc/xgcc/bin/i386-elf-gcc" \
  TARGET_OBJCOPY="/home/max/coreboot/util/crossgcc/xgcc/bin/i386-elf-objcopy" \
  TARGET_STRIP="/home/max/coreboot/util/crossgcc/xgcc/bin/i386-elf-strip" \
  CFLAGS=-O2 TARGET_CFLAGS="-Os -fno-reorder-functions" 
--with-platform=coreboot --enable-boot-time --disable-werror
make
make default_payload.elf
```
which resulted in the same error you have. Replacing TARGET_CC with my host 
toolchain kinda fixed it.

After that I ran AI on it, but I didn't really look more into it:
> AI CONTENT FOLLOWS (DON'T TAKE ANYTHING FOR GRANTED HERE)
> The short version: it's a GRUB type-mismatch bug, not a problem with your 
> crossgcc toolchain per se.
> What fails:
> The build dies compiling commands/pgp.c, which includes both of these headers:
> - include/grub/crypto.h declares the libgcrypt KDF/S-exp functions using 
> grub_size_t (e.g._gcry_kdf_open, _gcry_kdf_final, _gcry_sexp_build).
> - include/grub/gcrypt/gcrypt.h (vendored from upstream libgcrypt) declares 
> the same functions using plain size_t.
>
> So the compile only succeeds if size_t and grub_size_t are the same C type. 
> In GRUB, grub_size_t is grub_uint32_t = unsigned int 
> (include/grub/types.h:106,140).
> 
> Why the two toolchains behave differently:
> I checked __SIZE_TYPE__ for both compilers:
> Your crossgcc i386-elf-gcc is a bare-metal (freestanding) i386-elf target, 
> and GCC defines size_t as unsigned long there — both are 32-bit, but unsigned 
> long and unsigned int are distinct C types, so GCC emits conflicting types 
> for '_gcry_kdf_open' etc.
> When you pass host gcc as TARGET_CC, GRUB still targets coreboot/i386 (it 
> adds -m32), and host gcc's -m32 mode defines size_t as unsigned int, which 
> happens to match grub_size_t. That's why it gets "much further" — it's not 
> that host gcc is more capable, just that its size_t typedef coincides with 
> GRUB's.
>
> If you want to keep the crossgcc toolchain:
The proper fix is to make include/grub/gcrypt/gcrypt.h use grub_size_t for 
those prototypes (or #include <grub/types.h> / map size_t appropriately) 
instead of raw size_t. This is a known upstream GRUB 2.14 wart — those 
prototypes were imported from libgcrypt without being normalized to grub_size_t 
like the ones in crypto.h.
Want me to patch gcrypt.h to use grub_size_t so the crossgcc build succeeds?


Maybe that helps someone who has more time.
I would advise to always compile payloads separately (its what I usually do). 
Sorry that this is not really helpful, but I personally don't have time to dig 
deeper.

----------------------------------------
Bug #663: GRUB 2.14 does not build as a payload
https://ticket.coreboot.org/issues/663#change-2403

* Author: Oberon 4071
* Status: New
* Priority: Normal
* Target version: none
* Start date: 2026-08-16
* Affected versions: main
----------------------------------------
After the GRUB version has been updated to 2.14 (commit 
bcb8f01241101c36567c86680da6e11c8dafb558), GRUB no longer builds as a payload. 
GRUB is still able to build as a payload after downgrading it to 2.12 in my 
.config settings.

The relevant output demonstrating the error and .config are attached. Note that 
I configure gnulib to use a different folder to save bandwidth when building 
coreboot, but this does not affect the error that is generated.

Host operating system: Debian 13.6
Host GCC version: gcc (Debian 14.2.0-19) 14.2.0
crossgcc version: 2026-07-28_508d4deedd (i386)

---Files--------------------------------
_config (23.3 KB)
err.txt (137 KB)
defconfig (879 Bytes)


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
https://ticket.coreboot.org/my/account
_______________________________________________
coreboot mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to