18

I'm using the 64-bit Kivy/Buildozer VM to build and deploy a Kivy app to Android Lollipop (armeabi-v7a 32-bit arch).

The Buildozer build is successful but on execution of the app and import of the pymssql package (used to connect to a remote MS SQL server) I get the following error:

I/python  ( 5335):    File "/build/phytogp/android/app/main.py", line 4, in <module>
I/python  ( 5335):    File "/build/phytogp/android/app/views/apps/phyto_app.py", line 45, in <module>
I/python  ( 5335):    File "/build/phytogp/android/app/services/twilio_service.py", line 2, in <module>
I/python  ( 5335):  ImportError: dlopen failed: "/data/data/com.phyto.phytogp/files/app/lib/python2.7/site-packages/pymssql.so" is 64-bit instead of 32-bit

As I understand it, the pre-built pymssql-2.1.3-cp27-cp27mu-manylinux1_x86_64.whl wheel for pymssql should support both 64 and 32-bit arch.

How can I get a pymssql.so that supports 32-bit?

darthpaul
  • 211
  • 1
  • 5
  • 1
    x86_64 is only relevant for intel/amd architectures, you are targetting armeabi-v7a as you mentionned, so this wheel won't be of any use even if it supports 32 bit intel, it's different from 32 bit arm (even more than x86 is different from amd64), it could help to rebuild your p4a distribution in verbose mode and pastebin the relevant section of the build log, that builds the pymssql lib, to understand what happens. i see no pymssql recipe in https://github.com/kivy/python-for-android/tree/master/pythonforandroid/recipes but since the lib requires compilation, you certainly need one. – Tshirtman Mar 11 '18 at 15:13
  • 5
    If you can, i would certainly advise not having your app directly connect to your sql db, but instead talk to a rest api, on the server, which would connect to the db, it's usually easier to ensure security this way, as you only expose the api the application needs. – Tshirtman Mar 11 '18 at 15:14

1 Answers1

1

There is 2 things to checks:

  1. ensure you have the 32 bits version packaged. You said the wheel should support 64 and 32 bits, but you referenced the x86_64 wheel version. On their pypi page, they have a i686 version, that's your 32 bits version that you want.

  2. even if it's 32 or 64, it must be ARM >= v7a compiled. Unless your wheels have been compiled specifically for android, there is a great chance it just doesn't work, because the libc is not the same on Linux and Android. So you'll hit binary incompatibility.

That's why for that kind of libraries, you need to write a recipe in python-for-android to compile the library for Android.

tito
  • 12,990
  • 1
  • 55
  • 75