From b23e55912e850c962b5ca170f1aaaf86a191e1d4 Mon Sep 17 00:00:00 2001 From: Janneke Nieuwenhuizen Date: Sun, 15 Dec 2024 23:17:05 +0100 Subject: [PATCH] gnu: gcc-4.7: Fix build with gcc-14. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This gets us past the ucontext_t problem, next up: In file included from /tmp/guix-build-gcc-fixed-4.7.4.drv-0/build/x86_64-unknown-linux-gnu/libstdc++-v3/include/cstdlib:66:0, from ../../../../gcc-4.7.4/libstdc++-v3/libsupc++/eh_catch.cc:25: /gnu/store/d0x6p8327didrav23b1xq9gdawn0b906-gcc-14.2.0/include/c++/stdlib.h:38:12: error: ‘std::abort’ has not been declared * gnu/packages/patches/gcc-4.7-ucontext-type-confusion.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/gcc.scm (gcc-4.7): Use it. [arguments]: Use CXX="g++ c++03" in #:configure-flags. Change-Id: I9c43d5371aa491bb47eaba26f2d21e8500dc1955 --- gnu/local.mk | 1 + gnu/packages/gcc.scm | 6 +++-- .../gcc-4.7-ucontext-type-confusion.patch | 25 +++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 gnu/packages/patches/gcc-4.7-ucontext-type-confusion.patch diff --git a/gnu/local.mk b/gnu/local.mk index f1c7d0ab8c..eedbcd0bf2 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1345,6 +1345,7 @@ dist_patch_DATA = \ %D%/packages/patches/gcc-cross-environment-variables.patch \ %D%/packages/patches/gcc-cross-gxx-include-dir.patch \ %D%/packages/patches/gcc-fix-texi2pod.patch \ + %D%/packages/patches/gcc-4.7-ucontext-type-confusion.patch \ %D%/packages/patches/gcc-4.8-libsanitizer-fix.patch \ %D%/packages/patches/gcc-4.9-inline.patch \ %D%/packages/patches/gcc-4.9-libsanitizer-fix.patch \ diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index 5104c437f0..d69095ea0e 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -177,7 +177,8 @@ where the OS part is overloaded to denote a specific ABI---into GCC (base32 "10k2k71kxgay283ylbbhhs51cl55zn2q38vj5pk4k950qdnirrlj")) (patches (search-patches "gcc-4-compile-with-gcc-5.patch" - "gcc-fix-texi2pod.patch")))) + "gcc-fix-texi2pod.patch" + "gcc-4.7-ucontext-type-confusion.patch")))) (build-system gnu-build-system) ;; Separate out the run-time support libraries because all the @@ -201,7 +202,8 @@ where the OS part is overloaded to denote a specific ABI---into GCC ;; incompatible with some earlier versions. ;; Force an earlier C++ standard while building. (cond - ((version-prefix? "4.8" version) + ((or (version-prefix? "4.7" version) + (version-prefix? "4.8" version)) `(cons "CXX=g++ -std=c++03" ,flags)) ((or (version-prefix? "4.9" version) (version-prefix? "5" version)) diff --git a/gnu/packages/patches/gcc-4.7-ucontext-type-confusion.patch b/gnu/packages/patches/gcc-4.7-ucontext-type-confusion.patch new file mode 100644 index 0000000000..406c5d2863 --- /dev/null +++ b/gnu/packages/patches/gcc-4.7-ucontext-type-confusion.patch @@ -0,0 +1,25 @@ +From ef0d1ac2580b43535965eb4b31f077f355660215 Mon Sep 17 00:00:00 2001 +From: Ekaitz Zarraga +Date: Wed, 30 Mar 2022 13:41:15 +0200 +Subject: [PATCH] Fix ucontext_t issue + +--- + libgcc/config/i386/linux-unwind.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libgcc/config/i386/linux-unwind.h b/libgcc/config/i386/linux-unwind.h +index cd9a9a1e2b6..62ce4e44d54 100644 +--- a/libgcc/config/i386/linux-unwind.h ++++ b/libgcc/config/i386/linux-unwind.h +@@ -53,7 +53,7 @@ x86_64_fallback_frame_state (struct _Unwind_Context *context, + if (*(unsigned char *)(pc+0) == 0x48 + && *(unsigned long long *)(pc+1) == RT_SIGRETURN_SYSCALL) + { +- struct ucontext *uc_ = context->cfa; ++ struct ucontext_t *uc_ = context->cfa; + /* The void * cast is necessary to avoid an aliasing warning. + The aliasing warning is correct, but should not be a problem + because it does not alias anything. */ +-- +2.46.0 +