From 486400548358d3539d0b47f67f639e8be6283c6d Mon Sep 17 00:00:00 2001 From: George Hartzell Date: Sat, 23 Jun 2018 17:40:42 -0700 Subject: Fix gcc@5.5.0 on OS X 10.13.5 (#8540) * Fix gcc@5.5.0 on OS X 10.13.5 gcc@5.5.0 failed to build on my OS X 10.13.5 box. I found/modified a patch in the MacPorts world that traced back to Homebrewy, https://trac.macports.org/ticket/56502#no1 The issue has also been reported to gcc, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83531 I eventually discovered a nearly identical version of the patch at Homebrew. https://github.com/Homebrew/formula-patches/blob/master/gcc%405/10.13_headers.patch gcc builds with this and I can compile many things, but e.g. curl and cmake both fail. As @davydden and others observed in #1847, it seems to be an apple thing. * Fix mistaken change to patch when clause (added :) I mistakenly deleted a colon from the 'darwin/gcc-7.1.0-headerpad.patch'. --- .../packages/gcc/darwin/headers-10.13-fix.patch | 127 +++++++++++++++++++++ var/spack/repos/builtin/packages/gcc/package.py | 6 +- 2 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 var/spack/repos/builtin/packages/gcc/darwin/headers-10.13-fix.patch (limited to 'var') diff --git a/var/spack/repos/builtin/packages/gcc/darwin/headers-10.13-fix.patch b/var/spack/repos/builtin/packages/gcc/darwin/headers-10.13-fix.patch new file mode 100644 index 0000000000..3dbfde0255 --- /dev/null +++ b/var/spack/repos/builtin/packages/gcc/darwin/headers-10.13-fix.patch @@ -0,0 +1,127 @@ +diff -pur fixincludes/fixincl.x gcc-5.5.0/fixincludes/fixincl.x +--- a/fixincludes/fixincl.x 2017-01-30 17:08:42.000000000 +0100 ++++ b/fixincludes/fixincl.x 2017-12-21 14:34:35.000000000 +0100 +@@ -1,12 +1,12 @@ + /* -*- buffer-read-only: t -*- vi: set ro: +- * ++ * + * DO NOT EDIT THIS FILE (fixincl.x) +- * +- * It has been AutoGen-ed January 5, 2017 at 06:05:06 PM by AutoGen 5.16.2 ++ * ++ * It has been AutoGen-ed December 21, 2017 at 02:34:35 PM by AutoGen 5.18.7 + * From the definitions inclhack.def + * and the template file fixincl + */ +-/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Jan 5 18:05:06 CET 2017 ++/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Dec 21 14:34:35 CET 2017 + * + * You must regenerate it. Use the ./genfixes script. + * +@@ -15,7 +15,7 @@ + * certain ANSI-incompatible system header files which are fixed to work + * correctly with ANSI C and placed in a directory that GNU C will search. + * +- * This file contains 240 fixup descriptions. ++ * This file contains 241 fixup descriptions. + * + * See README for more information. + * +@@ -2579,6 +2579,43 @@ extern \"C\" {\n\ + + /* * * * * * * * * * * * * * * * * * * * * * * * * * + * ++ * Description of Darwin_Osavailability fix ++ */ ++tSCC zDarwin_OsavailabilityName[] = ++ "darwin_osavailability"; ++ ++/* ++ * File name selection pattern ++ */ ++tSCC zDarwin_OsavailabilityList[] = ++ "os/availability.h\0"; ++/* ++ * Machine/OS name selection pattern ++ */ ++tSCC* apzDarwin_OsavailabilityMachs[] = { ++ "*-*-darwin*", ++ (const char*)NULL }; ++ ++/* ++ * content selection pattern - do fix if pattern found ++ */ ++tSCC zDarwin_OsavailabilitySelect0[] = ++ "#define[ \t]+__(API_[A-Z_]*)\\(\\.\\.\\.\\)"; ++ ++#define DARWIN_OSAVAILABILITY_TEST_CT 1 ++static tTestDesc aDarwin_OsavailabilityTests[] = { ++ { TT_EGREP, zDarwin_OsavailabilitySelect0, (regex_t*)NULL }, }; ++ ++/* ++ * Fix Command Arguments for Darwin_Osavailability ++ */ ++static const char* apzDarwin_OsavailabilityPatch[] = { ++ "format", ++ "#define %1(...)", ++ (char*)NULL }; ++ ++/* * * * * * * * * * * * * * * * * * * * * * * * * * ++ * + * Description of Darwin_9_Long_Double_Funcs_2 fix + */ + tSCC zDarwin_9_Long_Double_Funcs_2Name[] = +@@ -9818,9 +9855,9 @@ static const char* apzX11_SprintfPatch[] + * + * List of all fixes + */ +-#define REGEX_COUNT 276 ++#define REGEX_COUNT 277 + #define MACH_LIST_SIZE_LIMIT 187 +-#define FIX_COUNT 240 ++#define FIX_COUNT 241 + + /* + * Enumerate the fixes +@@ -9885,6 +9922,7 @@ typedef enum { + CTRL_QUOTES_DEF_FIXIDX, + CTRL_QUOTES_USE_FIXIDX, + CXX_UNREADY_FIXIDX, ++ DARWIN_OSAVAILABILITY_FIXIDX, + DARWIN_9_LONG_DOUBLE_FUNCS_2_FIXIDX, + DARWIN_EXTERNC_FIXIDX, + DARWIN_GCC4_BREAKAGE_FIXIDX, +@@ -10364,6 +10402,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { + CXX_UNREADY_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aCxx_UnreadyTests, apzCxx_UnreadyPatch, 0 }, + ++ { zDarwin_OsavailabilityName, zDarwin_OsavailabilityList, ++ apzDarwin_OsavailabilityMachs, ++ DARWIN_OSAVAILABILITY_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, ++ aDarwin_OsavailabilityTests, apzDarwin_OsavailabilityPatch, 0 }, ++ + { zDarwin_9_Long_Double_Funcs_2Name, zDarwin_9_Long_Double_Funcs_2List, + apzDarwin_9_Long_Double_Funcs_2Machs, + DARWIN_9_LONG_DOUBLE_FUNCS_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, +diff -pur fixincludes/inclhack.def gcc-5.5.0/fixincludes/inclhack.def +--- a/fixincludes/inclhack.def 2017-01-30 17:08:42.000000000 +0100 ++++ b/fixincludes/inclhack.def 2017-12-21 14:34:28.000000000 +0100 +@@ -1337,6 +1337,18 @@ fix = { + test_text = "extern void* malloc( size_t );"; + }; + ++fix = { ++ hackname = darwin_osavailability; ++ mach = "*-*-darwin*"; ++ files = os/availability.h; ++ select = "#define[ \t]+__(API_[A-Z_]*)\\(\\.\\.\\.\\)"; ++ c_fix = format; ++ c_fix_arg = "#define %1(...)"; ++ ++ test_text = "#define __API_AVAILABLE(...)\n" ++ "#define API_AVAILABLE(...)\n"; ++}; ++ + /* + * For the AAB_darwin7_9_long_double_funcs fix to be useful, + * you have to not use "" includes. diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py index acc7eb36fb..d4180d1c50 100644 --- a/var/spack/repos/builtin/packages/gcc/package.py +++ b/var/spack/repos/builtin/packages/gcc/package.py @@ -158,7 +158,11 @@ class Gcc(AutotoolsPackage): # Fix parallel build on APFS filesystem # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81797 if macOS_version() >= Version('10.13'): - patch('darwin/apfs.patch', when='@6.1:6.4,7.1:7.3') + patch('darwin/apfs.patch', when='@5.5.0,6.1:6.4,7.1:7.3') + # from homebrew via macports + # https://trac.macports.org/ticket/56502#no1 + # see also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83531 + patch('darwin/headers-10.13-fix.patch', when='@5.5.0') patch('darwin/gcc-7.1.0-headerpad.patch', when='@5:') patch('darwin/gcc-6.1.0-jit.patch', when='@5:7') patch('darwin/gcc-4.9.patch1', when='@4.9.0:4.9.3') -- cgit v1.2.3-60-g2f50