Skip to content

Fix: compile lr_io_krlist.cpp only with LibRI to repair non-EXX build - #7973

Merged
mohanchen merged 1 commit into
deepmodeling:developfrom
goodchong:fix-lr-krlist-libri
Sep 16, 2026
Merged

mohanchen merged 1 commit into
deepmodeling:developfrom
goodchong:fix-lr-krlist-libri

Conversation

@goodchong

@goodchong goodchong commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Builds configured with ENABLE_LIBRI=OFF fail with:

source/source_lcao/module_ri/ri_util.h:12:10: fatal error: RI/global/Array_Operator.h: No such file or directory

source/source_lcao/module_lr/utils/lr_io_krlist.cpp (added in #7849) is compiled unconditionally as part of the lr object library, and it unconditionally includes source_lcao/module_ri/ri_util.h, which pulls in LibRI headers (RI/global/Array_Operator.h, RI/global/Global_Func-2.h, RI/global/Tensor.h). CI does not catch this because CI builds enable LibRI.

Fix

lr_io_krlist.cpp only implements BSE / RI-benchmark helpers (LR_IO::RI_kRlist). Every consumer of these symbols is already guarded:

  • ESolver_BSE (esolver_lr_lcao_bse.cpp) is compiled only under ENABLE_LIBRI, and its instantiation in esolver_factory.cpp is #ifdef __EXX-guarded, falling back to WARNING_QUIT("ESolver", "BSE requires ENABLE_LIBRI=ON");
  • the RI benchmark path in module_lr/hamilt_casida.h (RI_kRlist usage at lines 76/90) is inside #ifdef __EXX;
  • the LRI readers in module_lr/utils/lr_io.{h,cpp} that take RI_kRlist& are inside #ifdef __EXX.

So this PR simply moves utils/lr_io_krlist.cpp into an if(ENABLE_LIBRI) block in source/source_lcao/module_lr/CMakeLists.txt. lr_io_krlist.h itself has no LibRI dependency and stays includable from lr_io.h in all configurations.

No behavior change: the file is untouched, and the LibRI-on build compiles exactly the same objects as before.

utils/lr_io_krlist.cpp unconditionally includes module_ri/ri_util.h,
which pulls in LibRI headers (RI/global/Array_Operator.h etc.), so any
build with ENABLE_LIBRI=OFF fails with a fatal missing-header error.

The file only implements BSE/RI-benchmark helpers (LR_IO::RI_kRlist);
every consumer (ESolver_BSE, the RI benchmark path in hamilt_casida.h,
the LRI readers in lr_io.cpp) is already guarded by __EXX, so exclude
it from the lr object library unless ENABLE_LIBRI is on. In non-EXX
builds, selecting xc_kernel=bse still hits the existing runtime guard
"BSE requires ENABLE_LIBRI=ON" in esolver_factory.cpp.
@mohanchen
mohanchen merged commit f4ce8f7 into deepmodeling:develop Sep 16, 2026
18 checks passed
@mohanchen mohanchen added the Compile & CICD & Docs & Dependencies Issues related to compiling ABACUS label Sep 16, 2026
@goodchong
goodchong deleted the fix-lr-krlist-libri branch September 23, 2026 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Compile & CICD & Docs & Dependencies Issues related to compiling ABACUS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants