From 9b8fe84ece6844c0863fc300bb714efc0f179c1a Mon Sep 17 00:00:00 2001 From: Ryan Northey Date: Fri, 12 Dec 2025 12:54:10 +0000 Subject: [PATCH] build: Pass env CFLAGS through to make In our (envoy) build we use a sysroot to ensure hermetic builds. This fixes a problem where configure is passed the sysroot flag and detects kernel headers for openat2.h but then make doesnt have the sysroot and fails. Signed-off-by: Ryan Northey --- configure | 6 ++++-- src/Makefile | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 848aa7bd2..81d58760e 100755 --- a/configure +++ b/configure @@ -120,8 +120,9 @@ print_config() { } # Default CFLAGS -CFLAGS="-D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -include config-host.h" -BUILD_CFLAGS="" +ENV_CFLAGS="${CFLAGS}" +CFLAGS="${CFLAGS:+$CFLAGS }-D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -include config-host.h" +BUILD_CFLAGS="${ENV_CFLAGS}" # Print configure header at the top of $config_host_h echo "/*" > $config_host_h @@ -588,6 +589,7 @@ fi echo "CC=$cc" >> $config_host_mak print_config "CC" "$cc" echo "CXX=$cxx" >> $config_host_mak +echo "BUILD_CFLAGS=$BUILD_CFLAGS" >> $config_host_mak print_config "CXX" "$cxx" # generate io_uring_version.h diff --git a/src/Makefile b/src/Makefile index 42e18773f..7febcf3c2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -13,6 +13,7 @@ override CPPFLAGS += -D_GNU_SOURCE \ CFLAGS ?= -O3 -Wall -Wextra -fno-stack-protector override CFLAGS += -Wno-unused-parameter \ -DLIBURING_INTERNAL \ + $(BUILD_CFLAGS) \ $(LIBURING_CFLAGS) SO_CFLAGS=-fPIC $(CFLAGS) L_CFLAGS=$(CFLAGS)