Skip to content

Compiling 3.13.1 fails when /usr/local/include/pyconfig.h is outdated #129019

@dilyanpalauzov

Description

@dilyanpalauzov

Compiling Python 3.13.1 with

$ ./configure --with-lto --enable-shared --without-static-libpython --prefix=/root/chroot-n/python --disable-ipv6 --enable-optimizations CFLAGS='--sysroot=/root/chroot-n  -Ichr/include -Wl,--dynamic-linker=/chr/lib/ld-linux-x86-64.so.2'
$ make

prints

make profile-gen-stamp                                                                                                 
make[1]: Entering directory '/src/chroot/Python-3.13.1'                                                                                 
Building with support for profile generation:                                                                                           
make build_all CFLAGS_NODIST=" -fprofile-generate" LDFLAGS_NODIST=" -fprofile-generate" LIBS="-ldl "                                    
make[2]: Entering directory '/src/chroot/Python-3.13.1'                                                                                 
gcc -DUSE_ZLIB_CRC32 -I/usr/local/include -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall --sysroot=/root/chroot-n  -Ichr/include -Wl,--dynamic-linker=/chr/lib/ld-linux-x86-64.so.2   -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-generate -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include   -fPIC -fPIC -c ./Modules/binascii.c -o Modules/binascii.o                                                                                         
In file included from ./Include/Python.h:79,               
                 from ./Modules/binascii.c:60:       
./Include/unicodeobject.h:61:9: warning: "Py_USING_UNICODE" redefined                 
   61 | #define Py_USING_UNICODE                                    
      |         ^~~~~~~~~~~~~~~~
In file included from ./Include/Python.h:14:            
/usr/local/include/pyconfig.h:994:9: note: this is the location of the previous definition
  994 | #define Py_USING_UNICODE 1                                  
      |         ^~~~~~~~~~~~~~~~                                    
./Include/unicodeobject.h:67:9: warning: "Py_UNICODE_SIZE" redefined
   67 | #define Py_UNICODE_SIZE SIZEOF_WCHAR_T
      |         ^~~~~~~~~~~~~~~                                                                                                         
/usr/local/include/pyconfig.h:991:9: note: this is the location of the previous definition
  991 | #define Py_UNICODE_SIZE 2                                                                                                       
      |         ^~~~~~~~~~~~~~~
/usr/local/include/pyconfig.h:982:25: error: two or more data types in declaration specifiers
  982 | #define PY_UNICODE_TYPE unsigned short                                                                                          
      |                         ^~~~~~~~
./Include/cpython/unicodeobject.h:9:37: note: in expansion of macro ‘PY_UNICODE_TYPE’
    9 | Py_DEPRECATED(3.13) typedef wchar_t PY_UNICODE_TYPE;
      |                                     ^~~~~~~~~~~~~~~
/usr/local/include/pyconfig.h:982:34: error: two or more data types in declaration specifiers
  982 | #define PY_UNICODE_TYPE unsigned short
      |                                  ^~~~~
./Include/cpython/unicodeobject.h:9:37: note: in expansion of macro ‘PY_UNICODE_TYPE’
    9 | Py_DEPRECATED(3.13) typedef wchar_t PY_UNICODE_TYPE;
      |                                     ^~~~~~~~~~~~~~~
In file included from ./Include/unicodeobject.h:1014:
./Include/cpython/unicodeobject.h:9:1: warning: useless type name in empty declaration
    9 | Py_DEPRECATED(3.13) typedef wchar_t PY_UNICODE_TYPE;
      | ^~~~~~~~~~~~~
make[2]: *** [Makefile:3346: Modules/binascii.o] Error 1
make[2]: Leaving directory '/src/chroot/Python-3.13.1'
make[1]: *** [Makefile:883: profile-gen-stamp] Error 2
make[1]: Leaving directory '/src/chroot/Python-3.13.1'
make: *** [Makefile:895: profile-run-stamp] Error 2

My /usr/local/include/pyconfig.h is from 2016! After removing it, the compilation progresses.

  • Building Python should not depend on /usr/local/include/pyconfig.h or /usr/include/pyconfig.h, installed from previous Python versions.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildThe build process and cross-buildpendingThe issue will be closed if no feedback is providedtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions