openPMD / openPMD-api

:floppy_disk: C++ & Python API for Scientific I/O
https://openpmd-api.readthedocs.io
GNU Lesser General Public License v3.0
142 stars 51 forks source link

Spack Install: No Fortran Compiler Found (ADIOS2) #805

Open cbontoiu opened 4 years ago

cbontoiu commented 4 years ago

Hello,

I am using picongpu in Spack and I want to install the openpmd-api in Spack as well. The command spack install openpmd-api %gcc@7.5.0 led to the following output/problem during install

2 errors found in build log:
     22    -- Found PNG: /home/cristi/src/spack/opt/spack/linux-linuxmint20-westmere/gcc-7.5.0/libpng-1.6.37-cwt2jptxfzgjm4dpvdwgrk6dvcvr346f/lib/libpng.so (
           found suitable version "1.6.37", minimum required is "1.6.0")
     23    -- The Fortran compiler identification is unknown
     24    -- Detecting Fortran compiler ABI info
     25    -- Detecting Fortran compiler ABI info - failed
     26    -- Check for working Fortran compiler: /home/cristi/src/spack/lib/spack/env/gcc/gfortran
     27    -- Check for working Fortran compiler: /home/cristi/src/spack/lib/spack/env/gcc/gfortran - broken
  >> 28    CMake Error at /home/cristi/src/spack/opt/spack/linux-linuxmint20-westmere/gcc-7.5.0/cmake-3.18.4-nm4b7uesbgjagvkk4yxe7kcvys2s5ulb/share/cmake-3.1
           8/Modules/CMakeTestFortranCompiler.cmake:51 (message):
     29      The Fortran compiler
     30    
     31        "/home/cristi/src/spack/lib/spack/env/gcc/gfortran"
     32    
     33      is not able to compile a simple test program.
     34    
     ...
     38    
     39        Run Build Command(s):/usr/bin/make cmTC_3db5c/fast && /usr/bin/make  -f CMakeFiles/cmTC_3db5c.dir/build.make CMakeFiles/cmTC_3db5c.dir/build
     40        make[1]: Entering directory '/tmp/cristi/spack-stage/spack-stage-adios2-2.6.0-xcilvhayz74rp2zqolhqo4k7iynhhymq/spack-build-xcilvha/CMakeFiles/
           CMakeTmp'
     41        Building Fortran object CMakeFiles/cmTC_3db5c.dir/testFortranCompiler.f.o
     42        /home/cristi/src/spack/lib/spack/env/gcc/gfortran    -c /tmp/cristi/spack-stage/spack-stage-adios2-2.6.0-xcilvhayz74rp2zqolhqo4k7iynhhymq/spac
           k-build-xcilvha/CMakeFiles/CMakeTmp/testFortranCompiler.f -o CMakeFiles/cmTC_3db5c.dir/testFortranCompiler.f.o
     43        ERROR: Compiler 'gcc@7.5.0' does not support compiling Fortran 90 programs.
  >> 44    make[1]: *** [CMakeFiles/cmTC_3db5c.dir/build.make:85: CMakeFiles/cmTC_3db5c.dir/testFortranCompiler.f.o] Error 1
     45        make[1]: Leaving directory '/tmp/cristi/spack-stage/spack-stage-adios2-2.6.0-xcilvhayz74rp2zqolhqo4k7iynhhymq/spack-build-xcilvha/CMakeFiles/C
           MakeTmp'
     46        make: *** [Makefile:140: cmTC_3db5c/fast] Error 2

It seems that I need to use a Fortran compiler different than gfortran but I don't know how to do it. What would you recommend?

System environment

ax3l commented 4 years ago

Hi @cbontoiu,

thank you for the report! Yes, it looks like there is no Fortran compiler set in your Spack compiler configuration.

Spack Compiler Config

If you have a gfortran installed via your package manager, you can try to auto-detect it alongside your gcc/g++ with spack compiler find. Then please check the compilers.yaml configuration file contains the entry via spack config edit compilers (usually located at ~/.spack/linux/compilers.yaml).

If you fear the file might be outdated or you want to start over, just remove or empty the content of the compilers.yaml file and run spack compiler find again.

After updating the compilers.yaml you can spack install the package.

Alternative: We don't really use +fortran Bindings of our Dependencies

As an alternative: We do indeed not use the Fortran bindings of ADIOS2, but Spack builds with +fortran variants by default. You can specifically deselect those via spack install openpmd-api %gcc@7.5.0 ^adios2 -fortran.

You can even tell Spack that you don't want Fortran variants of any package unless explicitly requested. For that, do spack config edit packages and add this section:

# inside this section:
packages:
# ...
  # don't ask for +fortran by default unless really needed
  all:
    variants: ~fortran

Does this help?