compile error

Hello everyone,

I cannot compile openmc due to the following error:
$make

Scanning dependencies of target fox_fsys
[ 1%] Building Fortran object xml/fox/fsys/CMakeFiles/fox_fsys.dir/fox_m_fsys_realtypes.f90.o
[ 2%] Building Fortran object xml/fox/fsys/CMakeFiles/fox_fsys.dir/fox_m_fsys_abort_flush.F90.o
/home/jlmiao/openmc/src/xml/fox/fsys/fox_m_fsys_abort_flush.F90:107.30:

stop STDERR_FAILURE_STATUS
1
Error: Syntax error in STOP statement at (1)
make[3]: *** [xml/fox/fsys/CMakeFiles/fox_fsys.dir/fox_m_fsys_abort_flush.F90.o] Error 1
make[2]: *** [xml/fox/fsys/CMakeFiles/fox_fsys.dir/fox_m_fsys_abort_flush.F90.o.provides] Error 2
make[1]: *** [xml/fox/fsys/CMakeFiles/fox_fsys.dir/all] Error 2
make: *** [all] Error 2

I find it’s because the f95 compiler is too old.
$ f95 …/src/xml/fox/fsys/fox_m_fsys_abort_flush.F90 -c -o temp.o

…/src/xml/fox/fsys/fox_m_fsys_abort_flush.F90:107.30:

stop STDERR_FAILURE_STATUS
1
Error: Syntax error in STOP statement at (1)

My gfortran is up to date
$ gfortran …/src/xml/fox/fsys/fox_m_fsys_abort_flush.F90 -c -o temp.o

But cmake chooses f95 by default, How can I change that to gfortan?

$ cmake …/src/
– The Fortran compiler identification is GNU
– Check for working Fortran compiler: /usr/bin/f95
– Check for working Fortran compiler: /usr/bin/f95 – works
– Detecting Fortran compiler ABI info
– Detecting Fortran compiler ABI info - done
– Checking whether /usr/bin/f95 supports Fortran 90
– Checking whether /usr/bin/f95 supports Fortran 90 – yes
– Found PythonInterp: /opt/python/2.7/bin/python (found version “2.7.3”)
– Configuring done
– Generating done
– Build files have been written to: /home/jlmiao/openmc/build

Thanks!
Jilang

You can force fortran by setting the FC environment variable. So run

export FC=gfortran

before CMake