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: configure: error: could not find pthreads on your system during cross compilation
Type: compile error Stage:
Components: Cross-Build Versions: Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Alex.Willmer, muhzi
Priority: normal Keywords:

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

Files
File name Uploaded Description Edit
config.log muhzi, 2019-02-28 09:57
Messages (6)
msg336779 - (view) Author: (muhzi) Date: 2019-02-27 19:51
I am facing a problem while trying to compile Python for android armv7a using the latest NDK version (clang). The configure script fails to find pthread library, which should be bundled in libc. Here is the full configure output:


Building for armv7a-linux-androideabi
configure: loading site script ./config.site
checking build system type... x86_64-pc-linux-gnu
checking host system type... armv7a-unknown-linux-androideabi
checking for python3.7... python3.7
checking for python interpreter for cross build... python3.7
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... checking for --without-gcc... no
checking for --with-icc... no
checking for armv7a-linux-androideabi-gcc... armv7a-linux-androideabi16-clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether armv7a-linux-androideabi16-clang accepts -g... yes
checking for armv7a-linux-androideabi16-clang option to accept ISO C89... none needed
checking how to run the C preprocessor... armv7a-linux-androideabi16-clang -E
checking for grep that handles long lines and -e... /bin/grep
checking for a sed that does not truncate output... /bin/sed
checking for --with-cxx-main=<compiler>... no
checking for the platform triplet based on compiler characteristics... none
checking for -Wl,--no-as-needed... yes
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for the Android API level... 16
checking for the Android arm ABI... 7
checking for --with-suffix... 
checking for case-insensitive build directory... no
checking LIBRARY... libpython$(VERSION)$(ABIFLAGS).a
checking LINKCC... $(PURIFY) $(MAINCC)
checking for GNU ld... yes
checking for --enable-shared... yes
checking for --enable-profiling... no
checking LDLIBRARY... libpython$(LDVERSION).so
checking for armv7a-linux-androideabi-ar... arm-linux-androideabi-ar
checking for armv7a-linux-androideabi-readelf... arm-linux-androideabi-readelf
checking for a BSD-compatible install... /usr/bin/install -c
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for --with-pydebug... no
checking for --with-assertions... no
checking for --enable-optimizations... no
checking for --with-lto... no
checking for -llvm-profdata... no
checking for -Wextra... yes
checking whether armv7a-linux-androideabi16-clang accepts and needs -fno-strict-aliasing... no
checking if we can turn off armv7a-linux-androideabi16-clang unused result warning... yes
checking if we can turn off armv7a-linux-androideabi16-clang unused parameter warning... yes
checking if we can turn off armv7a-linux-androideabi16-clang missing field initializers warning... yes
checking if we can turn off armv7a-linux-androideabi16-clang invalid function cast warning... no
checking if we can turn on armv7a-linux-androideabi16-clang mixed sign comparison warning... yes
checking if we can turn on armv7a-linux-androideabi16-clang unreachable code warning... yes
checking if we can turn on armv7a-linux-androideabi16-clang strict-prototypes warning... yes
checking if we can make implicit function declaration an error in armv7a-linux-androideabi16-clang... yes
checking whether pthreads are available without options... no
checking whether armv7a-linux-androideabi16-clang accepts -Kpthread... no
checking whether armv7a-linux-androideabi16-clang accepts -Kthread... no
checking whether armv7a-linux-androideabi16-clang accepts -pthread... no
checking whether armv7a-linux-androideabi16-clang++ also accepts flags for thread support... no
checking for ANSI C header files... (cached) yes
checking asm/types.h usability... yes
checking asm/types.h presence... yes
checking for asm/types.h... yes
checking crypt.h usability... no
checking crypt.h presence... no
checking for crypt.h... no
checking conio.h usability... no
checking conio.h presence... no
checking for conio.h... no
checking direct.h usability... no
checking direct.h presence... no
checking for direct.h... no
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking grp.h usability... yes
checking grp.h presence... yes
checking for grp.h... yes
checking ieeefp.h usability... no
checking ieeefp.h presence... no
checking for ieeefp.h... no
checking io.h usability... no
checking io.h presence... no
checking for io.h... no
checking langinfo.h usability... yes
checking langinfo.h presence... yes
checking for langinfo.h... yes
checking libintl.h usability... no
checking libintl.h presence... no
checking for libintl.h... no
checking process.h usability... no
checking process.h presence... no
checking for process.h... no
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking sched.h usability... yes
checking sched.h presence... yes
checking for sched.h... yes
checking shadow.h usability... no
checking shadow.h presence... no
checking for shadow.h... no
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking stropts.h usability... no
checking stropts.h presence... no
checking for stropts.h... no
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking for unistd.h... (cached) yes
checking utime.h usability... yes
checking utime.h presence... yes
checking for utime.h... yes
checking poll.h usability... yes
checking poll.h presence... yes
checking for poll.h... yes
checking sys/devpoll.h usability... no
checking sys/devpoll.h presence... no
checking for sys/devpoll.h... no
checking sys/epoll.h usability... yes
checking sys/epoll.h presence... yes
checking for sys/epoll.h... yes
checking sys/poll.h usability... yes
checking sys/poll.h presence... yes
checking for sys/poll.h... yes
checking sys/audioio.h usability... no
checking sys/audioio.h presence... no
checking for sys/audioio.h... no
checking sys/xattr.h usability... yes
checking sys/xattr.h presence... yes
checking for sys/xattr.h... yes
checking sys/bsdtty.h usability... no
checking sys/bsdtty.h presence... no
checking for sys/bsdtty.h... no
checking sys/event.h usability... no
checking sys/event.h presence... no
checking for sys/event.h... no
checking sys/file.h usability... yes
checking sys/file.h presence... yes
checking for sys/file.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/kern_control.h usability... no
checking sys/kern_control.h presence... no
checking for sys/kern_control.h... no
checking sys/loadavg.h usability... no
checking sys/loadavg.h presence... no
checking for sys/loadavg.h... no
checking sys/lock.h usability... no
checking sys/lock.h presence... no
checking for sys/lock.h... no
checking sys/mkdev.h usability... no
checking sys/mkdev.h presence... no
checking for sys/mkdev.h... no
checking sys/modem.h usability... no
checking sys/modem.h presence... no
checking for sys/modem.h... no
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking sys/random.h usability... yes
checking sys/random.h presence... yes
checking for sys/random.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/sendfile.h usability... yes
checking sys/sendfile.h presence... yes
checking for sys/sendfile.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/statvfs.h usability... yes
checking sys/statvfs.h presence... yes
checking for sys/statvfs.h... yes
checking for sys/stat.h... (cached) yes
checking sys/syscall.h usability... yes
checking sys/syscall.h presence... yes
checking for sys/syscall.h... yes
checking sys/sys_domain.h usability... no
checking sys/sys_domain.h presence... no
checking for sys/sys_domain.h... no
checking sys/termio.h usability... no
checking sys/termio.h presence... no
checking for sys/termio.h... no
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/times.h usability... yes
checking sys/times.h presence... yes
checking for sys/times.h... yes
checking for sys/types.h... (cached) yes
checking sys/uio.h usability... yes
checking sys/uio.h presence... yes
checking for sys/uio.h... yes
checking sys/un.h usability... yes
checking sys/un.h presence... yes
checking for sys/un.h... yes
checking sys/utsname.h usability... yes
checking sys/utsname.h presence... yes
checking for sys/utsname.h... yes
checking sys/wait.h usability... yes
checking sys/wait.h presence... yes
checking for sys/wait.h... yes
checking pty.h usability... yes
checking pty.h presence... yes
checking for pty.h... yes
checking libutil.h usability... no
checking libutil.h presence... no
checking for libutil.h... no
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking netpacket/packet.h usability... yes
checking netpacket/packet.h presence... yes
checking for netpacket/packet.h... yes
checking sysexits.h usability... yes
checking sysexits.h presence... yes
checking for sysexits.h... yes
checking bluetooth.h usability... no
checking bluetooth.h presence... no
checking for bluetooth.h... no
checking linux/tipc.h usability... yes
checking linux/tipc.h presence... yes
checking for linux/tipc.h... yes
checking linux/random.h usability... yes
checking linux/random.h presence... yes
checking for linux/random.h... yes
checking spawn.h usability... yes
checking spawn.h presence... yes
checking for spawn.h... yes
checking util.h usability... no
checking util.h presence... no
checking for util.h... no
checking alloca.h usability... yes
checking alloca.h presence... yes
checking for alloca.h... yes
checking endian.h usability... yes
checking endian.h presence... yes
checking for endian.h... yes
checking sys/endian.h usability... yes
checking sys/endian.h presence... yes
checking for sys/endian.h... yes
checking sys/sysmacros.h usability... yes
checking sys/sysmacros.h presence... yes
checking for sys/sysmacros.h... yes
checking for dirent.h that defines DIR... yes
checking for library containing opendir... no
checking whether sys/types.h defines makedev... no
checking for sys/mkdev.h... (cached) no
checking for sys/sysmacros.h... (cached) yes
checking bluetooth/bluetooth.h usability... no
checking bluetooth/bluetooth.h presence... no
checking for bluetooth/bluetooth.h... no
checking for net/if.h... yes
checking for linux/netlink.h... yes
checking for linux/vm_sockets.h... yes
checking for linux/can.h... yes
checking for linux/can/raw.h... yes
checking for linux/can/bcm.h... yes
checking for clock_t in time.h... yes
checking for makedev... no
checking for le64toh... no
checking for mode_t... yes
checking for off_t... yes
checking for pid_t... yes
checking for size_t... yes
checking for uid_t in sys/types.h... yes
checking for ssize_t... yes
checking for __uint128_t... no
checking size of int... 4
checking size of long... 4
checking size of long long... 8
checking size of void *... 4
checking size of short... 2
checking size of float... 4
checking size of double... 8
checking size of fpos_t... 8
checking size of size_t... 4
checking size of pid_t... 4
checking size of uintptr_t... 4
checking for long double support... yes
checking size of long double... 8
checking size of _Bool... 1
checking size of off_t... 8
checking whether to enable large file support... yes
checking size of time_t... 4
checking for pthread_t... yes
checking size of pthread_t... 4
checking size of pthread_key_t... 4
checking whether pthread_key_t is compatible with int... yes
checking for --enable-framework... no
checking for dyld... no
checking the extension of shared libraries... .so
checking LDSHARED... $(CC) -shared
checking CCSHARED... 
checking LINKFORSHARED... -pie -Xlinker -export-dynamic
checking CFLAGSFORSHARED... $(CCSHARED)
checking SHLIBS... $(LIBS)
checking for sendfile in -lsendfile... no
checking for dlopen in -ldl... no
checking for shl_load in -ldld... no
checking uuid/uuid.h usability... no
checking uuid/uuid.h presence... no
checking for uuid/uuid.h... no
checking uuid.h usability... no
checking uuid.h presence... no
checking for uuid.h... no
checking for uuid_generate_time_safe... no
checking for uuid_create... no
checking for uuid_enc_be... no
checking for library containing sem_init... no
checking for textdomain in -lintl... no
checking aligned memory access is required... yes
checking for --with-hash-algorithm... default
checking for --with-address-sanitizer... no
checking for --with-memory-sanitizer... no
checking for --with-undefined-behavior-sanitizer... no
checking for t_open in -lnsl... no
checking for socket in -lsocket... no
checking for --with-libs... no
checking for armv7a-linux-androideabi-pkg-config... no
checking for pkg-config... /usr/bin/pkg-config
configure: WARNING: using cross tools not prefixed with host triplet
checking pkg-config is at least version 0.9.0... yes
checking for --with-system-expat... yes
checking for --with-system-ffi... yes
configure: WARNING: --with(out)-system-ffi is ignored on this platform
checking for --with-system-libmpdec... no
checking for --enable-loadable-sqlite-extensions... no
checking for --with-tcltk-includes... default
checking for --with-tcltk-libs... default
checking for --with-dbmliborder... 
checking for _POSIX_THREADS in unistd.h... yes
checking for pthread_create in -lpthread... checking for pthread_detach... no
checking for pthread_create in -lpthreads... no
checking for pthread_create in -lc_r... no
checking for __pthread_create_system in -lpthread... no
checking for pthread_create in -lcma... no
configure: error: could not find pthreads on your system
msg336781 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2019-02-27 21:23
What is the NDK version ?

