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
分支
36k
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 的 include chain。檢查在建置 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 摘要。