pview sample project crashes on Android x86 Emulator

Hey!

I’ve been recently trying to get Panda3D working on Android.

Unfortunately, I do not own a x86 device, the best I have is ARMv7. After compiling Panda3D as such, the application immediately starts to fail on the x86 emulator:

python makepanda/makepanda.py --everything --target=android --arch=x86 --no-python --no-pandatool --no-sse2 --no-neon --optimize 4 --threads 4

I am not sure if it is exclusive to the Android Emulator. I cannot test the app on an ARM emulated phone, as it is way too slow - can’t press anything on home screen.

However, on my ARMv7 phone, it works completely fine (building for ARM instead of x86, naturally).

Here is what logcat has to say about this.
pastebin.com/raw/hbDdR8HC

I’ve built libfreetype, libjpeg, libpng, libopenal, libssl, libcrypto, libogg, and libvorbis as thirdparty libraries, using the Android make system (Android.mk and Application.mk). I couldn’t get Python to build at all, so help with that would be appreciated aswell.

If needed, I can upload the whole project.

Any help appreciated. Thanks.

Hmm. Seems like if I run the application directly from the home screen (instead of going through Android Studio), it works perfectly.

The issue with Python is still a thing, though. Panda3D just isn’t the same without the pet snake.

I’m redoing my progress with Python, so I don’t have any concrete errors to share yet - but I’ve had linker errors with UCS2/UCS4 (so I built Python with UCS4), ran into an issue with LONG_BIT python config (on ARM - which I fixed with running ./configure before CMake), linker errors with PyExc_TypeError (unresolved, which is why I’ve decided to redo my progress), VA_LIST_IS_ARRAY (which could cause issues later on, but I cannot confirm just yet.), and building static Python with static libc (huge roadblock for me).

At one point I managed to build and link Python, but Py_Initialize failed, PyImport_ImportModule always returned NULL and PyImport_FindFrozenModule always -1.

After resolving these issues, I imagine that the extension modules (core, ai, fx…) would need to be built and loaded (through System.loadLibrary) aswell.

Here is the PyExc_TypeError UnsatifiedLinkError:
pastebin.com/raw/qKGZiCqa

Cross compiled on Lubuntu 16.10 x86-64 to Android x86.

The steps to reproduce:

git clone https://github.com/python/cpython
cd cpython
git checkout 2.7

echo -e "ac_cv_file__dev_ptmx=no\nac_cv_file__dev_ptc=no" >> CONFIG.SITE

CONFIG_SITE=CONFIG.SITE ./configure --host=x86_64-linux-gnu --build=x86 --disable-ipv6
make -s -j4      # given 4 build threads

Then put libpython2.7.a into android-libs-x86/python/libs, and compile with --use-python.

Hmm. The stack trace stops in TextAssembler::GlyphPlacement::assign_quad_to. It’s not clear why that in particular is crashing. Might it be that the compiler is generating code for a target platform not supported by your emulator?

Perhaps you could try disabling the animation panel and/or fps meter if they are enabled in panda/src/android/pview.cxx and see if it gets further without that.

As for the link error, that sounds like the Python library has not been loaded first. Recently we made some changes to how the libraries are linked that may be making this slightly more complicated with a statically linked Python. Hmm. I’ll see if I can do anything about that.

Thanks for the response rdb.

The emulator crash error isn’t an issue if I start the application through the home screen (as a normal user would). It only affects the application deployment through Android Studio’s adb deployment process.

Regarding the Python issue, I believe that I am generating the right code. I’ve built Python using the arm-linux-androideabi toolchain, so it should be generating code for the right platform.

Using the i686-linux-android toolchain (for x86), I have the same linker error.

libpython2.7.a does have PyExc_TypeError, seen in the manifest:
pastebin.com/raw/f96zqrgz

As for the static/dynamic linking, I have no preference. As long as I have access to the Python interpreter so I can load my frozen modules, I’d be happy. I have no clue how to approach that, though, I tried once.