the default ebuild for gnu-efi skips compiling and installing the example efi apps, some of which are very helpful (modelist.efi).
3.0.17 installs the efi apps.
3.0.17 and higher are crashing during compilation of the efi apps with error: make[1]: Entering directory '/tmp/portage/sys-boot/gnu-efi-3.0.18-r1/work/gnu-efi-3.0.18/x86_64/apps' x86_64-pc-linux-gnu-gcc -I/tmp/portage/sys-boot/gnu-efi-3.0.18-r1/work/gnu-efi-3.0.18//apps -I/tmp/portage/sys-boot/gnu-efi-3.0.18-r1/work/gnu-efi-3.0.18//apps/../inc -I/tmp/portage/sys-boot/gnu-efi-3.0.18-r1/work/gnu-efi-3.0.18//apps/../inc/x86_64 -I/tmp/portage/sys-boot/gnu-efi-3.0.18-r1/work/gnu-efi-3.0.18//apps/../inc/protocol -Wno-error=pragmas -mno-red-zone -mno-avx -fPIE -g -O2 -Wall -Wextra -Wno-pointer-sign -funsigned-char -fshort-wchar -fno-strict-aliasing -ffreestanding -fno-stack-protector -fno-stack-check -fno-merge-all-constants -DCONFIG_x86_64 -std=c11 -DGNU_EFI_USE_MS_ABI -maccumulate-outgoing-args -D__KERNEL__ -I/usr/src/sys/build/include -c /tmp/portage/sys-boot/gnu-efi-3.0.18-r1/work/gnu-efi-3.0.18//apps/t.c -o t.o cc1: error: /usr/src/sys/build/include: Permission denied make[1]: *** [/tmp/portage/sys-boot/gnu-efi-3.0.18-r1/work/gnu-efi-3.0.18//apps/../Make.rules:54: t.o] Error 1 due this code in apps/Makefile: LINUX_HEADERS = /usr/src/sys/build ... CPPFLAGS += -D__KERNEL__ -I$(LINUX_HEADERS)/include In Gentoo linux headers are installed into /usr/include directory. After modification of path in LINUX_HEADERS to correct value for Gentoo, apps are compiled successfully.
Created attachment 894756 [details, diff] patch to compile gnu-efi apps in gentoo
Created attachment 897911 [details, diff] remove LINUX_HEADERS Normally if /usr/src/sys/build/include does not exist, it is harmless. You have something along that path that crashes your compilation. Your patch adds /usr/include to the include dirs, which is the default anyway. I think a better patch would be to simply remove LINUX_HEADERS altogether. Can you try this one?
You are right, removing LINUX_HEADERS solved the problem. CPPFLAGS can remain.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a27c3eccc447347e96c31fd03795f3ee354c2f65 commit a27c3eccc447347e96c31fd03795f3ee354c2f65 Author: Viorel Munteanu <ceamac@gentoo.org> AuthorDate: 2024-08-02 04:49:29 +0000 Commit: Viorel Munteanu <ceamac@gentoo.org> CommitDate: 2024-08-02 04:53:06 +0000 sys-boot/gnu-efi: fix building efi apps Remove an include directory missing on most systems. Closes: https://bugs.gentoo.org/888829 Signed-off-by: Viorel Munteanu <ceamac@gentoo.org> .../files/gnu-efi-3.0.18-remove-linux-headers.patch | 14 ++++++++++++++ sys-boot/gnu-efi/gnu-efi-3.0.18-r3.ebuild | 1 + 2 files changed, 15 insertions(+)