I am trying to compile a simple fortran program that uses libxc.
PROGRAM example_basicF90
USE xc_f90_lib_m ! XCs, types and functions
IMPLICIT NONE
INTEGER :: i, vmajor, vminor, vmicro
CALL xc_f90_version(vmajor, vminor, vmicro)
WRITE(*,100) vmajor, vminor, vmicro
100 FORMAT("Libxc version: ",I1,"."I1"."I1)
END PROGRAM
I have compiled libxc using gcc/9.2.0 following the instructions provided on the git repo Without any issues
./configure --prefix=/scratch/Applications/libxc/libxc-6.0.0/GCC
make
make check
make install
The issue I encounter is when I try to compile the simple code.
export LD_LIBXC=/scratch/Applications/libxc/libxc-6.0.0/GCC
gfortran -o example_basic -L${LD_LIBXC}/lib -lxcf90 -lxc -I${LD_LIBXC}/include example_basic.f90
example_basic.f90:(.text+0x1e): undefined reference to `__xc_f90_lib_m_MOD_xc_f90_version'
I double checked the lib and include directories for the correct files, and everything seems appropriate:
ls ${LD_LIBXC}/lib
libxc.a libxcf03.a libxcf03.la libxcf90.a libxcf90.la libxc.la pkgconfig
$ ls ${LD_LIBXC}/include
libxc.bib xc_f03_lib_m.mod xc_f90_lib_m.mod xc_funcs.h xc_funcs_removed.h xc_funcs_worker.h xc.h xc_version.h
Any help is appreciated. Thanks