Repository: kivy/python-for-android

Issue:
libpq recipe compilation fails
### Versions

* Python: Host Python 2/3, target python3crystax
* OS: Ubuntu 18.04
* Kivy: N/A
* Cython: 0.21

### Description

Trying to compile libpq, but compilation fails.


### Command

Command:
```sh
python setup_testapp_python3.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $CRYSTAX_NDK_HOME --bootstrap sdl2 --requirements python3crystax,libpq
```


### Logs (truncated)

```
Exception in thread background thread for pid 20310:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         [129/1622]
Traceback (most recent call last):                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
    self.run()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
  File "/usr/lib/python2.7/threading.py", line 754, in run                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
    self.__target(*self.__args, **self.__kwargs)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
  File "/home/andre/workspace/python-for-android/venv/local/lib/python2.7/site-packages/sh.py", line 1540, in wrap                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
    fn(*args, **kwargs)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
  File "/home/andre/workspace/python-for-android/venv/local/lib/python2.7/site-packages/sh.py", line 2459, in background_thread                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
    handle_exit_code(exit_code)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
  File "/home/andre/workspace/python-for-android/venv/local/lib/python2.7/site-packages/sh.py", line 2157, in fn                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
    return self.command.handle_command_exit_code(exit_code)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
  File "/home/andre/workspace/python-for-android/venv/local/lib/python2.7/site-packages/sh.py", line 815, in handle_command_exit_code                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
    raise exc                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
ErrorReturnCode_2:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
  RAN: /usr/bin/make submake-libpq                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
  STDOUT:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
make -j5 -C ./src/interfaces/libpq all                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
make[1]: Entering directory '/home/andre/.local/share/python-for-android/build/other_builds/libpq-python3crystax/armeabi-v7a/libpq/src/interfaces/libpq'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
/usr/bin/ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/.local/share/python-for-android/build/python-installs/bdisttest_python3/include/python3.6 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/.local/share/python-for-android/build/python-installs/bdisttest_python3/include/python3.6 -I/home/andre/.buildozer/crystax-ndk-10.3.2/sources/python/3.6/include/python/ -march=armv7-a -mfloat-abi=s
oftfp -mfpu=vfp -mthumb -pthread -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS -fpic -DFRONTEND -DUNSAFE_STAT_OK -I. -I../../../src/include -D_GNU_SOURCE  -I../../../src/port -I../../../src/port -DSO_MAJOR_VERSION=5  -c -o fe-auth.o fe-auth.c                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
make -j5 -C ../../../src/port pg_config_paths.h                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
/usr/bin/ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/.local/share/python-for-android/build/python-installs/bdisttest_python3/include/python3.6 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/.local/share/python-for-android/build/python-installs/bdisttest_python3/include/python3.6 -I/home/andre/.buildozer/crystax-ndk-10.3.2/sources/python/3.6/include/python/ -march=armv7-a -mfloat-abi=s
oftfp -mfpu=vfp -mthumb -pthread -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS -fpic -DFRONTEND -DUNSAFE_STAT_OK -I. -I../../../src/include -D_GNU_SOURCE  -I../../../src/port -I../../../src/port -DSO_MAJOR_VERSION=5  -c -o fe-exec.o fe-exec.c                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
/usr/bin/ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/.local/share/python-for-android/build/python-installs/bdisttest_python3/include/python3.6 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/.local/share/python-for-android/build/python-installs/bdisttest_python3/include/python3.6 -I/home/andre/.buildozer/crystax-ndk-10.3.2/sources/python/3.6/include/python/ -march=armv7-a -mfloat-abi=s
oftfp -mfpu=vfp -mthumb -pthread -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS -fpic -DFRONTEND -DUNSAFE_STAT_OK -I. -I../../../src/include -D_GNU_SOURCE  -I../../../src/port -I../../../src/port -DSO_MAJOR_VERSION=5  -c -o fe-print.o fe-print.c                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
/usr/bin/ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/.local/share/python-for-android/build/python-installs/bdisttest_python3/include/python3.6 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/.local/share/python-for-android/build/python-installs/bdisttest_python3/include/python3.6 -I/home/andre/.buildozer/crystax-ndk-10.3.2/sources/python/3.6/include/python/ -march=armv7-a -mfloat-abi=s
oftfp -mfpu=vfp -mthumb -pthread -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS -fpic -DFRONTEND -DUNSAFE_STAT_OK -I. -I../../../src/include -D_GNU_SOURCE  -I../../../src/port -I../../../src/port -DSO_MAJOR_VERSION=5  -c -o fe-lobj.o fe-lobj.c                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
make[2]: Entering directory '/home/andre/.local/share/python-for-android/build/other_builds/libpq-python3crystax/armeabi-v7a/libpq/src/interfaces/libpq'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
make[2]: warning: -jN forced in submake: disabling jobserver mode.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
echo "#define PGBINDIR \"/usr/local/pgsql/bin\"" >pg_config_paths.h                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
echo "#define PGSHAREDIR \"/usr/local/pgsql/share\"" >>pg_config_paths.h                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
echo "#define SYSCONFDIR \"/usr/local/pgsql/etc\"" >>pg_config_paths.h                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
echo "#define INCLUDEDIR \"/usr/local/pgsql/include\"" >>pg_config_paths.h                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
echo "#define PKGINCLUDEDIR \"/usr/local/pgsql/include\"" >>pg_config_paths.h                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
echo "#define INCLUDEDIRSERVER \"/usr/local/pgsql/include/server\"" >>pg_config_paths.h                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
echo "#define LIBDIR \"/usr/local/pgsql/lib\"" >>pg_config_paths.h                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
echo "#define PKGLIBDIR \"/usr/local/pgsql/lib\"" >>pg_config_paths.h                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
echo "#define LOCALEDIR \"/usr/local/pgsql/share/locale\"" >>pg_config_paths.h                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
echo "#define DOCDIR \"/usr/local/pgsql/share/doc/\"" >>pg_config_paths.h                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
echo "#define HTMLDIR \"/usr/local/pgsql/share/doc/\"" >>pg_config_paths.h                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
echo "#define MANDIR \"/usr/local/pgsql/share/man\"" >>pg_config_paths.h                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
make[2]: Leaving directory '/home/andre/.local/share/python-for-android/build/other_builds/libpq-python3crystax/armeabi-v7a/libpq/src/port'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
/usr/bin/ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/.local/share/python-for-android/build/python-installs/bdisttest_python3/include/python3.6 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/.local/share/python-for-android/build/python-installs/bdisttest_python3/include/python3.6 -I/home/andre/.buildozer/crystax-ndk-10.3.2/sources/python/3.6/include/python/ -march=armv7-a -mfloat-abi=s
oftfp -mfpu=vfp -mthumb -pthread -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS -fpic -DFRONTEND -DUNSAFE_STAT_OK -I. -I../../../src/include -D_GNU_SOURCE  -I../../../src/port -I../../../src/port -DSO_MAJOR_VERSION=5  -c -o fe-protocol2.o fe-protocol2.c                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
In file included from ../../../src/include/c.h:1114:0,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
                 from ../../../src/include/postgres_fe.h:25,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
                 from fe-auth.c:23:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
../../../src/include/port.h:404:13: warning: prototype for 'random' follows non-prototype definition                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
 extern long random(void);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
             ^                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
../../../src/include/port.h:412:13: error: conflicting types for 'srandom'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
 extern void srandom(unsigned int seed);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
             ^                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
In file included from /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm/usr/include/stdlib.h:47:0,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
                 from ../../../src/include/c.h:82,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
                 from ../../../src/include/postgres_fe.h:25,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
                 from fe-auth.c:23:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm/usr/include/crystax/sys/stdlib.h:54:24: note: previous definition of 'srandom' was here                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
 static __inline__ void srandom(unsigned long s) { srand48(s); }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
                        ^                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
<builtin>: recipe for target 'fe-auth.o' failed                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
make[1]: *** [fe-auth.o] Error 1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
make[1]: *** Waiting for unfinished jobs....                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
In file included from ../../../src/include/c.h:1114:0,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
                 from ../../../src/include/postgres_fe.h:25,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
                 from fe-print.c:17:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
../../../src/include/port.h:404:13: warning: prototype for 'random' follows non-prototype definition                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
 extern long random(void);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
             ^                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
../../../src/include/port.h:412:13: error: conflicting types for 'srandom'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
 extern void srandom(unsigned int seed);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
             ^                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
In file included from /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm/usr/include/stdlib.h:47:0,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
                 from ../../../src/include/c.h:82,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
                 from ../../../src/include/postgres_fe.h:25,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
                 from fe-print.c:17:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm/usr/include/crystax/sys/stdlib.h:54:24: note: previous definition of 'srandom' was here                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
 static __inline__ void srandom(unsigned long s) { srand48(s); }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
                        ^                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
<builtin>: recipe for target 'fe-print.o' failed                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
make[1]: *** [fe-print.o] Error 1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
In file included from ../../../src/include/c.h:1114:0,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
                 from ../../../src/include/postgres_fe.h:25,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
                 from fe-lobj.c:25:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
../../../src/include/port.h:404:13: warning: prototype for 'random' follows non-prototype definition                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
 extern long random(void);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
             ^                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
../../../src/include/port.h:412:13: error: conflicting types for 'srandom'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
 extern void srandom(unsigned int seed);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
             ^                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
In file included from /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm/usr/include/stdlib.h:47:0,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
                 from ../../../src/include/c.h:82,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
                 from ../../../src/include/postgres_fe.h:25,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
                 from fe-lobj.c:25:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm/usr/include/crystax/sys/stdlib.h:54:24: note: previous definition of 'srandom' was here                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
 static __inline__ void srandom(unsigned long s) { srand48(s); }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
                        ^                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
<builtin>: recipe for target 'fe-lobj.o' failed                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
make[1]: *** [fe-lobj.o] Error 1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
In file included from ../../../src/include/c.h:1114:0,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
                 from ../../../src/include/postgres_fe.h:25,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
                 from fe-exec.c:15:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
../../../src/include/port.h:404:13: warning: prototype for 'random' follows non-prototype definition                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
 extern long random(void);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
             ^                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
../../../src/include/port.h:412:13: error: conflicting types for 'srandom'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
 extern void srandom(unsigned int seed);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
             ^                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
In file included from /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm/usr/include/stdlib.h:47:0,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
                 from ../../../src/include/c.h:82,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
                 from ../../../src/include/postgres_fe.h:25,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
                 from fe-exec.c:15:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm/usr/include/crystax/sys/stdlib.h:54:24: note: previous definition of 'srandom' was here                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
 static __inline__ void srandom(unsigned long s) { srand48(s); }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
                        ^                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
<builtin>: recipe for target 'fe-exec.o' failed                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
make[1]: *** [fe-exec.o] Error 1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
In file included from ../../../src/include/c.h:1114:0,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
                 from ../../../src/include/postgres_fe.h:25,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
                 from fe-protocol2.c:15:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
../../../src/include/port.h:404:13: warning: prototype for 'random' follows non-prototype definition                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
 extern long random(void);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
             ^                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
../../../src/include/port.h:412:13: error: conflicting types for 'srandom'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
 extern void srandom(unsigned int seed);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
             ^                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
In file included from /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm/usr/include/stdlib.h:47:0,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
                 from ../../../src/include/c.h:82,
                 from ../../../src/include/postgres_fe.h:25,                                                                            
                 from fe-protocol2.c:15:                          
/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm/usr/include/crystax/sys/stdlib.h:54:24: note: previous definition of 'srandom' was here
 static __inline__ void srandom(unsigned long s) { srand48(s); }
                        ^                                                                                                                                                      
<builtin>: recipe for target 'fe-protocol2.o' failed                            
make[1]: *** [fe-protocol2.o] Error 1    
make[1]: Leaving directory '/home/andre/.local/share/python-for-android/build/other_builds/libpq-python3crystax/armeabi-v7a/libpq/src/interfaces/libpq'
src/Makefile.global:500: recipe for target 'submake-libpq' failed
make: *** [submake-libpq] Error 2                                     
                                                                            
                                                   
  STDERR:                                                                                                           
                                          
                              
Traceback (most recent call last):                                                        
  File "setup_testapp_python3.py", line 30, in <module> 
    package_data={'testapp': ['*.py', '*.png']}
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup                                                                       
    dist.run_commands()                                           
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands    
    self.run_command(cmd)                          
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command                                                                                                        
    cmd_obj.run()                                                               
  File "/home/andre/workspace/python-for-android/pythonforandroid/bdistapk.py", line 81, in run
    main()                                                     
  File "/home/andre/workspace/python-for-android/pythonforandroid/toolchain.py", line 999, in main
    ToolchainCL()                                                     
  File "/home/andre/workspace/python-for-android/pythonforandroid/toolchain.py", line 532, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/andre/workspace/python-for-android/pythonforandroid/toolchain.py", line 145, in wrapper_func          
    build_dist_from_args(ctx, dist, args) 
  File "/home/andre/workspace/python-for-android/pythonforandroid/toolchain.py", line 189, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx)                                       
  File "/home/andre/workspace/python-for-android/pythonforandroid/build.py", line 580, in build_recipes
    recipe.build_arch(arch)   
  File "/home/andre/workspace/python-for-android/pythonforandroid/recipes/libpq/__init__.py", line 21, in build_arch                    
    shprint(sh.make, 'submake-libpq', _env=env)                   
  File "/home/andre/workspace/python-for-android/pythonforandroid/logger.py", line 176, in shprint
    for line in output:                                 
  File "/home/andre/workspace/python-for-android/venv/local/lib/python2.7/site-packages/sh.py", line 863, in next                                                              
    self.wait()                                                                 
  File "/home/andre/workspace/python-for-android/venv/local/lib/python2.7/site-packages/sh.py", line 792, in wait
    self.handle_command_exit_code(exit_code)                        
  File "/home/andre/workspace/python-for-android/venv/local/lib/python2.7/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc                                                                                                                                                          
sh.ErrorReturnCode_2:                                                            
                                                 
  RAN: /usr/bin/make submake-libpq                  
                                  
  STDOUT:
make -j5 -C ./src/interfaces/libpq all
make[1]: Entering directory '/home/andre/.local/share/python-for-android/build/other_builds/libpq-python3crystax/armeabi-v7a/libpq/src/interfaces/libpq'
/usr/bin/ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/.local/share/python-for-android/build/python-installs/bdisttest_python3/include/python3.6 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/.local/share/python-for-android/build/python-installs/bdisttest_python3/include/python3.6 -I/home/andre/.buildozer/crystax-ndk-10.3.2/sources/python/3.6/include/python/ -march=armv7-a -mfloat-abi=s
oftfp -mfpu=vfp -mthumb -pthread -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS -fpic -DFRONTEND -DUNSAFE_STAT_OK -I. -I../../../src/include -D_GNU_SOURCE  -I../../../src/port -I../../../src/port -DSO_MAJOR_VERSION=5  -c -o fe-auth.o fe-auth.c
make -j5 -C ../../../src/port pg_config_paths.h
/usr/bin/ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/.local/share/python-for-android/build/python-installs/bdisttest_python3/include/python3.6 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/.local/share/python-for-android/build/python-installs/bdisttest_python3/include/python3.6 -I/home/andre/.buildozer/crystax-ndk-10.3.2/sources/python/3.6/include/python/ -march=armv7-a -mfloat-abi=s
oftfp -mfpu=vfp -mthumb -pthread -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS -fpic -DFRONTEND -DUNSAFE_STAT_OK -I. -I../../../src/include -D_GNU_SOURCE  -I../../../src/port -I../../../src/port -DSO_MAJOR_VERSION=5  -c -o fe-exec.o fe-exec.c
/usr/bin/ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/.local/share/python-for-android/build/python-installs/bdisttest_python3/include/python3.6 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/.local/share/python-for-android/build/python-installs/bdisttest_python3/include/python3.6 -I/home/andre/.buildozer/crystax-ndk-10.3.2/sources/python/3.6/include/python/ -march=armv7-a -mfloat-abi=s
oftfp -mfpu=vfp -mthumb -pthread -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS -fpic -DFRONTEND -DUNSAFE_STAT_OK -I. -I../../../src/include -D_GNU_SOURCE  -I../../../src/port -I../../../src/port -DSO_MAJOR_VERSION=5  -c -o fe-print.o fe-print.c
/usr/bin/ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/.local/share/python-for-android/build/python-installs/bdisttest_python3/include/python3.6 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/.local/share/python-for-android/build/python-installs/bdisttest_python3/include/python3.6 -I/home/andre/.buildozer/crystax-ndk-10.3.2/sources/python/3.6/include/python/ -march=armv7-a -mfloat-abi=s
oftfp -mfpu=vfp -mthumb -pthread -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS -fpic -DFRONTEND -DUNSAFE_STAT_OK -I. -I../../../src/include -D_GNU_SOURCE  -I../../../src/port -I../../../src/port -DSO_MAJOR_VERSION=5  -c -o fe-lobj.o fe-lobj.c
make[2]: Entering directory '/home/andre/.local/share/python-for-android/build/other_builds/libpq-python3crystax/armeabi-v7a/libpq/src/interfaces/libpq'
make[2]: warning: -jN forced in submake: disabling jobserver mode.
echo "#define PGBINDIR \"/usr/local/pgsql/bin\"" >pg_config_paths.h
echo "#define PGSHAREDIR \"/usr/local/pgsql/share\"" >>pg_config_paths.h
echo "#define SYSCONFDIR \"/usr/local/pgsql/etc\"" >>pg_config_paths.h
echo "#define INCLUDEDIR \"/usr/local/pgsql/include\"" >>pg_config_paths.h
echo "#define PKGINCLUDEDIR \"/usr/local/pgsql/include\"" >>pg_config_paths.h
echo "#define INCLUDEDIRSERVER \"/usr/local/pgsql/include/server\"" >>pg_config_paths.h
echo "#define LIBDIR \"/usr/local/pgsql/lib\"" >>pg_config_paths.h
echo "#define PKGLIBDIR \"/usr/local/pgsql/lib\"" >>pg_config_paths.h
echo "#define LOCALEDIR \"/usr/local/pgsql/share/locale\"" >>pg_config_paths.h
echo "#define DOCDIR \"/usr/local/pgsql/share/doc/\"" >>pg_config_paths.h
echo "#define HTMLDIR \"/usr/local/pgsql/share/doc/\"" >>pg_config_paths.h
echo "#define MANDIR \"/usr/local/pgsql/share/man\"" >>pg_config_paths.h
make[2]: Leaving directory '/home/andre/.local/share/python-for-android/build/other_builds/libpq-python3crystax/armeabi-v7a/libpq/src/port'
/usr/bin/ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/.local/share/python-for-android/build/python-installs/bdisttest_python3/include/python3.6 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/.local/share/python-for-android/build/python-installs/bdisttest_python3/include/python3.6 -I/home/andre/.buildozer/crystax-ndk-10.3.2/sources/python/3.6/include/python/ -march=armv7-a -mfloat-abi=s
oftfp -mfpu=vfp -mthumb -pthread -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS -fpic -DFRONTEND -DUNSAFE_STAT_OK -I. -I../../../src/include -D_GNU_SOURCE  -I../../../src/port -I../../../src/port -DSO_MAJOR_VERSION=5  -c -o fe-protocol2.o fe-protocol2.c
In file included from ../../../src/include/c.h:1114:0,
                 from ../../../src/include/postgres_fe.h:25,
                 from fe-auth.c:23:
../../../src/include/port.h:404:13: warning: prototype for 'random' follows non-prototype definition
 extern long random(void);
             ^
../../../src/include/port.h:412:13: error: conflicting types for 'srandom'
 extern void srandom(unsigned int seed);
             ^
In file included from /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm/usr/include/stdlib.h:47:0,
                 from ../../../src/include/c.h:82,
                 from ../../../src/include/postgres_fe.h:25,
                 from fe-auth.c:23:
/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm/usr/include/crystax/sys/stdlib.h:54:24: note: previous definition of 'srandom' was here
 static __inline__ void srandom(unsigned long s) { srand48(s); }
                        ^
<builtin>: recipe for target 'fe-auth.o' failed
make[1]: *** [fe-auth.o] Error 1
make[1]: *** Waiting for unfinished jobs....
In file included from ../../../src/include/c.h:1114:0,
                 from ../../../src/include/postgres_fe.h:25,
                 from fe-print.c:17:
../../../src/include/port.h:404:13: warning: prototype for 'random' follows non-prototype definition
 extern long random(void);
             ^
../../../src/include/port.h:412:13: error: conflicting types for 'srandom'
 extern void srandom(unsigned int seed);
             ^
In file included from /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm/usr/include/stdlib.h:47:0,
                 from ../../../src/include/c.h:82,
                 from ../../../src/include/postgres_fe.h:25,
                 from fe-print.c:17:
/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm/usr/include/crystax/sys/stdlib.h:54:24: note: previous definition of 'srandom' was here
 static __inline__ void srandom(unsigned long s) { srand48(s); }
                        ^
<builtin>: recipe for target 'fe-print.o' failed
make[1]: *** [fe-print.o] Error 1
In file included from ../../../src/include/c.h:1114:0,
                 from ../../../src/include/postgres_fe.h:25,
                 from fe-lobj.c:25:
../../../src/include/port.h:404:13: warning: prototype for 'random' follows non-prototype definition
 extern long random(void);
             ^
../../../src/include/port.h:412:13: error: conflicting types for 'srandom'
 extern void srandom(unsigned int seed);
             ^
In file included from /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm/usr/include/stdlib.h:47:0,
                 from ../../../src/include/c.h:82,
                 from ../../../src/include/postgres_fe.h:25,
                 from fe-lobj.c:25:
/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm/usr/include/crystax/sys/stdlib.h:54:24: note: previous definition of 'srandom' was here
 static __inline__ void srandom(unsigned long s) { srand48(s); }
                        ^
<builtin>: recipe for target 'fe-lobj.o' failed
make[1]: *** [fe-lobj.o] Error 1
In file included from ../../../src/include/c.h:1114:0,
                 from ../../../src/include/postgres_fe.h:25,
                 from fe-exec.c:15:
../../../src/include/port.h:404:13: warning: prototype for 'random' follows non-prototype definition
 extern long random(void);
             ^
../../../src/include/port.h:412:13: error: conflicting types for 'srandom'
 extern void srandom(unsigned int seed);
             ^
In file included from /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm/usr/include/stdlib.h:47:0,
                 from ../../../src/include/c.h:82,
                 from ../../../src/include/postgres_fe.h:25,
                 from fe-exec.c:15:
/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm/usr/include/crystax/sys/stdlib.h:54:24: note: previous definition of 'srandom' was here
 static __inline__ void srandom(unsigned long s) { srand48(s); }
                        ^
<builtin>: recipe for target 'fe-exec.o' failed
make[1]: *** [fe-exec.o] Error 1
In file included from ../../../src/include/c.h:1114:0,
                 from ../../../src/include/postgres_fe.h:25,
                 from fe-protocol2.c:15:
../../../src/include/port.h:404:13: warning: prototype for 'random' follows non-prototype definition
 extern long random(void);
             ^
../../../src/include/port.h:412:13: error: conflicting types for 'srandom'
 extern void srandom(unsigned int seed);
             ^
In file included from /home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm/usr/include/stdlib.h:47:0,
                 from ../../../src/include/c.h:82,
                 from ../../../src/include/postgres_fe.h:25,
                 from fe-protocol2.c:15:
/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm/usr/include/crystax/sys/stdlib.h:54:24: note: previous definition of 'srandom' was here
 static __inline__ void srandom(unsigned long s) { srand48(s); }
                        ^
<builtin>: recipe for target 'fe-protocol2.o' failed
make[1]: *** [fe-protocol2.o] Error 1
make[1]: Leaving directory '/home/andre/.local/share/python-for-android/build/other_builds/libpq-python3crystax/armeabi-v7a/libpq/src/interfaces/libpq'
src/Makefile.global:500: recipe for target 'submake-libpq' failed
make: *** [submake-libpq] Error 2


  STDERR:
```


