Compilation error exciting_oxygen on Ubuntu

Hello everyone,

I am trying to compile exciting_oxygen on my mac, using parallels.
On my parallels desktop I have Ubuntu 20.04.1 LTS and this is where I am trying to install exciting_oxygen. I have followed the steps on the exciting website for compilation, however when I type in make smp I get the following error:

make[3]: Entering directory ‘/home/parallels/Documents/EXCITING/exciting_oxygen/exciting/build/smp’
Makefile.mkmf:3905: warning: overriding recipe for target ‘version.inc’
Makefile.mkmf:2631: warning: ignoring old recipe for target ‘version.inc’
gfortran -O3 -march=native -ffree-line-length-0 -cpp -DXS -DISO -DLIBXC -fopenmp -DUSEOMP -Ifinclude -c …/…/src/errors_warnings/trace.F90
gfortran -O3 -march=native -ffree-line-length-0 -cpp -DXS -DISO -DLIBXC -fopenmp -DUSEOMP -Ifinclude -c …/…/src/src_mpi/modmpi.F90
gfortran -O3 -march=native -ffree-line-length-0 -cpp -DXS -DISO -DLIBXC -fopenmp -DUSEOMP -Ifinclude -c …/…/src/constants/unit_conversion.f90
gfortran -O3 -march=native -ffree-line-length-0 -cpp -DXS -DISO -DLIBXC -fopenmp -DUSEOMP -Ifinclude -c …/…/src/mod_APW_LO.F90
…/…/src/mod_APW_LO.F90:87:10:

87 | Use modinput
| 1
Fatal Error: Cannot open module file ‘modinput.mod’ for reading at (1): No such file or directory
compilation terminated.
make[3]: *** [Makefile.mkmf:962: mod_APW_LO.o] Error 1
make[3]: Leaving directory ‘/home/parallels/Documents/EXCITING/exciting_oxygen/exciting/build/smp’
make[2]: *** […/Make.common:59: bin] Error 2
make[2]: Leaving directory ‘/home/parallels/Documents/EXCITING/exciting_oxygen/exciting/build/smp’
make[1]: *** [Makefile:11: all] Error 2
make[1]: Leaving directory ‘/home/parallels/Documents/EXCITING/exciting_oxygen/exciting/build/smp’
make: *** [Makefile:23: smp] Error 2

and then the compilation stops. Using the gfortran --version command I see that I get GNU Fortran (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
as the version of gfortran that I am using.
Any help with the compilation will be highly appreciated.

Kind regards,
Louis Maduro

Hi Louis,

modinput is auto-generated from the schema using xsltproc. Can you check you have xsltproc installed?

You can see the expected files (modinput is in inputmodules.f90) in Make.common:

GeneratedFiles = ../../src/src_inputparser/inputmodules.f90 ../../src/src_inputparser/speciesmodules.f90
...
xsltproc ../../xml/schematofortran.xsl   ../../xml/excitinginput.xsd > ../../src/src_inputparser/inputmodules.f90

If you’re still having problems, I’m currently working on a docker build for Ubuntu. I should have some more insight in a couple of weeks.

More to the point, a) you don’t need to use Parallels, exciting is compilable on mac and b) a virtual machine will be very slow. You’re much better off using docker. We provide several base Dockerfiles in
build/utilities/docker

Cheers,
Alex

Dear Alex,

Thanks for the fast reply. I checked and indeed xsltproc was not installed. I used sudo apt install to install xsltproc and then tried to recompile, however I get the same error.

Concerning compilation on mac:
I followed the steps and tried to compile using make serial, however I got the following error:

checking for which C type corresponds to Fortran integer… configure: error: in `/Home/Documents/EXCITING/exciting/src/libXC’:

configure: error: C program failed to find the C type of a Fortran integer

See `config.log’ for more details

make[2]: *** [lib/libxc.a] Error 1

make[1]: *** [all] Error 2

make: *** [serial] Error 2

The make.inc file has the following lines:

FCC = gcc
CPP = gfortran
FCCPP = gfortran
F90 = gfortran
F77 = $(F90)
F90_OPTS = -O3 -fopenmp -DUSEOMP -ffree-line-length-0
F77_OPTS = $(F90_OPTS)
CPP_ON_OPTS = -cpp -DXS -DISO -DLIBXC
LIB_ARP = libarpack.a
# uncomment this line in case you want to use external LAPACK/BLAS library
#export USE_SYS_LAPACK=true
LIB_LPK = -L./ -llapack -lblas
LIB_FFT = fftlib.a
LIB_BZINT = libbzint.a

