python / python/cpython

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

未关闭
#129,019 19 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

build pending type-bug
主要语言
Python
星标
77.2k
派生
35.9k
PR 合并指标
PR 指标待抓取

描述

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
  • gh-134019

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先复现 configure 和 make 命令,然后检查生成的 Makefile 以及通过 Include/Python.h、Include/unicodeobject.h 和 Include/cpython/unicodeobject.h 的包含链。检查在构建 Modules/binascii.c 时如何选择 /usr/local/include/pyconfig.h。当构建 Python 不再依赖过时的系统 pyconfig.h 文件时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
build-system
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。