Discussion:

Resolving patch:
diff --git a/ci/constants.py b/ci/constants.py
--- a/ci/constants.py
+++ b/ci/constants.py
@@ -45,7 +45,7 @@ class TargetPython(Enum):
     'doubleratchet',
     'omemo',
     'cryptography',
-    # https://github.com/kivy/python-for-android/issues/1405
+    # requires `libpq-dev` system dependency e.g. for `pg_config` binary
     'psycopg2',
     'pygame',
     # most likely some setup in the Docker container, because it works in host
@@ -63,7 +63,7 @@ class TargetPython(Enum):
     'zeroconf',
     'zope',
 ])
-BROKEN_RECIPES_PYTHON3_CRYSTAX = set([
+BROKEN_RECIPES_PYTHON3 = set([
     'brokenrecipe',
     # enum34 is not compatible with Python 3.6 standard library
     # https://stackoverflow.com/a/45716067/185510
@@ -83,8 +83,8 @@ class TargetPython(Enum):
     'icu',
     # https://github.com/kivy/python-for-android/issues/1354
     'kivent_core', 'kivent_cymunk', 'kivent_particles', 'kivent_polygen',
-    # https://github.com/kivy/python-for-android/issues/1405
-    'libpq', 'psycopg2',
+    # requires `libpq-dev` system dependency e.g. for `pg_config` binary
+    'psycopg2',
     'netifaces',
     # https://github.com/kivy/python-for-android/issues/1315 ?
     'opencv',
@@ -97,13 +97,9 @@ class TargetPython(Enum):
     'sympy',
     'vlc',
 ])
-# to be created via https://github.com/kivy/python-for-android/issues/1514
-BROKEN_RECIPES_PYTHON3 = set([
-])
 
 BROKEN_RECIPES = {
     TargetPython.python2: BROKEN_RECIPES_PYTHON2,
-    TargetPython.python3crystax: BROKEN_RECIPES_PYTHON3_CRYSTAX,
     TargetPython.python3: BROKEN_RECIPES_PYTHON3,
 }
 # recipes that were already built will be skipped
diff --git a/pythonforandroid/recipes/psycopg2/__init__.py b/pythonforandroid/recipes/psycopg2/__init__.py
--- a/pythonforandroid/recipes/psycopg2/__init__.py
+++ b/pythonforandroid/recipes/psycopg2/__init__.py
@@ -4,10 +4,14 @@
 
 
 class Psycopg2Recipe(PythonRecipe):
+    """
+    Requires `libpq-dev` system dependency e.g. for `pg_config` binary.
+    """
     version = 'latest'
     url = 'http://initd.org/psycopg/tarballs/psycopg2-{version}.tar.gz'
     depends = ['libpq']
     site_packages_name = 'psycopg2'
+    call_hostpython_via_targetpython = False
 
     def prebuild_arch(self, arch):
         libdir = self.ctx.get_libs_dir(arch.arch)


Test patch: