remove obsolete instructions on hacking clang+gfortran (#2217)
* remove obsolete instructions on hacking clang+gfortran * add detailed instructions on how to setup Clang+gfortran on macOS
This commit is contained in:
parent
36a4ca8b11
commit
1eeef97c78
@ -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
|
mixed toolchain: XCode-provided Clang for C/C++ and GNU ``gfortran`` for
|
||||||
Fortran.
|
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
|
.. code-block:: yaml
|
||||||
|
|
||||||
@ -426,57 +436,10 @@ In the simplest case, you can just edit ``compilers.yaml``:
|
|||||||
f77: /path/to/bin/gfortran
|
f77: /path/to/bin/gfortran
|
||||||
fc: /path/to/bin/gfortran
|
fc: /path/to/bin/gfortran
|
||||||
|
|
||||||
.. note::
|
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
|
||||||
If you are building packages that are sensitive to the compiler's
|
of GCC installed). Whereas for Homebrew, GCC is installed in
|
||||||
name, you may also need to slightly modify a few more files so that
|
``/usr/local/Cellar/gcc/x.y.z``.
|
||||||
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):
|
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
Compiler Verification
|
Compiler Verification
|
||||||
|
Loading…
Reference in New Issue
Block a user