[New-bugs-announce] [issue36162] error: implicit declaration of function 'sendfile' is invalid in C99

muhzi report at bugs.python.org
Fri Mar 1 17:00:18 EST 2019


New submission from muhzi <air.oamyst517 at yahoo.com>:

I encountered yet another issue with cross compilation on android, it so happens that these errors occur only when I cross compile for non 64-bit archs. i.e. I could cross compile just fine for arm64 & x86_64 but the 32-bit version of these archs produces the following error during compilation:

./Modules/posixmodule.c:8457:19: error: implicit declaration of function 'sendfile' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            ret = sendfile(out, in, NULL, count);
                  ^
./Modules/posixmodule.c:8457:19: warning: this function declaration is not a prototype [-Wstrict-prototypes]
./Modules/posixmodule.c:8470:15: error: implicit declaration of function 'sendfile' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        ret = sendfile(out, in, &offset, count);
              ^
./Modules/posixmodule.c:9057:14: error: implicit declaration of function 'truncate' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    result = truncate(path->narrow, length);
             ^
./Modules/posixmodule.c:9057:14: note: did you mean 'ftruncate'?
/home/muhzi/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/unistd.h:220:5: note: 'ftruncate' declared here
int ftruncate(int __fd, off_t __length) __RENAME(ftruncate64) __INTRODUCED_IN(12);
    ^
./Modules/posixmodule.c:9057:14: warning: this function declaration is not a prototype [-Wstrict-prototypes]
    result = truncate(path->narrow, length);


I attached pyconfig.h for reference, it seems that the configuration step went fine. I checked that these missing functions are able to have their corresponding headers included. Also figured after misplacing some include lines in posixmodule.c that when the preprocessor includes Python.h it fails to include definitions from successively included headers.

----------
components: Cross-Build
files: pyconfig.h
messages: 336958
nosy: Alex.Willmer, muhzi, xdegaye
priority: normal
severity: normal
status: open
title: error: implicit declaration of function 'sendfile' is invalid in C99
versions: Python 3.7
Added file: https://bugs.python.org/file48183/pyconfig.h

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36162>
_______________________________________


More information about the New-bugs-announce mailing list