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

x86 inline assembly fails to build #1238

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

x86 inline assembly fails to build #1238

Rybec opened this issue Feb 17, 2018 · 9 comments

Comments

@Rybec
Copy link

Rybec commented Feb 17, 2018

It looks like I won't be able to use python-for-android for my project. It is way too buggy, the issues I have posted have not gotten any response, and it looks like the project has been dead since November.

I will post my issues though, in case someone eventually cares.

To start with, this issue is part of a string of issues. See #1233 for where I left off. (The most important thing from that is that I had to copy an asm directory from the i686 includes into sysroot/usr/include to get it past a problem finding types.h. I don't think this is related to that, but it could be.

[x86] Compile        : sdl <= SDL_RLEaccel.c
/usr/bin/ccache /home/ndkbuild/Android/android-ndk-r16b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -MMD -MP -MF /home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/obj/local/x86/objs/sdl/src/video/SDL_RLEaccel.o.d -gcc-toolchain /home/ndkbuild/Android/android-ndk-r16b/toolchains/x86-4.9/prebuilt/linux-x86_64 -target i686-none-linux-android -ffunction-sections -funwind-tables -fstack-protector-strong -fPIC -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -no-canonical-prefixes -g -O2 -DNDEBUG  -I/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl   -DANDROID -I/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/include -DSDL_JAVA_PACKAGE_PATH=org_renpy_android -DSDL_CURDIR_PATH=\"org.renpy.android\" -DSDL_TRACKBALL_KEYUP_DELAY=1 -DSDL_VIDEO_RENDER_RESIZE=0 -DSDL_ANDROID_KEYCODE_MOUSE=UNKNOWN -DSDL_ANDROID_KEYCODE_0=SPACE -DSDL_ANDROID_KEYCODE_1=RETURN -DSDL_ANDROID_KEYCODE_2=LCTRL -DSDL_ANDROID_KEYCODE_3=LALT -DSDL_ANDROID_KEYCODE_4=RETURN -D__ANDROID_API__=14 -Wa,--noexecstack -Wformat -Werror=format-security -mstackrealign  --sysroot /home/ndkbuild/Android/android-ndk-r16b/sysroot -isystem /home/ndkbuild/Android/android-ndk-r16b/sysroot/usr/include/i686-linux-android -c  /home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/src/video/SDL_RLEaccel.c -o /home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/obj/local/x86/objs/sdl/src/video/SDL_RLEaccel.o
/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/src/video/SDL_RLEaccel.c:831:5: error: invalid operand for instruction
    CHOOSE_BLIT(RLECLIPBLIT, alpha, fmt);
    ^
/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/src/video/SDL_RLEaccel.c:688:24: note: expanded from macro 'CHOOSE_BLIT'
                                blitter(4, Uint16, ALPHA_BLIT32_888_50MMX);\
                                                   ^
<inline asm>:1:13: note: instantiated into assembly here
        movq %mm2, %edi
                   ^~~~
/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/src/video/SDL_RLEaccel.c:831:5: error: invalid operand for instruction
    CHOOSE_BLIT(RLECLIPBLIT, alpha, fmt);
    ^
/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/src/video/SDL_RLEaccel.c:695:24: note: expanded from macro 'CHOOSE_BLIT'
                                blitter(4, Uint16, ALPHA_BLIT32_888MMX);\
                                                   ^
<inline asm>:1:13: note: instantiated into assembly here
        movq %mm2, %eax
                   ^~~~
/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/src/video/SDL_RLEaccel.c:831:5: error: invalid operand for instruction
    CHOOSE_BLIT(RLECLIPBLIT, alpha, fmt);
    ^
/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/src/video/SDL_RLEaccel.c:647:23: note: expanded from macro 'CHOOSE_BLIT'
                                blitter(2, Uint8, ALPHA_BLIT16_565MMX); \
                                                  ^
<inline asm>:1:13: note: instantiated into assembly here
        movq %mm3, %ax
                   ^~~
