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
派生
35.9k
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 摘要。