Skip to content

3.15.0a1 rewrites sysconfig-saved flags on make install #140454

Closed

Description

@hroncok

Bug report

Bug description:

In Fedora, we have built the Python 3.15.0a1 release as we normally do. It results in broken sysconfig flags that prevent building 3rd-party extension modules.

There are some RPM-specific CFLAGS and LDFLAGS that we use to build Python, but we don't want them exposed to our users via sysconfig because it would break their build. One of such flags is -specs=/usr/lib/rpm/redhat/redhat-package-notes, but there are others. When such flags are used outside of RPM build, it fails:

$ git clone https://github.com/fedora-python/crypt_r.git && cd crypt_r
$ tox -e py315
...
      building '_crypt_r' extension
      creating build/temp.linux-x86_64-cpython-315/src
      gcc -Werror=incompatible-pointer-types -fPIC -I/home/churchyard/.cache/uv/builds-v0/.tmpPUr6Gz/include -I/usr/include/python3.15 -c src/_crypt_r.c -o build/temp.linux-x86_64-cpython-315/src/_crypt_r.o
      gcc -shared -Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
      -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes -Werror=incompatible-pointer-types build/temp.linux-x86_64-cpython-315/src/_crypt_r.o -L/usr/lib64 -lcrypt -o
      build/lib.linux-x86_64-cpython-315/_crypt_r.cpython-315-x86_64-linux-gnu.so
...
      gcc: fatal error: environment variable ‘RPM_ARCH’ not defined
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1

That's why we set those flags in the CFLAGS_NODIST, LDFLAGS_NODIST only. However:

$ python3.15
...
>>> for k, v in sysconfig.get_config_vars().items():
...     if '-specs=/usr/lib/rpm/redhat/redhat-package-notes' in str(v):
...         print(k, v)
...         
BLDSHARED gcc -shared -Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes
CONFIGURE_LDFLAGS_NODIST -Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  -g  -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -g
LDCXXSHARED g++ -shared -Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes
LDFLAGS -Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes
LDSHARED gcc -shared -Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes
PY_CORE_LDFLAGS -Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes -Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  -g  -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -g
PY_LDFLAGS -Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes
PY_LDFLAGS_NODIST -Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  -g  -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -g
PY_LDFLAGS_NOLTO -Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes -fno-lto

Compare with:

$ python3.14
...
>>> for k, v in sysconfig.get_config_vars().items():
...     if '-specs=/usr/lib/rpm/redhat/redhat-package-notes' in str(v):
...         print(k, v)
...         
CONFIGURE_LDFLAGS_NODIST -Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  -g  -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -g
PY_CORE_LDFLAGS -Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  -g  -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -g -Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  -g
PY_LDFLAGS_NODIST -Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  -g  -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -g -Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  -g
PY_LDFLAGS_NOLTO -fno-lto -Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  -g

I was not yet able to reproduce this behavior outside of our RPM build of Python, which makes bisecting this harder. We set the flags like this:

+ CFLAGS='-fcf-protection -fexceptions '
+ export 'CFLAGS_NODIST= -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer  -D_GNU_SOURCE -fPIC -fwrapv'
+ CFLAGS_NODIST=' -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer  -D_GNU_SOURCE -fPIC -fwrapv'
+ export 'CXXFLAGS=-fcf-protection -fexceptions '
+ CXXFLAGS='-fcf-protection -fexceptions '
++ pkg-config --cflags-only-I libffi
+ export CPPFLAGS=
+ CPPFLAGS=
+ export 'OPT=-fcf-protection -fexceptions '
+ OPT='-fcf-protection -fexceptions '
++ pkg-config --cflags openssl
+ export 'CFLAGS=-fcf-protection -fexceptions  '
+ CFLAGS='-fcf-protection -fexceptions  '
++ pkg-config --libs-only-L openssl
+ export 'LDFLAGS= '
+ LDFLAGS=' '
++ pkg-config --libs-only-L openssl
+ export 'LDFLAGS_NODIST=-Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  -g '
+ LDFLAGS_NODIST='-Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  -g '
...
+ /builddir/build/BUILD/python3.15-3.15.0_a1-build/Python-3.15.0a1/configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --runstatedir=/run --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-platlibdir=lib64 --enable-ipv6 --enable-shared --with-computed-gotos=yes --with-dbmliborder=gdbm:ndbm:bdb --with-system-expat --with-system-libmpdec --enable-loadable-sqlite-extensions --with-dtrace --with-lto --with-ssl-default-suites=openssl --without-static-libpython --with-wheel-pkg-dir=/usr/share/python-wheels --with-valgrind --without-ensurepip --enable-experimental-jit=yes-off --enable-optimizations
...
+ /usr/bin/make -O -j32 V=1 VERBOSE=1 EXTRA_CFLAGS=-O3 'CFLAGS_NODIST= -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer  -D_GNU_SOURCE -fPIC -fwrapv -O3' regen-all PYTHON_FOR_REGEN=python3.15
...
+ /usr/bin/make -O -j32 V=1 VERBOSE=1 EXTRA_CFLAGS=-O3 'CFLAGS_NODIST= -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer  -D_GNU_SOURCE -fPIC -fwrapv -O3'