/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/src/video/SDL_RLEaccel.c:831:5: error: invalid operand for instruction
    CHOOSE_BLIT(RLECLIPBLIT, alpha, fmt);
    ^
/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/src/video/SDL_RLEaccel.c:663:23: note: expanded from macro 'CHOOSE_BLIT'
                                blitter(2, Uint8, ALPHA_BLIT16_555MMX); \
                                                  ^
<inline asm>:1:13: note: instantiated into assembly here
        movq %mm3, %ax
                   ^~~
/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/src/video/SDL_RLEaccel.c:930:6: error: invalid operand for instruction
            CHOOSE_BLIT(RLEBLIT, alpha, fmt);
            ^
/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/src/video/SDL_RLEaccel.c:688:24: note: expanded from macro 'CHOOSE_BLIT'
                                blitter(4, Uint16, ALPHA_BLIT32_888_50MMX);\
                                                   ^
<inline asm>:1:13: note: instantiated into assembly here
        movq %mm2, %ecx
                   ^~~~
/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/src/video/SDL_RLEaccel.c:930:6: error: invalid operand for instruction
            CHOOSE_BLIT(RLEBLIT, alpha, fmt);
            ^
/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/src/video/SDL_RLEaccel.c:695:24: note: expanded from macro 'CHOOSE_BLIT'
                                blitter(4, Uint16, ALPHA_BLIT32_888MMX);\
                                                   ^
<inline asm>:1:13: note: instantiated into assembly here
        movq %mm2, %edi
                   ^~~~
/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/src/video/SDL_RLEaccel.c:930:6: error: invalid operand for instruction
            CHOOSE_BLIT(RLEBLIT, alpha, fmt);
            ^
/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/src/video/SDL_RLEaccel.c:647:23: note: expanded from macro 'CHOOSE_BLIT'
                                blitter(2, Uint8, ALPHA_BLIT16_565MMX); \
                                                  ^
<inline asm>:1:13: note: instantiated into assembly here
        movq %mm3, %cx
                   ^~~
/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/src/video/SDL_RLEaccel.c:930:6: error: invalid operand for instruction
            CHOOSE_BLIT(RLEBLIT, alpha, fmt);
            ^
/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/src/video/SDL_RLEaccel.c:663:23: note: expanded from macro 'CHOOSE_BLIT'
                                blitter(2, Uint8, ALPHA_BLIT16_555MMX); \
                                                  ^
<inline asm>:1:13: note: instantiated into assembly here
        movq %mm3, %cx
                   ^~~
8 errors generated.
make: *** [/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/obj/local/x86/objs/sdl/src/video/SDL_RLEaccel.o] Error 1


  STDERR:


[INFO]:    STDOUT (last 20 lines of 158):                                                                                  
	/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/src/video/SDL_RLEaccel.c:930:6: error: invalid operand for instruction	
            CHOOSE_BLIT(RLEBLIT, alpha, fmt);	
            ^	
/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/src/video/SDL_RLEaccel.c:647:23: note: expanded from macro 'CHOOSE_BLIT'	
                                blitter(2, Uint8, ALPHA_BLIT16_565MMX); \	
                                                  ^	
<inline asm>:1:13: note: instantiated into assembly here	
        movq %mm3, %cx	
                   ^~~	
/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/src/video/SDL_RLEaccel.c:930:6: error: invalid operand for instruction	
            CHOOSE_BLIT(RLEBLIT, alpha, fmt);	
            ^	
/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni/../jni/sdl/src/video/SDL_RLEaccel.c:663:23: note: expanded from macro 'CHOOSE_BLIT'	
                                blitter(2, Uint8, ALPHA_BLIT16_555MMX); \	
                                                  ^	
<inline asm>:1:13: note: instantiated into assembly here	
        movq %mm3, %cx	
                   ^~~	
8 errors generated.	
make: *** [/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/obj/local/x86/objs/sdl/src/video/SDL_RLEaccel.o] Error 1
[INFO]:    STDERR:
	
[INFO]:    COMMAND:
cd /home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/jni && /home/ndkbuild/Android/android-ndk-r16b/ndk-build V=1

