diff options
Diffstat (limited to 'lib/spack/docs/getting_started.rst')
-rw-r--r-- | lib/spack/docs/getting_started.rst | 67 |
1 files changed, 15 insertions, 52 deletions
diff --git a/lib/spack/docs/getting_started.rst b/lib/spack/docs/getting_started.rst index 4bc7629a3a..34cbf453e1 100644 --- a/lib/spack/docs/getting_started.rst +++ b/lib/spack/docs/getting_started.rst @@ -414,7 +414,17 @@ provides no Fortran compilers. The user is therefore forced to use a mixed toolchain: XCode-provided Clang for C/C++ and GNU ``gfortran`` for Fortran. -In the simplest case, you can just edit ``compilers.yaml``: +#. You need to make sure that command-line tools are installed. To that + end run ``$ xcode-select --install``. + +#. Run ``$ spack compiler find`` to locate Clang. + +#. There are different ways to get ``gfortran`` on macOS. For example, you can + install GCC with Spack (``$ spack install gcc``) or with Homebrew + (``$ brew install gcc``). + +#. The only thing left to do is to edit ``~/.spack/compilers.yaml`` to provide + the path to ``gfortran``: .. code-block:: yaml @@ -426,57 +436,10 @@ In the simplest case, you can just edit ``compilers.yaml``: f77: /path/to/bin/gfortran fc: /path/to/bin/gfortran -.. note:: - - If you are building packages that are sensitive to the compiler's - name, you may also need to slightly modify a few more files so that - Spack uses compiler names the build system will recognize. - - Following are instructions on how to hack together - ``clang`` and ``gfortran`` on Macintosh OS X. A similar approach - should work for other mixed toolchain needs. - - Better support for mixed compiler toolchains is planned in forthcoming - Spack versions. - - #. Create a symlink inside ``clang`` environment: - - .. code-block:: console - - $ cd $SPACK_ROOT/lib/spack/env/clang - $ ln -s ../cc gfortran - - - #. Patch ``clang`` compiler file: - - .. code-block:: diff - - $ diff --git a/lib/spack/spack/compilers/clang.py b/lib/spack/spack/compilers/clang.py - index e406d86..cf8fd01 100644 - --- a/lib/spack/spack/compilers/clang.py - +++ b/lib/spack/spack/compilers/clang.py - @@ -35,17 +35,17 @@ class Clang(Compiler): - cxx_names = ['clang++'] - - # Subclasses use possible names of Fortran 77 compiler - - f77_names = [] - + f77_names = ['gfortran'] - - # Subclasses use possible names of Fortran 90 compiler - - fc_names = [] - + fc_names = ['gfortran'] - - # Named wrapper links within spack.build_env_path - link_paths = { 'cc' : 'clang/clang', - 'cxx' : 'clang/clang++', - # Use default wrappers for fortran, in case provided in compilers.yaml - - 'f77' : 'f77', - - 'fc' : 'f90' } - + 'f77' : 'clang/gfortran', - + 'fc' : 'clang/gfortran' } - - @classmethod - def default_version(self, comp): + If you used Spack to install GCC, you can get the installation prefix by + ``$ spack location -i gcc`` (this will only work if you have a single version + of GCC installed). Whereas for Homebrew, GCC is installed in + ``/usr/local/Cellar/gcc/x.y.z``. ^^^^^^^^^^^^^^^^^^^^^ Compiler Verification |