python / python/cpython

posixmodule "undeclared function" error when compiling with sanitizer options on Termux (Android)

未關閉
#140,317 16 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

build extension-modules OS-android
主要語言
Python
星號
77.2k
分支
36k
PR 合併指標
PR 指標待擷取

描述

Python fails to compile when compiling with the sanitizer option.

Python/fileutils.c:458:1: warning:                  unused function 'decode_current_locale'       [-Wunused-function]                       458 | decode_current_locale(const char* arg...                                                  | ^~~~~~~~~~~~~~~~~~~~~                 
Python/fileutils.c:677:1: warning:                  unused function 'encode_current_locale'       [-Wunused-function]                       677 | encode_current_locale(const wchar_t *t...                                                 | ^~~~~~~~~~~~~~~~~~~~~                 2 warnings generated.                         
./Modules/posixmodule.c:10400:15: error:            call to undeclared function 'wait3'; ISO      C99 and later do not support implicit         function declarations                         [-Wimplicit-function-declaration]        10400 |         pid = wait3(&status, options, &ru);                                               |               ^                      1 error generated.                            make: *** 
[Makefile:3808: Modules/posixmodule.o] Error 1                                    make: *** Waiting for unfinished jobs...

clang option use.

aarch64-linux-android-clang -fsanitize=address -fsanitize=undefined
aarch64-linux-android-clang++ -fsanitize=address -fsanitize=undefined -fno-sanitize=vptr

aarch64-linux-android-clang --version                                  
 clang version 21.1.3                         
 Target: aarch64-unknown-linux-android24       
Thread model: posix                           
InstalledDir: /data/data/com.termux/files/usr/bin
.git revision is at bedaea05987738c4c6b958d19cec9621bec09f07

Compiling with no sanitizer option works.

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 Modules/posixmodule.c 中 10400 行附近回報的 wait3 呼叫處開始,然後使用提供的 Termux clang sanitizer 指令以及不使用 sanitizer 的設定重現建置,以便比較。完成的標準是 CPython 使用 sanitizer 選項進行編譯時不會出現未宣告函式錯誤。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
android, c, python
領域
build-system, operating-systems
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
冷清
描述清晰度
需要釐清
新手友好度
48/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。