Skip to content

QE cmake compilation fails with libxc

Version

  • QE : 7.0
  • Libxc : 5.2.3
  • Cmake : 3.21.1
  • Compiler: Intel oneapi 2022.2

Problem

I have compiled libxc successfully. After that, I started compiling QE with cmake:

mkdir build; cd build
cmake -DCMAKE_C_COMPILER=icx -DCMAKE_Fortran_COMPILER=ifx -DQE_ENABLE_LIBXC=ON -DCMAKE_INSTALL_PREFIX=$homedir ..

It shows that it found libxc:

...
-- Checking for one of the modules 'libxc>=5.1.2'
-- Found Libxc: /public/spst/home/tianff/lib64/libxc.a (Required is at least version "5.1.2") 
-- Libxc version 5.1.2 found.
...

But when I start compiling

make

It fails with the following error:

...
Scanning dependencies of target qe_xc_infos
[ 23%] Building Fortran object XClib/CMakeFiles/qe_xc_infos.dir/qe_dft_refs.f90.o
[ 23%] Building Fortran object XClib/CMakeFiles/qe_xc_infos.dir/xc_infos.f90.o
[ 23%] Linking Fortran executable bin/qe_xc_infos.x
/public/spst/home/tianff/lib64/libxcf03.a(libxc_master.F90.o): In function `xc_f03_lib_m_mp_xc_f03_version_':
ifxHDkN8Q.i90:(.text+0x11): undefined reference to `xc_version'
/public/spst/home/tianff/lib64/libxcf03.a(libxc_master.F90.o): In function `xc_f03_lib_m_mp_xc_f03_version_string_':
ifxHDkN8Q.i90:(.text+0x2b): undefined reference to `xc_version_string'
/public/spst/home/tianff/lib64/libxcf03.a(libxc_master.F90.o): In function `xc_f03_lib_m_mp_xc_f03_reference_':
ifxHDkN8Q.i90:(.text+0x5b): undefined reference to `xc_reference'
/public/spst/home/tianff/lib64/libxcf03.a(libxc_master.F90.o): In function `xc_f03_lib_m_mp_xc_f03_reference_doi_':
ifxHDkN8Q.i90:(.text+0x8b): undefined reference to `xc_reference_doi'
/public/spst/home/tianff/lib64/libxcf03.a(libxc_master.F90.o): In function `xc_f03_lib_m_mp_xc_f03_func_info_get_number_':
ifxHDkN8Q.i90:(.text+0xb4): undefined reference to `xc_func_info_get_number'
...
make[2]: *** [XClib/bin/qe_xc_infos.x] Error 1
make[1]: *** [XClib/CMakeFiles/qe_xc_infos.dir/all] Error 2
make: *** [all] Error 2

Whereas if I just compiled with make, it succeeded. So I don't think it's a problem with libxc .

export CC=icx
export F90=ifx

./configure --with-libxc

make