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
This commit is contained in:
Denis Davydov 2017-10-12 20:41:57 +02:00 committed by Todd Gamblin
parent 0dad5b3ee5
commit 1b53e82348
7 changed files with 52 additions and 5 deletions

View file

@ -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 @@ def __init__(self):
"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")

View file

@ -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'

View file

@ -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';

View file

@ -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 <ciso646>,
# <cstddef>, <cfloat>, <limits>, <climits>, <cstdint>, <cstdlib>, <new>,
# <typeinfo>, <exception>, <initializer_list>, <cstdalign>, <cstdarg>,

View file

@ -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')

View file

@ -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 @@ def install(self, spec, prefix):
'-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:

View file

@ -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 @@ def cmake_args(self):
'-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: