From 1b53e82348b94105fa1ee01409a27970831de0f7 Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Thu, 12 Oct 2017 20:41:57 +0200 Subject: various fixes for macOS high sierra (#5647) * various fixes for macOS high sierra * add macOS_version() helper function * flake8 fixes * update oce and trilinos * fix bison --- lib/spack/spack/operating_systems/mac_os.py | 11 ++++++++++- var/spack/repos/builtin/packages/bison/package.py | 5 +++++ .../repos/builtin/packages/bison/secure_snprintf.patch | 15 +++++++++++++++ var/spack/repos/builtin/packages/gcc/darwin/apfs.patch | 12 ++++++++++++ var/spack/repos/builtin/packages/gcc/package.py | 5 +++++ var/spack/repos/builtin/packages/oce/package.py | 5 +++-- var/spack/repos/builtin/packages/trilinos/package.py | 4 ++-- 7 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 var/spack/repos/builtin/packages/bison/secure_snprintf.patch create mode 100644 var/spack/repos/builtin/packages/gcc/darwin/apfs.patch diff --git a/lib/spack/spack/operating_systems/mac_os.py b/lib/spack/spack/operating_systems/mac_os.py index 6c02ba5528..52a26bc69a 100644 --- a/lib/spack/spack/operating_systems/mac_os.py +++ b/lib/spack/spack/operating_systems/mac_os.py @@ -24,6 +24,14 @@ ############################################################################## import platform as py_platform from spack.architecture import OperatingSystem +from spack.version import * + + +# FIXME: store versions inside OperatingSystem as a Version instead of string +def macOS_version(): + """temporary workaround to return a macOS version as a Version object + """ + return Version('.'.join(py_platform.mac_ver()[0].split('.')[:2])) class MacOs(OperatingSystem): @@ -44,7 +52,8 @@ class MacOs(OperatingSystem): "10.9": "mavericks", "10.10": "yosemite", "10.11": "elcapitan", - "10.12": "sierra"} + "10.12": "sierra", + "10.13": "highsierra"} mac_ver = '.'.join(py_platform.mac_ver()[0].split('.')[:2]) name = mac_releases.get(mac_ver, "macos") diff --git a/var/spack/repos/builtin/packages/bison/package.py b/var/spack/repos/builtin/packages/bison/package.py index 868268d42b..67b25441af 100644 --- a/var/spack/repos/builtin/packages/bison/package.py +++ b/var/spack/repos/builtin/packages/bison/package.py @@ -23,6 +23,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## from spack import * +from spack.operating_systems.mac_os import macOS_version +import sys class Bison(AutotoolsPackage): @@ -40,4 +42,7 @@ class Bison(AutotoolsPackage): patch('pgi.patch', when='@3.0.4') + if sys.platform == 'darwin' and macOS_version() >= Version('10.13'): + patch('secure_snprintf.patch', level=0, when='@3.0.4') + build_directory = 'spack-build' diff --git a/var/spack/repos/builtin/packages/bison/secure_snprintf.patch b/var/spack/repos/builtin/packages/bison/secure_snprintf.patch new file mode 100644 index 0000000000..0dff749f2a --- /dev/null +++ b/var/spack/repos/builtin/packages/bison/secure_snprintf.patch @@ -0,0 +1,15 @@ +With format string strictness, High Sierra also enforces that %n isn't used +in dynamic format strings, but we should just disable its use on darwin in +general. + +--- lib/vasnprintf.c.orig 2017-06-22 15:19:15.000000000 -0700 ++++ lib/vasnprintf.c 2017-06-22 15:20:20.000000000 -0700 +@@ -4869,7 +4869,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * + #endif + *fbp = dp->conversion; + #if USE_SNPRINTF +-# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) ++# if !defined(__APPLE__) && !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) + fbp[1] = '%'; + fbp[2] = 'n'; + fbp[3] = '\0'; diff --git a/var/spack/repos/builtin/packages/gcc/darwin/apfs.patch b/var/spack/repos/builtin/packages/gcc/darwin/apfs.patch new file mode 100644 index 0000000000..d1f9d56667 --- /dev/null +++ b/var/spack/repos/builtin/packages/gcc/darwin/apfs.patch @@ -0,0 +1,12 @@ +diff -uNr gcc-7.2.0.orig/libstdc++-v3/include/Makefile.in gcc-7.2.0/libstdc++-v3/include/Makefile.in +--- gcc-7.2.0.orig/libstdc++-v3/include/Makefile.in 2017-07-25 14:05:07.000000000 -0400 ++++ gcc-7.2.0/libstdc++-v3/include/Makefile.in 2017-09-02 12:22:08.000000000 -0400 +@@ -1764,6 +1764,8 @@ + @GLIBCXX_HOSTED_TRUE@install-data-local: install-headers + @GLIBCXX_HOSTED_FALSE@install-data-local: install-freestanding-headers + ++.NOTPARALLEL: install-headers ++ + # This is a subset of the full install-headers rule. We only need , + # , , , , , , , + # , , , , , diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py index d690e63683..f5a84873a0 100644 --- a/var/spack/repos/builtin/packages/gcc/package.py +++ b/var/spack/repos/builtin/packages/gcc/package.py @@ -23,6 +23,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## from spack import * +from spack.operating_systems.mac_os import macOS_version from llnl.util import tty import glob @@ -148,6 +149,10 @@ class Gcc(AutotoolsPackage): conflicts('languages=jit', when='@:4') if sys.platform == 'darwin': + # 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='@7.2.0') patch('darwin/gcc-7.1.0-headerpad.patch', when='@5:') patch('darwin/gcc-6.1.0-jit.patch', when='@5:') patch('darwin/gcc-4.9.patch1', when='@4.9.0:4.9.3') diff --git a/var/spack/repos/builtin/packages/oce/package.py b/var/spack/repos/builtin/packages/oce/package.py index b6e016361e..15bc9ab39e 100644 --- a/var/spack/repos/builtin/packages/oce/package.py +++ b/var/spack/repos/builtin/packages/oce/package.py @@ -23,6 +23,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## from spack import * +from spack.operating_systems.mac_os import macOS_version import platform @@ -61,7 +62,7 @@ class Oce(Package): # fix build with Xcode 8 "previous definition of CLOCK_REALTIME" # reported 27 Sep 2016 https://github.com/tpaviot/oce/issues/643 if (platform.system() == "Darwin") and ( - '.'.join(platform.mac_ver()[0].split('.')[:2]) == '10.12'): + macOS_version() == Version('10.12')): patch('sierra.patch', when='@0.17.2:0.18.0') def install(self, spec, prefix): @@ -91,7 +92,7 @@ class Oce(Package): '-DOCE_OSX_USE_COCOA:BOOL=ON', ]) - if '.'.join(platform.mac_ver()[0].split('.')[:2]) == '10.12': + if macOS_version() >= Version('10.12'): # use @rpath on Sierra due to limit of dynamic loader options.append('-DCMAKE_MACOSX_RPATH=ON') else: diff --git a/var/spack/repos/builtin/packages/trilinos/package.py b/var/spack/repos/builtin/packages/trilinos/package.py index 375309207f..784253158f 100644 --- a/var/spack/repos/builtin/packages/trilinos/package.py +++ b/var/spack/repos/builtin/packages/trilinos/package.py @@ -23,9 +23,9 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## from spack import * +from spack.operating_systems.mac_os import macOS_version import os import sys -import platform # Trilinos is complicated to build, as an inspiration a couple of links to # other repositories which build it: @@ -586,7 +586,7 @@ class Trilinos(CMakePackage): '-DTrilinos_ENABLE_FEI=OFF' ]) - if '.'.join(platform.mac_ver()[0].split('.')[:2]) == '10.12': + if macOS_version() >= Version('10.12'): # use @rpath on Sierra due to limit of dynamic loader options.append('-DCMAKE_MACOSX_RPATH=ON') else: -- cgit v1.2.3-70-g09d2