Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uses Arm builds for x86, if Arm builds already exist #1233

Closed
Rybec opened this issue Feb 10, 2018 · 9 comments
Closed

Uses Arm builds for x86, if Arm builds already exist #1233

Rybec opened this issue Feb 10, 2018 · 9 comments

Comments

@Rybec
Copy link

Rybec commented Feb 10, 2018

Ok, so I am 90% sure this is a lack of documentation problem rather than a bug, but I have spent the last two hours trying to figure this out without any luck.

I have managed to write a simple PySDL2 program that loads an image file and displays it on the screen, however, it does not work on my device. It turns out that the image file is never put into the APK file.

At first, I put the file in img/. When this failed, I tried putting it in a res directory and then in the project root. Then I spent a bunch of time trying to find an answer on Google, but I cannot even find an example of a program that works for python-for-android and loads an image file. (In fact, I couldn't fine a Kivy one or a PySDL2 one.)

I would like to think I am in the home stretch (of a week long battle) for finding a tolerable Android development environment, but this is just another hurdle in the extremely long list. If anyone knows how to get p4a to put the image in the APK (and preferably also the path I should expect to be able to access it from in my code), that would really help me!

@Rybec
Copy link
Author

Rybec commented Feb 10, 2018

Ok, i found the files in the APK. Buried deep in the documentation it says private.mp3 is where all the Python stuff and assets are, and my image file is in there. I am still struggling with getting it to display though. Now that I know where it is though, I might be able to figure out the path to it.

@Rybec Rybec changed the title Does not put assets into the APK Uses Arm builds for x86, if Arm builds already exist Feb 10, 2018
@Rybec
Copy link
Author

Rybec commented Feb 10, 2018

I think I figured this out. My first builds were for Arm, because that is just the default I used. The tablet I am testing on uses x86, so I changed the arch to x86, but p4a was still building for Arm, because it found the Arm stuff already built. p4a clean_all should fix this (though I am getting another error...)

@Rybec
Copy link
Author

Rybec commented Feb 10, 2018

OK, here is the other error:

First python2 make failed. This is expected, trying again.
Second install (expected to work)

           working: /usr/bin/ccache i686-linux-android-gcc -DANDROID -mandroid -fomit-frame-pointer -D__AND...(and 760 more) 
           working: /usr/bin/ccache i686-linux-android-gcc -DANDROID -mandroid -fomit-frame-pointer -D__AND...(and 758 more) 
           working: /usr/bin/ccache i686-linux-android-gcc -DANDROID -mandroid -fomit-frame-pointer -D__AND...(and 760 more) 
           working: /usr/bin/ccache i686-linux-android-gcc -DANDROID -mandroid -fomit-frame-pointer -D__AND...(and 760 more) 
           working: /usr/bin/ccache i686-linux-android-gcc -DANDROID -mandroid -fomit-frame-pointer -D__AND...(and 752 more) 
           working: In file included from Include/Python.h:8:0,                                                              
           working:                  from ./Modules/python.c:3:                                                              
           working: ./pyconfig.h:1223:16: error: duplicate 'unsigned'                                                        
           working:  #define size_t unsigned int                                                                             
           working:                 ^                                                                                        
           working: In file included from Include/Python.h:8:0,                                                              
           working:                  from Include/pgenheaders.h:10,                                                          
           working:                  from Parser/acceler.c:13:                                                               
           working: ./pyconfig.h:1223:16: error: duplicate 'unsigned'                                                        
           working:  #define size_t unsigned int                                                                             
           working:                 ^                                                                                        
           working: ./pyconfig.h:1223:25: error: two or more data types in declaration specifiers                            
           working:  #define size_t unsigned int                                                                             
           working:                          ^                                                                               
           working: ./pyconfig.h:1223:25: error: two or more data types in declaration specifiers                            
           working:  #define size_t unsigned int                                                                             
           working:                          ^                                                                               
           working: In file included from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/sys/types.h:36:0,      
           working:                  from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/stdio.h:42,            
           working:                  from Include/Python.h:33,                                                               
           working:                  from Include/pgenheaders.h:10,                                                          
           working:                  from Parser/acceler.c:13:                                                               
           working: /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/linux/types.h:21:23: fatal ...(and 45 more)  
           working:  #include <asm/types.h>                                                                                  
           working:                        ^                                                                                 
           working: compilation terminated.                                                                                  
           working: Makefile:1165: recipe for target 'Parser/acceler.o' failed                                               
           working: make: *** [Parser/acceler.o] Error 1                                                                     
           working: make: *** Waiting for unfinished jobs....                                                                
           working: In file included from Include/Python.h:8:0,                                                              
           working:                  from Include/pgenheaders.h:10,                                                          
           working:                  from Parser/listnode.c:4:                                                               
           working: ./pyconfig.h:1223:16: error: duplicate 'unsigned'                                                        
           working:  #define size_t unsigned int                                                                             
           working:                 ^                                                                                        
           working: ./pyconfig.h:1223:25: error: two or more data types in declaration specifiers                            
           working:  #define size_t unsigned int                                                                             
           working:                          ^                                                                               
           working: In file included from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/sys/types.h:36:0,      
           working:                  from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/stdio.h:42,            
           working:                  from Include/Python.h:33,                                                               
           working:                  from Include/pgenheaders.h:10,                                                          
           working:                  from Parser/listnode.c:4:                                                               
           working: /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/linux/types.h:21:23: fatal ...(and 45 more)  
           working:  #include <asm/types.h>                                                                                  
           working:                        ^                                                                                 
           working: compilation terminated.                                                                                  
           working: Makefile:1165: recipe for target 'Parser/listnode.o' failed                                              
           working: make: *** [Parser/listnode.o] Error 1                                                                    
           working: In file included from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/sys/types.h:36:0,      
           working:                  from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/stdio.h:42,            
           working:                  from Include/Python.h:33,                                                               
           working:                  from ./Modules/python.c:3:                                                              
           working: /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/linux/types.h:21:23: fatal ...(and 45 more)  
           working:  #include <asm/types.h>                                                                                  
           working:                        ^                                                                                 
           working: compilation terminated.                                                                                  
           working: Makefile:558: recipe for target 'Modules/python.o' failed                                                
           working: make: *** [Modules/python.o] Error 1                                                                     
           working: In file included from Include/Python.h:8:0,                                                              
           working:                  from Parser/node.c:3:                                                                   
           working: ./pyconfig.h:1223:16: error: duplicate 'unsigned'                                                        
           working:  #define size_t unsigned int                                                                             
           working:                 ^                                                                                        
           working: ./pyconfig.h:1223:25: error: two or more data types in declaration specifiers                            
           working:  #define size_t unsigned int                                                                             
           working:                          ^                                                                               
           working: In file included from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/sys/types.h:36:0,      
           working:                  from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/stdio.h:42,            
           working:                  from Include/Python.h:33,                                                               
           working:                  from Parser/node.c:3:                                                                   
           working: /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/linux/types.h:21:23: fatal ...(and 45 more)  
           working:  #include <asm/types.h>                                                                                  
           working:                        ^                                                                                 
           working: compilation terminated.                                                                                  
           working: Makefile:1165: recipe for target 'Parser/node.o' failed                                                  
           working: make: *** [Parser/node.o] Error 1                                                                        
           working: In file included from Include/Python.h:8:0,                                                              
           working:                  from Parser/grammar1.c:4:                                                               
           working: ./pyconfig.h:1223:16: error: duplicate 'unsigned'                                                        
           working:  #define size_t unsigned int                                                                             
           working:                 ^                                                                                        
           working: ./pyconfig.h:1223:25: error: two or more data types in declaration specifiers                            
           working:  #define size_t unsigned int                                                                             
           working:                          ^                                                                               
           working: In file included from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/sys/types.h:36:0,      
           working:                  from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/stdio.h:42,            
           working:                  from Include/Python.h:33,                                                               
           working:                  from Parser/grammar1.c:4:                                                               
           working: /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/linux/types.h:21:23: fatal ...(and 45 more)  
           working:  #include <asm/types.h>                                                                                  
           working:                        ^                                                                                 
           working: compilation terminated.                                                                                  
           working: Makefile:1165: recipe for target 'Parser/grammar1.o' failed                                              
           working: make: *** [Parser/grammar1.o] Error 1                                                                    Exception in thread background thread for pid 31883:
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/rybec/.local/lib/python2.7/site-packages/sh.py", line 2170, in background_thread
    handle_exit_code(exit_code)
  File "/home/rybec/.local/lib/python2.7/site-packages/sh.py", line 1929, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/home/rybec/.local/lib/python2.7/site-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
ErrorReturnCode_2: 

  RAN: /usr/bin/make -j5 install HOSTPYTHON=/home/rybec/.local/share/python-for-android/build/other_builds/python2/x86/python2/hostpython HOSTPGEN=/home/rybec/.local/share/python-for-android/build/other_builds/python2/x86/python2/hostpython CROSS_COMPILE_TARGET=yes INSTSONAME=libpython2.7.so

  STDOUT:
/usr/bin/ccache i686-linux-android-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=21 -isystem /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/x86 -isysroot /home/rybec/AndroidSDK/android-ndk-r16b/sysroot -I/home/rybec/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python2.7 -c -fno-strict-aliasing -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=21 -isystem /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/x86 -isysroot /home/rybec/AndroidSDK/android-ndk-r16b/sysroot -I/home/rybec/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python2.7 -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32 -DNO_MALLINFO -DNDEBUG -g  -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include  -fPIC -DPy_BUILD_CORE -o Modules/python.o ./Modules/python.c
/usr/bin/ccache i686-linux-android-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=21 -isystem /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/x86 -isysroot /home/rybec/AndroidSDK/android-ndk-r16b/sysroot -I/home/rybec/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python2.7 -c -fno-strict-aliasing -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=21 -isystem /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/x86 -isysroot /home/rybec/AndroidSDK/android-ndk-r16b/sysroot -I/home/rybec/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python2.7 -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32 -DNO_MALLINFO -DNDEBUG -g  -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include  -fPIC -DPy_BUILD_CORE -o Parser/acceler.o Parser/acceler.c
/usr/bin/ccache i686-linux-android-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=21 -isystem /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/x86 -isysroot /home/rybec/AndroidSDK/android-ndk-r16b/sysroot -I/home/rybec/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python2.7 -c -fno-strict-aliasing -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=21 -isystem /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/x86 -isysroot /home/rybec/AndroidSDK/android-ndk-r16b/sysroot -I/home/rybec/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python2.7 -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32 -DNO_MALLINFO -DNDEBUG -g  -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include  -fPIC -DPy_BUILD_CORE -o Parser/grammar1.o Parser/grammar1.c
/usr/bin/ccache i686-linux-android-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=21 -isystem /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/x86 -isysroot /home/rybec/AndroidSDK/android-ndk-r16b/sysroot -I/home/rybec/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python2.7 -c -fno-strict-aliasing -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=21 -isystem /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/x86 -isysroot /home/rybec/AndroidSDK/android-ndk-r16b/sysroot -I/home/rybec/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python2.7 -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32 -DNO_MALLINFO -DNDEBUG -g  -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include  -fPIC -DPy_BUILD_CORE -o Parser/listnode.o Parser/listnode.c
/usr/bin/ccache i686-linux-android-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=21 -isystem /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/x86 -isysroot /home/rybec/AndroidSDK/android-ndk-r16b/sysroot -I/home/rybec/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python2.7 -c -fno-strict-aliasing -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=21 -isystem /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/x86 -isysroot /home/rybec/AndroidSDK/android-ndk-r16b/sysroot -I/home/rybec/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python2.7 -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32 -DNO_MALLINFO -DNDEBUG -g  -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include  -fPIC -DPy_BUILD_CORE -o Parser/node.o Parser/node.c
In file included from Include/Python.h:8:0,
                 from ./Modules/python.c:3:
./pyconfig.h:1223:16: error: duplicate 'unsigned'
 #define size_t unsigned int
                ^
In file included from Include/Python.h:8:0,
                 from Include/pgenheaders.h:10,
                 from Parser/acceler.c:13:
./pyconfig.h:1223:16: error: duplicate 'unsigned'
 #define size_t unsigned int
                ^
./pyconfig.h:1223:25: error: two or more data types in declaration specifiers
 #define size_t unsigned int
                         ^
./pyconfig.h:1223:25: error: two or more data types in declaration specifiers
 #define size_t unsigned int
                         ^
In file included from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/sys/types.h:36:0,
                 from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/stdio.h:42,
                 from Include/Python.h:33,
                 from Include/pgenheaders.h:10,
                 from Parser/acceler.c:13:
/home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/linux/types.h:21:23: fatal error: asm/types.h: No such file or directory
 #include <asm/types.h>
                       ^
compilation terminated.
Makefile:1165: recipe for target 'Parser/acceler.o' failed
make: *** [Parser/acceler.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from Include/Python.h:8:0,
                 from Include/pgenheaders.h:10,
                 from Parser/listnode.c:4:
./pyconfig.h:1223:16: error: duplicate 'unsigned'
 #define size_t unsigned int
                ^
./pyconfig.h:1223:25: error: two or more data types in declaration specifiers
 #define size_t unsigned int
                         ^
In file included from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/sys/types.h:36:0,
                 from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/stdio.h:42,
                 from Include/Python.h:33,
                 from Include/pgenheaders.h:10,
                 from Parser/listnode.c:4:
/home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/linux/types.h:21:23: fatal error: asm/types.h: No such file or directory
 #include <asm/types.h>
                       ^
compilation terminated.
Makefile:1165: recipe for target 'Parser/listnode.o' failed
make: *** [Parser/listnode.o] Error 1
In file included from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/sys/types.h:36:0,
                 from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/stdio.h:42,
                 from Include/Python.h:33,
                 from ./Modules/python.c:3:
/home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/linux/types.h:21:23: fatal error: asm/types.h: No such file or directory
 #include <asm/types.h>
                       ^
compilation terminated.
Makefile:558: recipe for target 'Modules/python.o' failed
make: *** [Modules/python.o] Error 1
In file included from Include/Python.h:8:0,
                 from Parser/node.c:3:
./pyconfig.h:1223:16: error: duplicate 'unsigned'
 #define size_t unsigned int
                ^
./pyconfig.h:1223:25: error: two or more data types in declaration specifiers
 #define size_t unsigned int
                         ^
In file included from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/sys/types.h:36:0,
                 from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/stdio.h:42,
                 from Include/Python.h:33,
                 from Parser/node.c:3:
/home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/linux/types.h:21:23: fatal error: asm/types.h: No such file or directory
 #include <asm/types.h>
                       ^
compilation terminated.
Makefile:1165: recipe for target 'Parser/node.o' failed
make: *** [Parser/node.o] Error 1
In file included from Include/Python.h:8:0,
                 from Parser/grammar1.c:4:
./pyconfig.h:1223:16: error: duplicate 'unsigned'
 #define size_t unsigned int
                ^
./pyconfig.h:1223:25: error: two or more data types in declaration specifiers
 #define size_t unsigned int
                         ^
In file included from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/sys/types.h:36:0,
                 from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/stdio.h:42,
                 from Include/Python.h:33,
                 from Parser/grammar1.c:4:
/home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/linux/types.h:21:23: fatal error: asm/types.h: No such file or directory
 #include <asm/types.h>
                       ^
compilation terminated.
Makefile:1165: recipe for target 'Parser/grammar1.o' failed
make: *** [Parser/grammar1.o] Error 1


  STDERR:



                                                                                                                             
Traceback (most recent call last):
  File "/usr/local/bin/p4a", line 11, in <module>
    load_entry_point('python-for-android==0.6.0', 'console_scripts', 'p4a')()
  File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/toolchain.py", line 975, in main
    ToolchainCL()
  File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/toolchain.py", line 512, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/toolchain.py", line 149, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/toolchain.py", line 193, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx)
  File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/build.py", line 574, in build_recipes
    recipe.build_arch(arch)
  File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/recipes/python2/__init__.py", line 44, in build_arch
    self.do_python_build(arch)
  File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/recipes/python2/__init__.py", line 149, in do_python_build
    _env=env)
  File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/logger.py", line 175, in shprint
    for line in output:
  File "/home/rybec/.local/lib/python2.7/site-packages/sh.py", line 720, in next
    self.wait()
  File "/home/rybec/.local/lib/python2.7/site-packages/sh.py", line 651, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/rybec/.local/lib/python2.7/site-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_2: 

  RAN: /usr/bin/make -j5 install HOSTPYTHON=/home/rybec/.local/share/python-for-android/build/other_builds/python2/x86/python2/hostpython HOSTPGEN=/home/rybec/.local/share/python-for-android/build/other_builds/python2/x86/python2/hostpython CROSS_COMPILE_TARGET=yes INSTSONAME=libpython2.7.so

  STDOUT:
/usr/bin/ccache i686-linux-android-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=21 -isystem /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/x86 -isysroot /home/rybec/AndroidSDK/android-ndk-r16b/sysroot -I/home/rybec/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python2.7 -c -fno-strict-aliasing -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=21 -isystem /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/x86 -isysroot /home/rybec/AndroidSDK/android-ndk-r16b/sysroot -I/home/rybec/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python2.7 -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32 -DNO_MALLINFO -DNDEBUG -g  -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include  -fPIC -DPy_BUILD_CORE -o Modules/python.o ./Modules/python.c
/usr/bin/ccache i686-linux-android-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=21 -isystem /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/x86 -isysroot /home/rybec/AndroidSDK/android-ndk-r16b/sysroot -I/home/rybec/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python2.7 -c -fno-strict-aliasing -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=21 -isystem /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/x86 -isysroot /home/rybec/AndroidSDK/android-ndk-r16b/sysroot -I/home/rybec/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python2.7 -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32 -DNO_MALLINFO -DNDEBUG -g  -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include  -fPIC -DPy_BUILD_CORE -o Parser/acceler.o Parser/acceler.c
/usr/bin/ccache i686-linux-android-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=21 -isystem /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/x86 -isysroot /home/rybec/AndroidSDK/android-ndk-r16b/sysroot -I/home/rybec/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python2.7 -c -fno-strict-aliasing -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=21 -isystem /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/x86 -isysroot /home/rybec/AndroidSDK/android-ndk-r16b/sysroot -I/home/rybec/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python2.7 -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32 -DNO_MALLINFO -DNDEBUG -g  -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include  -fPIC -DPy_BUILD_CORE -o Parser/grammar1.o Parser/grammar1.c
/usr/bin/ccache i686-linux-android-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=21 -isystem /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/x86 -isysroot /home/rybec/AndroidSDK/android-ndk-r16b/sysroot -I/home/rybec/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python2.7 -c -fno-strict-aliasing -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=21 -isystem /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/x86 -isysroot /home/rybec/AndroidSDK/android-ndk-r16b/sysroot -I/home/rybec/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python2.7 -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32 -DNO_MALLINFO -DNDEBUG -g  -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include  -fPIC -DPy_BUILD_CORE -o Parser/listnode.o Parser/listnode.c
/usr/bin/ccache i686-linux-android-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=21 -isystem /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/x86 -isysroot /home/rybec/AndroidSDK/android-ndk-r16b/sysroot -I/home/rybec/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python2.7 -c -fno-strict-aliasing -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=21 -isystem /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/x86 -isysroot /home/rybec/AndroidSDK/android-ndk-r16b/sysroot -I/home/rybec/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python2.7 -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32 -DNO_MALLINFO -DNDEBUG -g  -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include  -fPIC -DPy_BUILD_CORE -o Parser/node.o Parser/node.c
In file included from Include/Python.h:8:0,
                 from ./Modules/python.c:3:
./pyconfig.h:1223:16: error: duplicate 'unsigned'
 #define size_t unsigned int
                ^
In file included from Include/Python.h:8:0,
                 from Include/pgenheaders.h:10,
                 from Parser/acceler.c:13:
./pyconfig.h:1223:16: error: duplicate 'unsigned'
 #define size_t unsigned int
                ^
./pyconfig.h:1223:25: error: two or more data types in declaration specifiers
 #define size_t unsigned int
                         ^
./pyconfig.h:1223:25: error: two or more data types in declaration specifiers
 #define size_t unsigned int
                         ^
In file included from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/sys/types.h:36:0,
                 from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/stdio.h:42,
                 from Include/Python.h:33,
                 from Include/pgenheaders.h:10,
                 from Parser/acceler.c:13:
/home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/linux/types.h:21:23: fatal error: asm/types.h: No such file or directory
 #include <asm/types.h>
                       ^
compilation terminated.
Makefile:1165: recipe for target 'Parser/acceler.o' failed
make: *** [Parser/acceler.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from Include/Python.h:8:0,
                 from Include/pgenheaders.h:10,
                 from Parser/listnode.c:4:
./pyconfig.h:1223:16: error: duplicate 'unsigned'
 #define size_t unsigned int
                ^
./pyconfig.h:1223:25: error: two or more data types in declaration specifiers
 #define size_t unsigned int
                         ^
In file included from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/sys/types.h:36:0,
                 from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/stdio.h:42,
                 from Include/Python.h:33,
                 from Include/pgenheaders.h:10,
                 from Parser/listnode.c:4:
/home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/linux/types.h:21:23: fatal error: asm/types.h: No such file or directory
 #include <asm/types.h>
                       ^
compilation terminated.
Makefile:1165: recipe for target 'Parser/listnode.o' failed
make: *** [Parser/listnode.o] Error 1
In file included from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/sys/types.h:36:0,
                 from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/stdio.h:42,
                 from Include/Python.h:33,
                 from ./Modules/python.c:3:
/home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/linux/types.h:21:23: fatal error: asm/types.h: No such file or directory
 #include <asm/types.h>
                       ^
compilation terminated.
Makefile:558: recipe for target 'Modules/python.o' failed
make: *** [Modules/python.o] Error 1
In file included from Include/Python.h:8:0,
                 from Parser/node.c:3:
./pyconfig.h:1223:16: error: duplicate 'unsigned'
 #define size_t unsigned int
                ^
./pyconfig.h:1223:25: error: two or more data types in declaration specifiers
 #define size_t unsigned int
                         ^
In file included from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/sys/types.h:36:0,
                 from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/stdio.h:42,
                 from Include/Python.h:33,
                 from Parser/node.c:3:
/home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/linux/types.h:21:23: fatal error: asm/types.h: No such file or directory
 #include <asm/types.h>
                       ^
compilation terminated.
Makefile:1165: recipe for target 'Parser/node.o' failed
make: *** [Parser/node.o] Error 1
In file included from Include/Python.h:8:0,
                 from Parser/grammar1.c:4:
./pyconfig.h:1223:16: error: duplicate 'unsigned'
 #define size_t unsigned int
                ^
./pyconfig.h:1223:25: error: two or more data types in declaration specifiers
 #define size_t unsigned int
                         ^
In file included from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/sys/types.h:36:0,
                 from /home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/stdio.h:42,
                 from Include/Python.h:33,
                 from Parser/grammar1.c:4:
/home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/linux/types.h:21:23: fatal error: asm/types.h: No such file or directory
 #include <asm/types.h>
                       ^
compilation terminated.
Makefile:1165: recipe for target 'Parser/grammar1.o' failed
make: *** [Parser/grammar1.o] Error 1


  STDERR:

Makefile:9: recipe for target 'all' failed
make: *** [all] Error 1

I then ran find on my SDK directory, and it returned this:

/home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/aarch64-linux-android/asm/types.h
/home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/mips64el-linux-android/asm/types.h
/home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/arm-linux-androideabi/asm/types.h
/home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/mipsel-linux-android/asm/types.h
/home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/x86_64-linux-android/asm/types.h
/home/rybec/AndroidSDK/android-ndk-r16b/sysroot/usr/include/i686-linux-android/asm/types.h

(It also finds /usr/include/x86_64-linux-gnu/asm/types.h when I search the rest of the file system.)

I am not sure which it is trying to find.

All of the errors about "duplicate unsigned" and "two or more data types in declaration specifiers" are probably the result of this one header not being found.

@Rybec
Copy link
Author

Rybec commented Feb 13, 2018

I have discovered a cheap hack that will allow x86 builds. I copied i686-linux-android/asm into the NDK include directory. The app still won't run on my device, but that's a separate issue that will bring up after troubleshooting, if I cannot figure it out.

@Rybec
Copy link
Author

Rybec commented Feb 13, 2018

It looks like the issue with running the app on my device may be related to this after all, since it is an issue with ctypes.

Alternatively, this could be a reversion of #333. (TL;DR: ImportError: No module named _ctypes)

02-13 00:16:12.821 15649 15649 V pythonutil: Checking pattern libcrystax\.so against libSDL2_mixer.so
02-13 00:16:12.821 15649 15649 V pythonutil: Checking pattern libcrystax\.so against libSDL2_ttf.so
02-13 00:16:12.821 15649 15649 V pythonutil: Checking pattern libcrystax\.so against libpython2.7.so
02-13 00:16:12.821 15649 15649 V pythonutil: Checking pattern libcrystax\.so against libmain.so
02-13 00:16:12.821 15649 15649 V pythonutil: Checking pattern libcrystax\.so against libSDL2.so
02-13 00:16:12.821 15649 15649 V pythonutil: Checking pattern libcrystax\.so against libSDL2_image.so
02-13 00:16:12.821 15649 15649 V pythonutil: Checking pattern libsqlite3\.so against libSDL2_mixer.so
02-13 00:16:12.821 15649 15649 V pythonutil: Checking pattern libsqlite3\.so against libSDL2_ttf.so
02-13 00:16:12.822 15649 15649 V pythonutil: Checking pattern libsqlite3\.so against libpython2.7.so
02-13 00:16:12.822 15649 15649 V pythonutil: Checking pattern libsqlite3\.so against libmain.so
02-13 00:16:12.822 15649 15649 V pythonutil: Checking pattern libsqlite3\.so against libSDL2.so
02-13 00:16:12.822 15649 15649 V pythonutil: Checking pattern libsqlite3\.so against libSDL2_image.so
02-13 00:16:12.822 15649 15649 V pythonutil: Checking pattern libssl.*\.so against libSDL2_mixer.so
02-13 00:16:12.822 15649 15649 V pythonutil: Checking pattern libssl.*\.so against libSDL2_ttf.so
02-13 00:16:12.822 15649 15649 V pythonutil: Checking pattern libssl.*\.so against libpython2.7.so
02-13 00:16:12.822 15649 15649 V pythonutil: Checking pattern libssl.*\.so against libmain.so
02-13 00:16:12.822 15649 15649 V pythonutil: Checking pattern libssl.*\.so against libSDL2.so
02-13 00:16:12.822 15649 15649 V pythonutil: Checking pattern libssl.*\.so against libSDL2_image.so
02-13 00:16:12.823 15649 15649 V pythonutil: Checking pattern libcrypto.*\.so against libSDL2_mixer.so
02-13 00:16:12.823 15649 15649 V pythonutil: Checking pattern libcrypto.*\.so against libSDL2_ttf.so
02-13 00:16:12.823 15649 15649 V pythonutil: Checking pattern libcrypto.*\.so against libpython2.7.so
02-13 00:16:12.823 15649 15649 V pythonutil: Checking pattern libcrypto.*\.so against libmain.so
02-13 00:16:12.823 15649 15649 V pythonutil: Checking pattern libcrypto.*\.so against libSDL2.so
02-13 00:16:12.823 15649 15649 V pythonutil: Checking pattern libcrypto.*\.so against libSDL2_image.so
02-13 00:16:12.824 15649 15649 V pythonutil: Loading library: SDL2
02-13 00:16:12.831 15649 15649 V pythonutil: Loading library: SDL2_image
02-13 00:16:12.834 15649 15649 V pythonutil: Loading library: SDL2_mixer
02-13 00:16:12.845 15649 15649 V pythonutil: Loading library: SDL2_ttf
02-13 00:16:12.848 15649 15649 V pythonutil: Loading library: python2.7
02-13 00:16:12.848 15649 15649 W linker  : /data/app/org.blg.pytest-1/lib/x86/libpython2.7.so: is missing DT_SONAME will use basename as a replacement: "libpython2.7.so"
02-13 00:16:12.851 15649 15649 V pythonutil: Loading library: python3.5m
02-13 00:16:12.852 15649 15649 V pythonutil: Library loading error: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.blg.pytest-1/base.apk"],nativeLibraryDirectories=[/data/app/org.blg.pytest-1/lib/x86, /data/app/org.blg.pytest-1/base.apk!/lib/x86, /vendor/lib, /system/lib]]] couldn't find "libpython3.5m.so"
02-13 00:16:12.853 15649 15649 V pythonutil: Loading library: main
02-13 00:16:12.856 15649 15649 W linker  : /data/data/org.blg.pytest/files/app/lib/python2.7/lib-dynload/_io.so: is missing DT_SONAME will use basename as a replacement: "_io.so"
02-13 00:16:12.861 15649 15649 W linker  : /data/data/org.blg.pytest/files/app/lib/python2.7/lib-dynload/unicodedata.so: is missing DT_SONAME will use basename as a replacement: "unicodedata.so"
02-13 00:16:12.862 15649 15649 V pythonutil: Unsatisfied linker when loading ctypes
02-13 00:16:12.862 15649 15649 V pythonutil: Loaded everything!
02-13 00:16:12.887 15649 15665 I python  : Initialize Python for Android
02-13 00:16:12.887 15649 15665 I python  : Changing directory to the one provided by ANDROID_ARGUMENT
02-13 00:16:12.887 15649 15665 I python  : /data/user/0/org.blg.pytest/files/app
02-13 00:16:12.887 15649 15665 I python  : Preparing to initialize python
02-13 00:16:12.887 15649 15665 I python  : crystax_python does not exist
02-13 00:16:12.898 15649 15665 I python  : Initialized python
02-13 00:16:12.898 15649 15665 I python  : AND: Init threads
02-13 00:16:12.899 15649 15665 I python  : testing python print redirection
02-13 00:16:12.900 15649 15665 I python  : Setting up python from ANDROID_PRIVATE
02-13 00:16:12.902 15649 15665 I python  : ('Android path', ['/data/user/0/org.blg.pytest/files/app/lib/python27.zip', '/data/user/0/org.blg.pytest/files/app/lib/python2.7/', '/data/user/0/org.blg.pytest/files/app/lib/python2.7/lib-dynload/', '/data/user/0/org.blg.pytest/files/app/lib/python2.7/site-packages/', '/data/user/0/org.blg.pytest/files/app'])
02-13 00:16:12.921 15649 15665 I python  : ('os.environ is', {'ANDROID_APP_PATH': '/data/user/0/org.blg.pytest/files/app', 'ANDROID_UNPACK': '/data/user/0/org.blg.pytest/files/app', 'EXTERNAL_STORAGE': '/sdcard', 'ANDROID_ENTRYPOINT': 'main.pyo', 'ANDROID_ASSETS': '/system/app', 'PYTHONPATH': '/data/user/0/org.blg.pytest/files/app:/data/user/0/org.blg.pytest/files/app/lib', 'ANDROID_ARGUMENT': '/data/user/0/org.blg.pytest/files/app', 'ANDROID_ROOT': '/system', 'SYSTEMSERVERCLASSPATH': '/system/framework/services.jar:/system/framework/ethernet-service.jar:/system/framework/wifi-service.jar', 'PYTHONOPTIMIZE': '2', 'ANDROID_DATA': '/data', 'PYTHONHOME': '/data/user/0/org.blg.pytest/files/app', 'ANDROID_SOCKET_zygote': '12', 'BOOTCLASSPATH': '/system/framework/core-libart.jar::/system/framework/x86/boot.art::/system/framework/conscrypt.jar::/system/framework/x86/boot.art::/system/framework/okhttp.jar::/system/framework/x86/boot.art::/system/framework/core-junit.jar::/system/framework/x86/boot.art::/system/framework/bouncycastle.jar::/system/framework/x86/boot.art::/system/framework/ext.jar::/system/framework/x86/boot.art::/system/framework/framework.jar::/system/framework/x86/boot.art::/system/framework/telephony-common.jar::/system/framework/x86/boot.art::/system/framework/voip-common.jar::/system/framework/x86/boot.art::/system/framework/ims-common.jar::/system/framework/x86/boot.art::/system/framework/apache-xml.jar::/system/framework/x86/boot.art::/system/framework/org.apache.http.legacy.boot.jar::/system/framework/x86/boot.art::/system/framework/com.intel.extmode.jar::/system/framework/x86/boot.art::/system/framework/com.intel.config.jar::/system/framework/x86/boot.art:', 'ANDROID_PROPERTY_WORKSPACE': '10,0', 'ASEC_MOUNTPOINT': '/mnt/asec', 'PATH': '/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin', 'ANDROID_STORAGE': '/storage', 'ANDROID_BOOTLOGO': '1', 'ANDROID_PRIVATE': '/data/user/0/org.blg.pytest/files', 'PYTHON_NAME': 'python'})
02-13 00:16:12.921 15649 15665 I python  : ('Android kivy bootstrap done. __name__ is', '__main__')
02-13 00:16:12.962 15649 15665 I python  : ['/data/user/0/org.blg.pytest/files/app/lib/python2.7/site-packages', '/data/user/0/org.blg.pytest/files/app/lib/site-python']
02-13 00:16:12.963 15649 15665 I python  : AND: Ran string
02-13 00:16:12.963 15649 15665 I python  : Run user program, change dir and execute entrypoint
02-13 00:16:12.965 15649 15665 I python  : Traceback (most recent call last):
02-13 00:16:12.965 15649 15665 I python  :   File "/home/rybec/AndroidSDK/projects/pytest/main.py", line 1, in <module>
02-13 00:16:12.965 15649 15665 I python  :   File "/home/rybec/.local/share/python-for-android/dists/unnamed_dist_1/private/lib/python2.7/site-packages/sdl2/__init__.py", line 2, in <module>
02-13 00:16:12.965 15649 15665 I python  :   File "/home/rybec/.local/share/python-for-android/dists/unnamed_dist_1/private/lib/python2.7/site-packages/sdl2/dll.py", line 5, in <module>
02-13 00:16:12.965 15649 15665 I python  :   File "/home/rybec/.local/share/python-for-android/dists/unnamed_dist_1/private/lib/python2.7/ctypes/__init__.py", line 10, in <module>
02-13 00:16:12.965 15649 15665 I python  : ImportError: No module named _ctypes
02-13 00:16:12.970 15649 15665 I python  : Python for android ended.

I have attached the full debugger output, in case there is some value in having it.

The compile command for the package is p4a apk --private ./ --package=org.blg.pytest --name pytest --version 0.1 --bootstrap=sdl2 --requirements=python2,android,pysdl2 --sdk_dir $(ANDROIDSDK) --ndk_dir $(ANDROIDNDK) --android_api $(ANDROIDAPI) --ndk_version $(ANDROIDNDKVER) --arch=$(TARGET)

The target is x86.

If it would help, I can run a clean build and upload the log of that as well.

out.txt

@Rybec
Copy link
Author

Rybec commented Feb 17, 2018

The cheap hack mentioned above does eliminate the error with finding asm/types.h. Instead I get #1238 now. (Also see #1239 for what happens when I try to build for ARMv7.) I am done with python-for-android. I have not managed to build anything yet, and it is clear no one cares about the project anymore. I have reported all of my issues, and I will give a little bit more background information here. Please don't bother asking me to post anymore debugging information. I would have been willing a week ago (when I first opened this report) all the way to yesterday, but I am now removing the entire p4a build system from my computer, so I can focus on focus on writing my app in C/C++.

Here are my system specs, in case any of them make a difference:

OS: Debian 9, Linux 4.9.30
CPU: Intel(R) Core(TM) i7-6500U, dual core with hyperthreading
RAM: 16GB

I hope this helps someone at some point.

@inclement
Copy link
Member

Sorry that p4a didn't work out for you, thanks for the detailed reports in any case.

I haven't seen an issue like this before (at least, not since ctypes support was first added). Since x86 builds haven't been tested much, maybe it's an issue with this in particular. I'll try to look into it.

@Rybec
Copy link
Author

Rybec commented Feb 17, 2018

Honestly, in my experience, if there is a bug in a build environment I will find it. I have kind of gotten used to it at this point.

I'll keep an eye on this. If this is fixed before I start my next project, I will try python-for-android again.

@ilyaiqoqo
Copy link
Contributor

ilyaiqoqo commented Apr 3, 2018

x86 include folder has different name, possible solution GH-1252

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants