This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: android arm cross compilation fails, config issue
Type: compile error Stage: needs patch
Components: Cross-Build Versions: Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Alex.Willmer, muhzi, p-ganssle
Priority: normal Keywords:

Created on 2019-02-28 11:51 by muhzi, last changed 2022-04-11 14:59 by admin.

Files
File name Uploaded Description Edit
pyconfig.h muhzi, 2019-02-28 11:51
Messages (4)
msg336828 - (view) Author: (muhzi) Date: 2019-02-28 11:51
This is a follow up of #36141, I'm trying to build python for android armv7a.
The problem was the configure script fails to find pthread_create in the android headers. Now after getting past the configuration, I get a build error:

armv7a-linux-androideabi16-clang -c -mfloat-abi=softfp -mfpu=vfpv3-d16 -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall    -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration   -I. -I./Include    -DPy_BUILD_CORE -o Python/pytime.o Python/pytime.c
Python/pytime.c:911:9: error: implicit declaration of function 'pytime_fromtimespec' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if (pytime_fromtimespec(tp, &ts, raise) < 0) {
        ^
Python/pytime.c:911:9: note: did you mean 'pytime_fromtimeval'?
Python/pytime.c:336:1: note: 'pytime_fromtimeval' declared here
pytime_fromtimeval(_PyTime_t *tp, struct timeval *tv, int raise)
^
Python/pytime.c:911:9: warning: this function declaration is not a prototype [-Wstrict-prototypes]
    if (pytime_fromtimespec(tp, &ts, raise) < 0) {
        ^

The declaration for pytime_fromtimespec needs the token HAVE_CLOCK_GETTIME to be defined to 1, which isn't the case (as per pyconfig.h). I checked the android headers and time.h seems to have the necessary function for this token. 

I uploaded pyconfig.h for reference (attached).
msg336832 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2019-02-28 12:46
There is a bug in the implementation of pymonotonic() in Python/pytime.c:

    The call to pytime_fromtimespec() is not encapsulated by an #ifdef HAVE_CLOCK_GETTIME.

@muhzi
It seems that your pyconfig.h is generated with configure failing to find the NDK headers.
msg336833 - (view) Author: (muhzi) Date: 2019-02-28 12:59
Yes, pretty much so, which I think was what caused the pthread problem. Why would it fail to find the headers?
msg336837 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2019-02-28 15:08
Obviously because you do not tell clang where to find those headers.
History
Date User Action Args
2022-04-11 14:59:11adminsetgithub: 80326
2019-12-10 08:06:27xdegayesetnosy: - xdegaye
2019-02-28 15:08:07xdegayesetmessages: + msg336837
2019-02-28 14:05:18p-gansslesetnosy: + p-ganssle
2019-02-28 12:59:54muhzisetmessages: + msg336833
2019-02-28 12:46:23xdegayesetstage: needs patch
2019-02-28 12:46:01xdegayesetmessages: + msg336832
2019-02-28 11:54:53muhzisettitle: android arm cross compilation fails, h -> android arm cross compilation fails, config issue
2019-02-28 11:51:25muhzicreate