Skip to content

Mix Clang and GNU Fortran on OS-X #568

@davydden

Description

@davydden

Spack correctly finds compilers on El Capitan

$ ./spack compilers
==> Available compilers
-- gcc ----------------------------------------------------------
[email protected]  [email protected]

-- clang --------------------------------------------------------
[email protected]

and the compilers.yaml looks all right

compilers:
  darwin-x86_64:
    [email protected]:
      cc: /usr/bin/clang
      cxx: /usr/bin/clang++
      f77: null
      fc: null
    [email protected]:
      cc: /usr/bin/gcc
      cxx: /usr/bin/g++
      f77: null
      fc: null
    [email protected]:
      cc: null
      cxx: null
      f77: /usr/local/bin/gfortran
      fc: /usr/local/bin/gfortran

To use this on OS-X, one really need a way to specify the usage of

cc: /usr/bin/clang
cxx: /usr/bin/clang++

together with

f77: /usr/local/bin/gfortran
fc: /usr/local/bin/gfortran

when building, say, OpenMPI with fortran support. That also includes changing the installation prefix darwin-x86_64/gcc-5.3.0/ to something like darwin-x86_64/gcc-5.3.0-clang-7.0.2/.

As a current workaround I guess one can edit compilers.yaml manually to something like

compilers:
  darwin-x86_64:
    [email protected]:
      cc: /usr/bin/clang
      cxx: /usr/bin/clang++
      f77: /usr/local/bin/gfortran
      fc: /usr/local/bin/gfortran

and then make clang default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions