Repository navigation
Don't overwrite the installed pyscf's config.h - #221
Open
MatthewRHermes wants to merge 1 commit into
Open
MatthewRHermes wants to merge 1 commit into
MatthewRHermes wants to merge 1 commit into
Conversation
pyscf/lib/CMakeLists.txt ran configure_file on
${PYSCF_SOURCE_DIR}/lib/config.h.in with forge's own CMake variables
and wrote the result to ${PYSCF_SOURCE_DIR}/lib/config.h, i.e. into
the installed pyscf. Forge does not define XCFUN_MAX_ORDER, so every
forge build replaced core's "#define XCFUN_MAX_DERIV_ORDER 3" with an
empty definition, which core's dft/xcfun_itrf.c cannot compile against.
Use pyscf's config.h as installed. It has shipped in wheels since
pyscf 2.2; only older wheels (e.g. 2.1.1, whose config.h.in has no
XCFUN macro) lack it, and in that case generate it in the build
directory instead.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR oops I made this package overwrite stuff from another package at configure time 3 years ago, let's fix that
pyscf/lib/CMakeLists.txtrunsconfigure_fileon${PYSCF_SOURCE_DIR}/lib/config.h.inand writes the result to${PYSCF_SOURCE_DIR}/lib/config.h, i.e. into the installed pyscf. Since the template is filled in with forge's CMake variables, and forge does not defineXCFUN_MAX_ORDER, every forge build replaces core'swith
For a pip-installed pyscf this silently edits a file in site-packages. For a source-built pyscf, it leaves core's
dft/xcfun_itrf.c(int XCFUN_max_deriv_order = XCFUN_MAX_DERIV_ORDER;) unable to compile until core is reconfigured. The file is gitignored in pyscf, sogit statusdoesn't show it.This line was added in #8 because the pyscf wheels of the time shipped only
config.h.in. That is no longer the case:config.h.inconfig.hThis PR uses pyscf's
config.has installed, so forge sees the values pyscf was actually built with. Only if it is missing (pyscf < 2.2) is it generated, into the build directory, which goes first on the include path. In that case there is no XCFUN macro to get wrong: 2.1.1'sconfig.h.indoesn't have one. No forge C code currently usesXCFUN_MAX_DERIV_ORDERorHAVE_FFS; the files that includeconfig.h(lno/ccsd_t.c,lno/uccsd_t.c,pwscf/pwscf.c,dsrg/dsrg_helper.c) only need the OpenMP stubs.Tested locally (Linux, CMake 4.3.2, conda env with a source-built pyscf 2.14.0):
config.h: build succeeds and the installedconfig.his unchanged (md5 before/after); master overwrites it in the same setup. All 8 forge.sofiles have disassembly identical to a master build.config.h(-DPYSCF_SOURCE_DIRpointed at a copy of core'slib/minusconfig.h):config.his generated in the build directory, nothing is written to the pyscf copy, build succeeds.(PR composed by Claude Opus 5.5 following a conversation with me locally)
🤖 Generated with Claude Code