Closed
Description
Bug report
Bug description:
Building CPython main for WASI in quay.io/tiran/cpythonbuild:emsdk3
results in:
../../Parser/tokenizer/file_tokenizer.c:156:9: error: implicit declaration of function 'lseek' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
lseek(fd, (off_t)(pos > 0 ? pos - 1 : pos), SEEK_SET) == (off_t)-1) {
^
../../Parser/tokenizer/file_tokenizer.c:156:9: note: did you mean 'fseek'?
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/stdio.h:95:5: note: 'fseek' declared here
int fseek(FILE *, long, int);
^
../../Parser/tokenizer/file_tokenizer.c:395:12: error: implicit declaration of function 'read' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
return read(b.fd, (void *)buf, size);
^
../../Parser/tokenizer/file_tokenizer.c:395:12: note: did you mean 'fread'?
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/stdio.h:102:8: note: 'fread' declared here
size_t fread(void *__restrict, size_t, size_t, FILE *__restrict);
^
2 errors generated.
This seems to be due to GH-110684, which moved the unistd.h
import to the top during the refactoring. The import is now happening before pyconfig.h
is included, so HAVE_UNISTD_H
may be undefined.
Old code:
Lines 4 to 12 in eb50cd3
New code:
cpython/Parser/tokenizer/file_tokenizer.c
Lines 1 to 9 in 01481f2
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response