From c121314fd3e1f2558fb2072df5b194ca01efd62f Mon Sep 17 00:00:00 2001 From: zhouwenpei Date: Fri, 13 Aug 2021 14:27:55 +0800 Subject: [PATCH] adjust include order to avoid gnulib error --- ...-include-order-to-avoid-gnulib-error.patch | 46 +++++++++++++++++++ gdb.spec | 7 ++- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 0001-adjust-include-order-to-avoid-gnulib-error.patch diff --git a/0001-adjust-include-order-to-avoid-gnulib-error.patch b/0001-adjust-include-order-to-avoid-gnulib-error.patch new file mode 100644 index 0000000..753bf8b --- /dev/null +++ b/0001-adjust-include-order-to-avoid-gnulib-error.patch @@ -0,0 +1,46 @@ +From 8488c357ce4fc309d49c7b0224cf9574b68e8116 Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Thu, 18 Feb 2021 22:46:58 -0700 +Subject: [PATCH] amd64-linux-siginfo.c: Adjust include order to avoid gnulib + error + +On Fedora rawhide, after updating to glibc-2.33, I'm seeing the +following build failure: + + CXX nat/amd64-linux-siginfo.o +In file included from /usr/include/bits/sigstksz.h:24, + from /usr/include/signal.h:315, + from ../gnulib/import/signal.h:52, + from /ironwood1/sourceware-git/rawhide-gnulib/bld/../../worktree-gnulib/gdbserver/../gdb/nat/amd64-linux-siginfo.c:20: +../gnulib/import/unistd.h:663:3: error: #error "Please include config.h first." + 663 | #error "Please include config.h first." + | ^~~~~ + +glibc-2.33 has changed signal.h to now include which, +in turn, includes . For a gdb build, this causes the gnulib +version of unistd.h to be pulled in first. The build failure shown +above happens because gnulib's config.h has not been included before +the include of . + +The fix is simple - we just rearrange the order of the header file +includes to make sure that gdbsupport/commondefs.h is included before +attempting to include signal.h. Note that gdbsupport/commondefs.h +includes . + +Build and regression tested on Fedora 33. On Fedora rawhide, GDB +builds again. + +--- a/gdb/nat/amd64-linux-siginfo.c ++++ b/gdb/nat/amd64-linux-siginfo.c +@@ -17,8 +17,8 @@ + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +-#include + #include "gdbsupport/common-defs.h" ++#include + #include "amd64-linux-siginfo.h" + + #define GDB_SI_SIZE 128 +-- +2.27.0 diff --git a/gdb.spec b/gdb.spec index 54357e6..6851876 100644 --- a/gdb.spec +++ b/gdb.spec @@ -1,6 +1,6 @@ Name: gdb Version: 9.2 -Release: 6 +Release: 7 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL-1.3 Source: ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.xz @@ -113,6 +113,8 @@ Patch100: gdb-rhbz1844458-use-fputX_unfiltered.patch Patch101: gdb-rhbz1838777-debuginfod.patch # Fedora patch end +Patch102: 0001-adjust-include-order-to-avoid-gnulib-error.patch + %global gdb_src gdb-%{version} %global gdb_build build-%{_target_platform} %global __python %{__python3} @@ -394,6 +396,9 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/gdb/python/gdb/command/backtrace.py %{_infodir}/gdb.info* %changelog +* Fri Aug 13 2021 zhouwenpei - 9.2-7 +- adjust include order to avoid gnulib error + * Fri Jul 23 2021 zhouwenpei - 9.2-6 - remove unnecessary build require. -- Gitee