Skip to content

Commit 1eeef97

Browse files
davyddentgamblin
authored andcommitted
remove obsolete instructions on hacking clang+gfortran (spack#2217)
* remove obsolete instructions on hacking clang+gfortran * add detailed instructions on how to setup Clang+gfortran on macOS
1 parent 36a4ca8 commit 1eeef97

File tree

1 file changed

+15
-52
lines changed

1 file changed

+15
-52
lines changed

lib/spack/docs/getting_started.rst

Lines changed: 15 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,17 @@ provides no Fortran compilers. The user is therefore forced to use a
414414
mixed toolchain: XCode-provided Clang for C/C++ and GNU ``gfortran`` for
415415
Fortran.
416416

417-
In the simplest case, you can just edit ``compilers.yaml``:
417+
#. You need to make sure that command-line tools are installed. To that
418+
end run ``$ xcode-select --install``.
419+
420+
#. Run ``$ spack compiler find`` to locate Clang.
421+
422+
#. There are different ways to get ``gfortran`` on macOS. For example, you can
423+
install GCC with Spack (``$ spack install gcc``) or with Homebrew
424+
(``$ brew install gcc``).
425+
426+
#. The only thing left to do is to edit ``~/.spack/compilers.yaml`` to provide
427+
the path to ``gfortran``:
418428

419429
.. code-block:: yaml
420430
@@ -426,57 +436,10 @@ In the simplest case, you can just edit ``compilers.yaml``:
426436
f77: /path/to/bin/gfortran
427437
fc: /path/to/bin/gfortran
428438
429-
.. note::
430-
431-
If you are building packages that are sensitive to the compiler's
432-
name, you may also need to slightly modify a few more files so that
433-
Spack uses compiler names the build system will recognize.
434-
435-
Following are instructions on how to hack together
436-
``clang`` and ``gfortran`` on Macintosh OS X. A similar approach
437-
should work for other mixed toolchain needs.
438-
439-
Better support for mixed compiler toolchains is planned in forthcoming
440-
Spack versions.
441-
442-
#. Create a symlink inside ``clang`` environment:
443-
444-
.. code-block:: console
445-
446-
$ cd $SPACK_ROOT/lib/spack/env/clang
447-
$ ln -s ../cc gfortran
448-
449-
450-
#. Patch ``clang`` compiler file:
451-
452-
.. code-block:: diff
453-
454-
$ diff --git a/lib/spack/spack/compilers/clang.py b/lib/spack/spack/compilers/clang.py
455-
index e406d86..cf8fd01 100644
456-
--- a/lib/spack/spack/compilers/clang.py
457-
+++ b/lib/spack/spack/compilers/clang.py
458-
@@ -35,17 +35,17 @@ class Clang(Compiler):
459-
cxx_names = ['clang++']
460-
461-
# Subclasses use possible names of Fortran 77 compiler
462-
- f77_names = []
463-
+ f77_names = ['gfortran']
464-
465-
# Subclasses use possible names of Fortran 90 compiler
466-
- fc_names = []
467-
+ fc_names = ['gfortran']
468-
469-
# Named wrapper links within spack.build_env_path
470-
link_paths = { 'cc' : 'clang/clang',
471-
'cxx' : 'clang/clang++',
472-
# Use default wrappers for fortran, in case provided in compilers.yaml
473-
- 'f77' : 'f77',
474-
- 'fc' : 'f90' }
475-
+ 'f77' : 'clang/gfortran',
476-
+ 'fc' : 'clang/gfortran' }
477-
478-
@classmethod
479-
def default_version(self, comp):
439+
If you used Spack to install GCC, you can get the installation prefix by
440+
``$ spack location -i gcc`` (this will only work if you have a single version
441+
of GCC installed). Whereas for Homebrew, GCC is installed in
442+
``/usr/local/Cellar/gcc/x.y.z``.
480443

481444
^^^^^^^^^^^^^^^^^^^^^
482445
Compiler Verification

0 commit comments

Comments
 (0)