python / python/cpython

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

Open
#140,317 16 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

build extension-modules OS-android
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Modules/posixmodule.c around the wait3 call reported near line 10400, then reproduce the build with the provided Termux clang sanitizer commands and the no-sanitizer configuration for comparison. Done means CPython compiles with the sanitizer options without the undeclared-function error.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, c, python
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.