[WARNING]: ERROR: /home/ndkbuild/Android/android-ndk-r16b/ndk-build failed!
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 1
@inclement
Copy link
Member

/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/pygame/...

Is it deliberate that you're using the pygame bootstrap here, rather than the sdl2 one?

@Rybec
Copy link
Author

Rybec commented Feb 17, 2018

Yes, but when I used the sdl2 one, I got other issues.

See #1233. SDL2 builds were successful, but the ctypes module failed to end up in the APK, so it did not run. I decided to test Pygame, when I did not get a response on that issue for a week.

Give me a moment, and I will try pairing the sdl2 bootstrap with Pygame for the graphics.

@Rybec
Copy link
Author

Rybec commented Feb 17, 2018

It failed for x86:

[INFO]:    -> running ndk-build V=1
           working: /home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/sdl2_gradle-pyt...(and 181 more) Exception in thread background thread for pid 13754:
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 "/usr/local/lib/python2.7/dist-packages/sh.py", line 2170, in background_thread
    handle_exit_code(exit_code)
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 1929, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
ErrorReturnCode_2: 

  RAN: /home/ndkbuild/Android/android-ndk-r16b/ndk-build V=1

  STDOUT:
Android NDK: Found platform level in /home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/sdl2_gradle-python2/project.properties. Setting APP_PLATFORM to android-21.    
/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/sdl2_gradle-python2/jni/sdl/Android.mk:8: *** Please define SDL_JAVA_PACKAGE_PATH to the path of your Java package with dots replaced with underscores, for example "com_example_SanAngeles".  Stop.


  STDERR:


[INFO]:    STDOUT:                                                                                                         
	Android NDK: Found platform level in /home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/sdl2_gradle-python2/project.properties. Setting APP_PLATFORM to android-21.    	
/home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/sdl2_gradle-python2/jni/sdl/Android.mk:8: *** Please define SDL_JAVA_PACKAGE_PATH to the path of your Java package with dots replaced with underscores, for example "com_example_SanAngeles".  Stop.
[INFO]:    STDERR:
	
[INFO]:    COMMAND:
cd /home/ndkbuild/.local/share/python-for-android/build/bootstrap_builds/sdl2_gradle-python2/jni && /home/ndkbuild/Android/android-ndk-r16b/ndk-build V=1

[WARNING]: ERROR: /home/ndkbuild/Android/android-ndk-r16b/ndk-build failed!
Makefile:5: recipe for target 'all' failed
make: *** [all] Error 1

Now building for ARMv7.

@Rybec
Copy link
Author

Rybec commented Feb 17, 2018

The ARMv7 build had the same result. (At least they both agree now!)

@inclement
Copy link
Member

Thanks for checking. I don't really know what's wrong in either case, but I'll try to look into it if I can reproduce the issue.

@Rybec
Copy link
Author

Rybec commented Feb 17, 2018

I am willing to do a little bit more to help you debug, but only if it can happen fast. I have spent almost 3 weeks trying to get an Android build system setup, and a few days ago, I finally got the C/C++ one working. I would rather use Python, but with the time I have already spent trying to get this to work... At this point, I just need to get started working on my project.

In another issue, I said I am deleting the entire build system for this. I'll wait until tomorrow or Monday maybe. If no progress has been made by then, I am afraid I am going to have to just drop this entirely so I can get my project going.

Thank you for responding.

@inclement
Copy link
Member

inclement commented Feb 17, 2018

I'll wait until tomorrow or Monday maybe. If no progress has been made by then, I am afraid I am going to have to just drop this entirely so I can get my project going.

Thanks for your patience, but to be honest it's unlikely that I'll look into this before then. However, your thorough reports probably have any necessary information already.

Good luck with your project.

@Rybec
Copy link
Author

Rybec commented Feb 17, 2018

Sounds good. Thank you for letting me know. Maybe this will be suitable for my next project then!

@inclement
Copy link
Member

Closing as stale, these issues may well have been addressed by the many improvements in the last year.

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

2 participants