There is no Android pthread library. It is possible that the failure comes from the fact that the first configure test on pthread_create links with pthread and that the Android linker fails now instead of ignoring this error as it did before.

Can you add "ac_cv_pthread_is_default=yes" to the configure command line in order to tell configure that the pthread functions are in the main libc (i.e. bionic) to see if this fixes the problem.
msg336818 - (view) Author: (muhzi) Date: 2019-02-28 09:06
Well, it solves the problem with the configure script. 

My pyconfig.h.in contains:

/* Define to 1 if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H

/* Define to 1 if you have the `pthread_init' function. */
#undef HAVE_PTHREAD_INIT

/* Define to 1 if you have the `pthread_kill' function. */
#undef HAVE_PTHREAD_KILL

/* Define to 1 if you have the `pthread_sigmask' function. */
#undef HAVE_PTHREAD_SIGMASK

The problem extends after the configuration. It's as if the android headers are not visible to configure. All the macros are undefined in the pyconfig file too btw.
msg336821 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2019-02-28 09:24
> The problem extends after the configuration. It's as if the android headers are not visible to configure. All the macros are undefined in the pyconfig file too btw.

pyconfig.h is generated by configure from pyconfig.h.in.

Please attach the new output of running configure with ac_cv_pthread_is_default=yes (please do not paste it in your post).

BTW what is the NDK version ?
msg336822 - (view) Author: (muhzi) Date: 2019-02-28 09:57
OK! NDK version is 19.1.5304403

Cool, so I uploaded the output of configure (attachments)

Sorry for the confusion about pyconfig.h, what I was trying to say is after providing ac_cv_pthread_is_default=yes to configure I get errors in make:

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) {
        ^
msg336825 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2019-02-28 11:20
This is a different problem. Please create a new issue and attach pyconfig.h.
History
Date User Action Args
2022-04-11 14:59:11adminsetgithub: 80322
2019-12-10 08:06:49xdegayesetnosy: - xdegaye
2019-02-28 11:20:05xdegayesetmessages: + msg336825
2019-02-28 09:57:10muhzisetfiles: + config.log

messages: + msg336822
2019-02-28 09:24:41xdegayesetmessages: + msg336821
2019-02-28 09:06:21muhzisetmessages: + msg336818
2019-02-27 21:23:13xdegayesetmessages: + msg336781
2019-02-27 20:09:35muhzisettype: compile error
2019-02-27 20:05:23muhzisetnosy: + Alex.Willmer
components: + Cross-Build
2019-02-27 19:51:13muhzicreate