LIBS = $(LIB_ARP) $(LIB_LPK) $(LIB_FFT) $(LIB_BZINT)

F90_DEBUGOPTS = -g -fbounds-check -fbacktrace -Wall
F77_DEBUGOPTS = $(F90_DEBUGOPTS)

#Ignore if you don't have MPI or smplibs

MPIF90 = mpif90
MPIF90_OPTS = $(F90_OPTS) $(CPP_ON_OPTS) -DMPI -DMPIRHO -DMPISEC
F77MT = $(F77)
F90MT = $(F90)
SMP_LIBS = $(LIBS)
SMPF90_OPTS = -fopenmp $(F90_OPTS)
SMPF77_OPTS = $(SMPF90_OPTS)

BUILDMPI=false
BUILDSMP=false
BUILDMPI = false

Again, thanks for the help.
Kind regards,
Louis

Hi Luigi,

W.r.t. compiling on Ubuntu. A couple of group members had exactly the same problem. The hacky way of solving it is to scrap the exciting folder and clone it again, then try building (having installed xsltproc first). I guess something is persisting even after make clean. Let me know if this works.

W.r.t. building on mac, it does not look like you’ve looked at the document or existing make.inc for Mac. I’m guessing the problem is FCCPP=gfortran. Replace with FCCPP=cpp. This is specified in the make.inc: # Required for compilation of LibXC. Maybe I should make that more explicit that LibXC must be compiled with the C preprocessor.

More generally, you should specify which Mac OS you’re on. But in general, I can’t provide support for multiple Mac OS’s as I do not have a means of testing builds on them. Sorry about that.

Cheers,
Alex

Hi Alex,

W.r.t. Ubuntu: using your suggestion of scrapping the directory and using a new folder (with xsltproc already installed) has led to succesful compilation of the code, thank you for the advice!

W.r.t. compilation on mac: I am now using MacOS Monterey 12.4. I tried doing the same thing with the mac compilation(deleting the folder and trying to compile in a new folder) with the make.inc template for mac gfortran ( the command “gfortran --version” gives “GNU Fortran (Homebrew GCC 11.2.0) 11.2.0” ). However, now the error is something else.
The error now given is

gfortran -O3 -fopenmp -DUSEOMP -ffree-line-length-0 -c …/…/src/LAPACK/zgelss.f
…/…/src/LAPACK/zgelss.f:485:40:

288 | CALL ZGEBRD( MM, N, A, LDA, S, DUM(1), DUM(1),
| 2

485 | CALL ZGEBRD( MM, N, A, LDA, S, RWORK( IE ), WORK( ITAUQ ),
| 1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(8)/COMPLEX(8)).
…/…/src/LAPACK/zgelss.f:587:51:

288 | CALL ZGEBRD( MM, N, A, LDA, S, DUM(1), DUM(1),
| 2

587 | CALL ZGEBRD( M, M, WORK( IL ), LDWORK, S, RWORK( IE ),
| 1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(8)/COMPLEX(8)).
…/…/src/LAPACK/zgelss.f:682:39:

288 | CALL ZGEBRD( MM, N, A, LDA, S, DUM(1), DUM(1),
| 2

682 | CALL ZGEBRD( M, N, A, LDA, S, RWORK( IE ), WORK( ITAUQ ),
| 1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(8)/COMPLEX(8)).
make[3]: *** [zgelss.o] Error 1
make[2]: *** [liblapack.a] Error 2
make[1]: *** [all] Error 2
make: *** [serial] Error 2

I understand the build problem, it seems that trying to compile other DFT codes (such as WIEN2k) also prove to be problematic on macs.

Kind regards,
Luigi

This is nothing to do with Mac, and is indeed documented in the README, the gfortran template and build/platforms/os_mac/README.md

At the time of writing, GCC 11 didn’t exist. I need to update it to say

GCC 10 and above

# Example make.inc file for GCC
#
# NOTE: If compiling with GCC 10 append F90_OPTS and F90_DEBUGOPTS with:
# -fallow-argument-mismatch
# See here for more details: https://gcc.gnu.org/gcc-10/porting_to.html

Note, this should also be applied to the F77 flags.

With that said, I can’t test with GCC 11 with MacOS Monterey 12.4 so if you run into problems I haven’t seen, I can’t help.

Cheers,
Alex