summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorGeoffrey Oxberry <goxberry@gmail.com>2016-10-02 18:54:43 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2016-10-02 18:54:43 -0700
commitdf79ba0dcfd933789f407caea977541aa8b4d1ff (patch)
tree479c9461e42824941f67a8b768d4fd2e627398c0 /var
parent16f99bd0b2ed7f41655043ede36f4c5b4b68ff55 (diff)
downloadspack-df79ba0dcfd933789f407caea977541aa8b4d1ff.tar.gz
spack-df79ba0dcfd933789f407caea977541aa8b4d1ff.tar.bz2
spack-df79ba0dcfd933789f407caea977541aa8b4d1ff.tar.xz
spack-df79ba0dcfd933789f407caea977541aa8b4d1ff.zip
gcc: fix darwin dispatch/object.h header issue (#1518)
Fixes #1203. Apple ships headers in Yosemite (and possibly earlier) that are gcc-incompatible, but compile fine with clang. The fix is to copy the offending system header from /usr/include/${REST_OF_HEADER_PATH} to ${GCC_PREFIX}/include/${REST_OF_HEADER_PATH} and replace the non-gcc- compatible features with gcc-compatible equivalents. See https://github.com/hashdist/hashstack/pull/771/files for inspiration, and http://hamelot.io/programming/osx-gcc-dispatch_block_t-has-not-been-declared-invalid-typedef/ for a description of the header issue.
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/gcc/package.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py
index 3be3948b59..d152ce61c7 100644
--- a/var/spack/repos/builtin/packages/gcc/package.py
+++ b/var/spack/repos/builtin/packages/gcc/package.py
@@ -3,6 +3,7 @@ from spack import *
from contextlib import closing
from glob import glob
import sys
+from os.path import isfile
class Gcc(Package):
@@ -68,6 +69,19 @@ class Gcc(Package):
if spec.satisfies("@4.7.1:") and sys.platform != 'darwin':
enabled_languages.add('go')
+ # Fix a standard header file for OS X Yosemite that
+ # is GCC incompatible by replacing non-GCC compliant macros
+ if 'yosemite' in spec.architecture:
+ if isfile(r'/usr/include/dispatch/object.h'):
+ new_dispatch_dir = join_path(prefix, 'include', 'dispatch')
+ mkdirp(new_dispatch_dir)
+ cp = which('cp')
+ new_header = join_path(new_dispatch_dir, 'object.h')
+ cp(r'/usr/include/dispatch/object.h', new_header)
+ filter_file(r'typedef void \(\^dispatch_block_t\)\(void\)',
+ 'typedef void* dispatch_block_t',
+ new_header)
+
# Generic options to compile GCC
options = ["--prefix=%s" % prefix, "--libdir=%s/lib64" % prefix,
"--disable-multilib",