Finally, I got back to this. As of now, it seems that I can successfully do:
./configure --enable-experimental-jit=yes-off --enable-optimizations
cp -a .../Python-3.15.0a2-x86_64-optimized-jit_stencils.h jit_stencils-x86_64-unknown-linux-gnu.h
sed -i '/rm -f jit_stencils\*.h/d' Makefile
make ...
And I get a successful build with JIT using pregenerated stencils. No hacks with JIT_DEPS= seem to be necessary. However, I still need to remove this line:
When I build with --enable-optimizations and don’t remove that line from the clean-retain-profile make target, the build deletes my stencils mid-run and then fails with Can't find clang-21!. I wonder if the stencils need to actually be removed during this task. If they are the same before PGO and after PGO, perhaps not? (Will verify this assumption.)