Skip to contentSkip to conversation

uboot: ensure host includes are searched before system default includes

PATCH New Peter Korsgaard 2 participants 3 messages Mar 1, 2018 – Mar 2, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uboot: ensure host includes are searched before system default includes

Commit baae5156ce37e (uboot: use local fdt headers) changed the uboot logic to pass the host include directories with -idirafter instead of -I, so include files local to u-boot would be preferred over host includes.

This unfortunately breaks configurations using BR2_TARGET_UBOOT_NEEDS_OPENSSL on hosts with incompatible openssl headers installed in the system default include directories as explained here:

http://lists.busybox.net/pipermail/buildroot/2018-March/214651.html

The problem is that -idirafter directories gets added to the very end of the search order, AFTER the system default directories.

Instead use -isystem which causes the directories to be added after -I but before the system default directories. With this in place, the include directories of u-boot will first be scanned, followed by the host includes and finally the system default include directories.

---
 boot/uboot/uboot.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
boot/uboot/uboot.mk +1 -1
index c7cd739150..5da339850d 100644
@@ -131,7 +131,7 @@ endif
 UBOOT_MAKE_OPTS += \
 	CROSS_COMPILE="$(TARGET_CROSS)" \
 	ARCH=$(UBOOT_ARCH) \
-	HOSTCC="$(HOSTCC) $(subst -I/,-idirafter /,$(subst -I /,-idirafter /,$(HOST_CFLAGS)))" \
+	HOSTCC="$(HOSTCC) $(subst -I/,-isystem /,$(subst -I /,-isystem /,$(HOST_CFLAGS)))" \
 	HOSTLDFLAGS="$(HOST_LDFLAGS)"
 
 ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31),y)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 uboot: ensure host includes are searched before system default includes

Quoted 15 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

Commit baae5156ce37e (uboot: use local fdt headers) changed the uboot logic to pass the host include directories with -idirafter instead of -I, so include files local to u-boot would be preferred over host includes.

This unfortunately breaks configurations using BR2_TARGET_UBOOT_NEEDS_OPENSSL on hosts with incompatible openssl headers installed in the system default include directories as explained here:

http://lists.busybox.net/pipermail/buildroot/2018-March/214651.html

The problem is that -idirafter directories gets added to the very end of the search order, AFTER the system default directories.

Quoted 6 lines

Instead use -isystem which causes the directories to be added after -I but before the system default directories. With this in place, the include directories of u-boot will first be scanned, followed by the host includes and finally the system default include directories.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH 1/1 uboot: ensure host includes are searched before system default includes

In reply to Peter Korsgaard
Quoted 13 lines · Peter Korsgaard

Commit baae5156ce37e (uboot: use local fdt headers) changed the uboot logic to pass the host include directories with -idirafter instead of -I, so include files local to u-boot would be preferred over host includes.

This unfortunately breaks configurations using BR2_TARGET_UBOOT_NEEDS_OPENSSL on hosts with incompatible openssl headers installed in the system default include directories as explained here:

http://lists.busybox.net/pipermail/buildroot/2018-March/214651.html

The problem is that -idirafter directories gets added to the very end of the search order, AFTER the system default directories.

Quoted 6 lines

Instead use -isystem which causes the directories to be added after -I but before the system default directories. With this in place, the include directories of u-boot will first be scanned, followed by the host includes and finally the system default include directories.