Skip to content

Arbitrary mixed compiler #5655

@deOliveira-R

Description

@deOliveira-R

Is there a way to add an arbitrary compiler to compilers.yaml?

The case is that I'm on Mac OS High Sierra and to install openmpi I need gfortran from gcc. This forces me to have a mixed toolchain.

However, a mixed toolchain is not exactly recommended. If possible, I'd like to keep the pure clang compiler available (since it works for many packages) and define an arbitrary mixed toolchain as a workaround only for installing C and Fortran dependent packages, such as openmpi.

I have the system Clang, spack's Clang and spack's GCC installed. I'd like to add an additional compiler to compilers.yaml that has Clang for C/C++ compiler and gfortran, such as:

compilers:
- compiler:
    environment: {}
    extra_rpaths: []
    flags: {}
    modules: []
    operating_system: highsierra
    paths:
      cc: /Library/Developer/CommandLineTools/usr/bin/clang
      cxx: /Library/Developer/CommandLineTools/usr/bin/clang++
      f77: null
      fc: null
    spec: [email protected]
    target: x86_64
- compiler:
    environment: {}
    extra_rpaths: []
    flags: {}
    modules: []
    operating_system: highsierra
    paths:
      cc: /Users/rodrigo/opt/spack-tools/opt/spack/darwin-highsierra-x86_64/clang-9.0.0-apple/gcc-7.2.0-s6yrqijmnetn5kogvcdubvnwqmxt6bzx/bin/gcc
      cxx: /Users/rodrigo/opt/spack-tools/opt/spack/darwin-highsierra-x86_64/clang-9.0.0-apple/gcc-7.2.0-s6yrqijmnetn5kogvcdubvnwqmxt6bzx/bin/g++
      f77: /Users/rodrigo/opt/spack-tools/opt/spack/darwin-highsierra-x86_64/clang-9.0.0-apple/gcc-7.2.0-s6yrqijmnetn5kogvcdubvnwqmxt6bzx/bin/gfortran
      fc: /Users/rodrigo/opt/spack-tools/opt/spack/darwin-highsierra-x86_64/clang-9.0.0-apple/gcc-7.2.0-s6yrqijmnetn5kogvcdubvnwqmxt6bzx/bin/gfortran
    spec: [email protected]
    target: x86_64
- compiler:
    environment: {}
    extra_rpaths: []
    flags: {}
    modules: []
    operating_system: highsierra
    paths:
      cc: /Users/rodrigo/opt/spack-tools/opt/spack/darwin-highsierra-x86_64/clang-9.0.0-apple/llvm-4.0.1-6dr5en3gbmjerwkpvgjwelj3lawr7udu/bin/clang
      cxx: /Users/rodrigo/opt/spack-tools/opt/spack/darwin-highsierra-x86_64/clang-9.0.0-apple/llvm-4.0.1-6dr5en3gbmjerwkpvgjwelj3lawr7udu/bin/clang++
      f77: null
      fc: null
    spec: [email protected]
    target: x86_64
- compiler:
    environment: {}
    extra_rpaths: []
    flags: {}
    modules: []
    operating_system: highsierra
    paths:
      cc: /Users/rodrigo/opt/spack-tools/opt/spack/darwin-highsierra-x86_64/clang-9.0.0-apple/llvm-4.0.1-6dr5en3gbmjerwkpvgjwelj3lawr7udu/bin/clang
      cxx: /Users/rodrigo/opt/spack-tools/opt/spack/darwin-highsierra-x86_64/clang-9.0.0-apple/llvm-4.0.1-6dr5en3gbmjerwkpvgjwelj3lawr7udu/bin/clang++
      f77: /Users/rodrigo/opt/spack-tools/opt/spack/darwin-highsierra-x86_64/clang-9.0.0-apple/gcc-7.2.0-s6yrqijmnetn5kogvcdubvnwqmxt6bzx/bin/gfortran
      fc: /Users/rodrigo/opt/spack-tools/opt/spack/darwin-highsierra-x86_64/clang-9.0.0-apple/gcc-7.2.0-s6yrqijmnetn5kogvcdubvnwqmxt6bzx/bin/gfortran
    spec: [email protected]
    target: x86_64

However, when I add the "mix" compiler, upon a spack compilers I get:

==> Available compilers
==> Error: 

Is it possible to specify a compiler in this or a similar manner?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions