Skip to content

Fix: Restore incremental builds with pkg-config ELPA#7662

Merged
mohanchen merged 2 commits into
deepmodeling:developfrom
AsTonyshment:fix/elpa-pkgconfig-incremental
Jul 21, 2026
Merged

Fix: Restore incremental builds with pkg-config ELPA#7662
mohanchen merged 2 commits into
deepmodeling:developfrom
AsTonyshment:fix/elpa-pkgconfig-incremental

Conversation

@AsTonyshment

Copy link
Copy Markdown
Collaborator

What's changed?

PR #7630 used ELPA_LIBRARIES as both a deprecated manual input and an output cached internally by FindPkgConfig. On a later configuration of the same build directory, the cached bare library name such as elpa_openmp was mistaken for a manual override. Because imported targets do not persist between CMake configurations, ELPA::ELPA was then recreated with the bare name as its imported location, causing No rule to make target 'elpa_openmp' during incremental builds.

This change moves pkg-config results to the independent ELPA_PKG prefix and aliases ELPA::ELPA to PkgConfig::ELPA_PKG. A one-time migration removes conflicting ELPA_* cache entries produced by the old implementation, allowing existing build directories to recover without deletion. The deprecated ELPA_DIR and manual include/library discovery path retains its existing search order and imported-target behavior.

Verification: repeated cmake -S . -B <build-dir> and cmake --build <build-dir> --target MODULE_HSOLVER_LCAO -j32 in an existing polluted build directory and a clean build directory; both passed twice, and the generated link command contains the resolved libelpa_openmp.so path. The deprecated manual path was also configured and built successfully with explicit ELPA_DIR, ELPA_INCLUDE_DIR, and ELPA_LIBRARIES values.

Maybe you can have a look @Growl1234, thanks! In the end the old ELPA_DIR logic will be removed when the formal version is released, so it is still an intermediate solution at present in order to make incremental compilation work properly.

Governance Notes

  • Automated tests: none added; repeated same-directory configuration and focused compilation directly exercise this CMake-only regression.
  • INPUT/docs changes: none; no INPUT behavior or metadata is changed.
  • Core module impact: none; no files under source/ are changed.
  • Exceptions requested: none.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a CMake incremental-build regression in ELPA discovery by separating pkg-config outputs from deprecated public ELPA_* inputs and ensuring ELPA::ELPA is consistently backed by a persistent pkg-config imported target across reconfigurations.

Changes:

  • Migrates away from the old ELPA_* pkg-config cache entries by unsetting conflicting internal cache variables once.
  • Switches pkg-config discovery to use an independent ELPA_PKG prefix and maps results back onto the public ELPA_* outputs.
  • Makes ELPA::ELPA an alias of PkgConfig::ELPA_PKG when available, keeping the deprecated manual fallback path intact.

Comment thread cmake/modules/FindELPA.cmake Outdated
@Growl1234

Copy link
Copy Markdown

Looks good. Cannot say I like it, but OK if problem resolved. I didn't care too much about old path since we'll drop these logic and depend totally on pkg-config anyways (see this file).

@mohanchen mohanchen added the Compile & CICD & Docs & Dependencies Issues related to compiling ABACUS label Jul 21, 2026
@mohanchen
mohanchen merged commit 1dd484d into deepmodeling:develop Jul 21, 2026
17 checks passed
@AsTonyshment
AsTonyshment deleted the fix/elpa-pkgconfig-incremental branch July 21, 2026 08:22
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.

5 participants