Now I'm trying to see if reverting 9e3542a makes a difference.

CPython versions tested on:

3.15

Operating systems tested on:

Linux

Linked PRs

Activity

  1. hroncok commented on Oct 22, 2025

    @hroncok
    ContributorAuthor

    Now I'm trying to see if reverting 9e3542a makes a difference.

    No difference.

  2. hroncok commented on Oct 22, 2025

    @hroncok
    ContributorAuthor

    The installed /usr/lib64/python3.15/_sysconfigdata__linux_x86_64-linux-gnu.py is already busted.

  3. hroncok commented on Oct 22, 2025

    @hroncok
    ContributorAuthor

    The build/lib.linux-x86_64-3.15/_sysconfigdata__linux_x86_64-linux-gnu.py is created as expected (e.g. empty PY_LDFLAGS) and later during make install or shortly after that, the files is updated (e.g. PY_LDFLAGS is populated) :/

  4. hroncok commented on Oct 22, 2025

    @hroncok
    ContributorAuthor

    The difefrence between 3.14 and 3.15 is that Written build/lib.linux-x86_64-3.15/_sysconfigdata__linux_x86_64-linux-gnu.py happens in make install as well. And here we did not bother setting the flags. I still am unable to reproduce this locally somehow.

  5. hroncok commented on Oct 22, 2025

    @hroncok
    ContributorAuthor

    Indeed, when exporting the same set of flags for make install, the leak does not happen. However, I was not yet able to determine what exactly triggers the re-generation of _sysconfigdata__linux_x86_64-linux-gnu.py during make install.

  6. changed the title [-]3.15.0a1 leaks NODIST flags to other sysconfig-saved flags[/-] [+]3.15.0a1 rewrites sysconfig-saved flags on make install[/+] on Oct 22, 2025
  7. hroncok commented on Oct 22, 2025

    @hroncok
    ContributorAuthor

    OK, I isolated the problem to enabling the JIT.

    $ export LDFLAGS=' '
    $ export LDFLAGS_NODIST='-Wl,--as-needed -g '
    $ ./configure --config-cache --without-ensurepip --enable-experimental-jit=yes-off
    $ make -j12  # or your CPU count
    $ cp build/lib.linux-x86_64-3.15/_sysconfigdata__linux_x86_64-linux-gnu.py make._sysconfigdata__linux_x86_64-linux-gnu.py
    

    Then, in a fresh shell:

    # set a  slightly different set of flags, e.g.
    $ export LDFLAGS='-Wl,--as-needed -g '
    $ make install DESTDIR=/tmp/python
    python3.15 ./Tools/jit/build.py x86_64-pc-linux-gnu --output-dir . --pyconfig-dir . --cflags="" --llvm-version=""
    
    ===============================================================
    JIT support for x86_64-unknown-linux-gnu is still experimental!
                Please report any issues you encounter.            
    ===============================================================
    
    gcc ...
    

    I did not expect make install to recompile the JIT. It did not do that on 3.14 -- I'll try bisecting that.

    $ diff -u make._sysconfigdata__linux_x86_64-linux-gnu.py build/lib.linux-x86_64-3.15/_sysconfigdata__linux_x86_64-linux-gnu.py
    
    --- make._sysconfigdata__linux_x86_64-linux-gnu.py	2025-10-22 23:47:47.613945167 +0200
    +++ build/lib.linux-x86_64-3.15/_sysconfigdata__linux_x86_64-linux-gnu.py	2025-10-22 23:48:15.259119800 +0200
    @@ -19,7 +19,7 @@
         'BINDIR': '/usr/local/bin',
         'BINLIBDEST': '/usr/local/lib/python3.15',
         'BLDLIBRARY': 'libpython3.15.a',
    -    'BLDSHARED': 'gcc -shared',
    +    'BLDSHARED': 'gcc -shared -Wl,--as-needed -g',
         'BOOTSTRAP_HEADERS': '\\',
         'BUILDEXE': '',
         'BUILDPYTHON': 'python',
    @@ -642,11 +642,12 @@
         'IO_OBJS': '\\',
         'IPHONEOS_DEPLOYMENT_TARGET': '',
         'JIT_DEPS': '\\',
    -    'LDCXXSHARED': 'g++ -shared',
    -    'LDFLAGS': '',
    +    'LDCXXSHARED': 'g++ -shared -Wl,--as-needed -g',
    +    'LDFLAGS': '-Wl,--as-needed -g',
    +    'LDFLAGS_NODIST': '',
         'LDLIBRARY': 'libpython3.15.a',
         'LDLIBRARYDIR': '',
    -    'LDSHARED': 'gcc -shared',
    +    'LDSHARED': 'gcc -shared -Wl,--as-needed -g',
         'LDVERSION': '3.15',
         'LIBC': '',
         'LIBDEST': '/usr/local/lib/python3.15',
    @@ -982,8 +983,8 @@
         'PY_CPPFLAGS': '-I. -I./Include',
         'PY_ENABLE_SHARED': 0,
         'PY_HAVE_PERF_TRAMPOLINE': 1,
    -    'PY_LDFLAGS': '',
    -    'PY_LDFLAGS_NODIST': '-Wl,--as-needed -g -Wl,--as-needed -g',
    +    'PY_LDFLAGS': '-Wl,--as-needed -g',
    +    'PY_LDFLAGS_NODIST': '-Wl,--as-needed -g',
         'PY_LDFLAGS_NOLTO': '-Wl,--as-needed -g',
         'PY_SQLITE_ENABLE_LOAD_EXTENSION': 0,
         'PY_SQLITE_HAVE_SERIALIZE': 0,
  8. hroncok commented on Oct 22, 2025

    @hroncok
    ContributorAuthor

    git bisect says 85c1ef6

    The nature of that change makes me believe that's very much the likely cause.

    cc @savannahostrowski

  9. hroncok commented on Oct 22, 2025

    @hroncok
    ContributorAuthor

    Note that in Fedora, we have solved this by ensuring the same CFLAGS/LDFLAGS environment variables are set during make and make install. Yet I believe this might be considered problematic anyway.

  10. savannahostrowski commented on Oct 23, 2025

    @savannahostrowski
    Member

    Okay, so after much spelunking, I think I've found the issue...

    In #137265, I introduced a dual-target rule to prevent stale platform-specific stencil files. This exposed an issue with including pyconfig.h in JIT_DEPS. With the dual-target rule, Make checks whether both stencil files are newer than all dependencies in JIT_DEPS:

    JIT_DEPS = \
        $(srcdir)/Tools/jit/*.c \
        $(srcdir)/Tools/jit/*.py \
        $(srcdir)/Python/executor_cases.c.h \
        pyconfig.h
    
    jit_stencils.h @JIT_STENCILS_H@: $(JIT_DEPS)
    	@REGEN_JIT_COMMAND@
    

    If pyconfig.h has a newer timestamp than either stencil file during make install, Make rebuilds the JIT stencils. This triggers rebuilds that ultimately cause _sysconfigdata to regenerate. When _sysconfigdata regenerates during install, it picks up build-only flags like LDFLAGS_NODIST that shouldn't be in the installed configuration.

    I think we can remove pyconfig.h from JIT_DEPS. We don't need it there since Python/jit.c already includes Python.h, which pulls in pyconfig.h.

  11. savannahostrowski commented on Oct 23, 2025

    @savannahostrowski
    Member

    #140491 (comment)

    We might need a person with more expertise in Makefiles/our build process to help debug here, since I am unable to repro.

  12. 4 remaining items

  13. hroncok commented on Oct 25, 2025

    @hroncok
    ContributorAuthor

    Thanks, I'll try your test as soon as I get to my computer.

    This may require the exact Fedora RPM build environment to trigger the bug.

    I am reproducing this consistently outside of the RPM build environment, on my x86_64 Fedora 41 workstation. I haven't checked if this also happened in the RPM build for aarch64, will do to ensure this isn't x86_64 specific.

  14. hroncok commented on Oct 25, 2025

    @hroncok
    ContributorAuthor

    I haven't checked if this also happened in the RPM build for aarch64, will do to ensure this isn't x86_64 specific.

    This also happened on aarch64.

  15. hroncok commented on Oct 25, 2025

    @hroncok
    ContributorAuthor

    Building from https://github.com/savannahostrowski/cpython/tree/jit-make-test-fix does not make a difference for me.

  16. changed the title [-]3.15.0a1 rewrites sysconfig-saved flags on make install[/-] [+]3.15.0a1 rewrites sysconfig-saved flags on `make install`[/+] on Oct 25, 2025
  17. hroncok commented on Oct 25, 2025

    @hroncok
    ContributorAuthor

    @befeleme Could you please check if you are able to reproduce this locally (maybe my instructions omit some important setup I have)?

  18. brandtbucher commented on Oct 26, 2025

    @brandtbucher
    Member

    Catching up on this thread. Just thought I'd emphasize that we shouldn't remove pyconfig.h from the JIT dependencies in the build system, since the JIT stencils themselves depend on pyconfig.h. If that file changes, the stencils must be recompiled.

  19. befeleme commented on Oct 30, 2025

    @befeleme
    Contributor

    @befeleme Could you please check if you are able to reproduce this locally (maybe my instructions omit some important setup I have)?

    I have successfully repeated steps described in #140454 (comment) on my Fedora 41 x86_64 machine and the resulting diff looks exactly the same as posted there. I used CPython's v3.15.0a1 tag for testing.

  20. hroncok commented on Oct 31, 2025

    @hroncok
    ContributorAuthor

    Running make install over and over again keeps compiling the JIT.

    It says so immediately when it starts:

    $ rm /tmp/python/ -rf; make install DESTDIR=/tmp/python
    python3.15 ./Tools/jit/build.py x86_64-pc-linux-gnu --output-dir . --pyconfig-dir . --cflags="" --llvm-version=""
    ...
    

    I looked into it -- my configure-generated Makefile has:

    jit_stencils.h jit_stencils-x86_64-pc-linux-gnu.h: $(JIT_DEPS)
    	$(PYTHON_FOR_REGEN) $(srcdir)/Tools/jit/build.py x86_64-pc-linux-gnu --output-dir . --pyconfig-dir . --cflags="" --llvm-version=""
    
    Python/jit.o: $(srcdir)/Python/jit.c jit_stencils-x86_64-pc-linux-gnu.h
    	$(CC) -c $(PY_CORE_CFLAGS) -o $@ $<
    

    Notice, namely, the jit_stencils-x86_64-pc-linux-gnu.h filename in the dependency.

    I don't have that file. I only have jit_stencils-x86_64-unknown-linux-gnu.h. The python3.15 ./Tools/jit/build.py command says x86_64-pc-linux-gnu.

    If I do cp -a jit_stencils-x86_64-unknown-linux-gnu.h jit_stencils-x86_64-pc-linux-gnu.h, the JIT is not compiled again.

    I believe the filename used in the Makefile dependency is from JIT_STENCILS_H="jit_stencils-$host.h" in configure.ac. The argument for Tools/jit/build.py is ${ARCH_TRIPLES:-$host} which expands to x86_64-pc-linux-gnu as well. But it outputs jit_stencils-x86_64-unknown-linux-gnu.h.

  21. hroncok commented on Oct 31, 2025

    @hroncok
    ContributorAuthor

    I believe this is a mismatch with

    elif re.fullmatch(r"x86_64-.*-linux-gnu", host):
    host = "x86_64-unknown-linux-gnu"

  22. added 2 commits that reference this issue on Oct 31, 2025
  23. added a commit that references this issue on Nov 4, 2025
  24. added a commit that references this issue on Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.15bugs and security fixesbuildThe build process and cross-buildtopic-sysconfigtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions