Source: tboot Version: 1.10.5-5 Severity: wishlist Tags: ftbfs X-Debbugs-Cc: sudipm.mukher...@gmail.com
Dear Maintainer, tboot is failing to build in Ubuntu with the error: <command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror] This is because tboot source adds -D_FORTIFY_SOURCE=2 while building, and Ubuntu is adding -D_FORTIFY_SOURCE=3 to the buildflags and so a redefinition. The problem is not seen in Debian as Debian also builds with -D_FORTIFY_SOURCE=2 The attched patch is going to fix the problem, it will check if -D_FORTIFY_SOURCE is in the CFLAGLS or CPPFLGS or not and will -D_FORTIFY_SOURCE=2 if its not present. It will be really appreciated if the patch can be added. Thanks in advance. -- Regards Sudip
diff -Nru tboot-1.10.5/debian/changelog tboot-1.10.5/debian/changelog --- tboot-1.10.5/debian/changelog 2025-04-12 20:26:30.000000000 +0100 +++ tboot-1.10.5/debian/changelog 2025-05-12 07:21:06.000000000 +0100 @@ -1,3 +1,10 @@ +tboot (1.10.5-5.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Fix FTBFS due to redefinition of FORTIFY_SOURCE. + + -- Sudip Mukherjee <sudipm.mukher...@gmail.com> Mon, 12 May 2025 07:21:06 +0100 + tboot (1.10.5-5) unstable; urgency=medium * Fix test reboot-with-unsupported-hardware diff -Nru tboot-1.10.5/debian/patches/fortify-ftbfs.patch tboot-1.10.5/debian/patches/fortify-ftbfs.patch --- tboot-1.10.5/debian/patches/fortify-ftbfs.patch 1970-01-01 01:00:00.000000000 +0100 +++ tboot-1.10.5/debian/patches/fortify-ftbfs.patch 2025-05-12 07:21:06.000000000 +0100 @@ -0,0 +1,37 @@ +Description: Add _FORTIFY_SOURCE only if its not present in buildflags + +Author: Sudip Mukherjee <sudipm.mukher...@gmail.com> +Last-Update: 2025-05-12 +--- + +--- tboot-1.10.5.orig/Config.mk ++++ tboot-1.10.5/Config.mk +@@ -79,7 +79,12 @@ CFLAGS += $(call cc-option,$(CC),-Wno-ar + ifeq ($(debug),y) + CFLAGS += -g -DDEBUG + else +-CFLAGS += -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 ++CFLAGS += -O2 -U_FORTIFY_SOURCE ++ifeq ($(findstring D_FORTIFY_SOURCE, $(CFLAGS)),) ++ifeq ($(findstring D_FORTIFY_SOURCE, $(CPPFLAGS)),) ++CFLAGS += -D_FORTIFY_SOURCE=2 ++endif ++endif + endif + + ifeq ($(TARGET_ARCH),x86_64) +--- tboot-1.10.5.orig/safestringlib/makefile ++++ tboot-1.10.5/safestringlib/makefile +@@ -1,6 +1,11 @@ + IDIR = include + CC ?= gcc +-CFLAGS += -I$(IDIR) -fstack-protector-strong -fPIE -fPIC -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -DSTDC_HEADERS -Wno-implicit-fallthrough ++CFLAGS += -I$(IDIR) -fstack-protector-strong -fPIE -fPIC -O2 -Wformat -Wformat-security -DSTDC_HEADERS -Wno-implicit-fallthrough ++ifeq ($(findstring D_FORTIFY_SOURCE, $(CFLAGS)),) ++ifeq ($(findstring D_FORTIFY_SOURCE, $(CPPFLAGS)),) ++CFLAGS += -D_FORTIFY_SOURCE=2 ++endif ++endif + LDFLAGS += -z noexecstack -z relo -z now + + ODIR=obj diff -Nru tboot-1.10.5/debian/patches/series tboot-1.10.5/debian/patches/series --- tboot-1.10.5/debian/patches/series 2025-04-12 20:26:30.000000000 +0100 +++ tboot-1.10.5/debian/patches/series 2025-05-12 07:21:06.000000000 +0100 @@ -6,3 +6,4 @@ upstream_changeset_663.patch upstream_changeset_664.patch gcc-14-ftbfs.patch +fortify-ftbfs.patch