python-for-android icon indicating copy to clipboard operation
python-for-android copied to clipboard

`pyodbc` doesn't have a recipe on `python-for-android`

Open rehmanjameel opened this issue 3 years ago • 5 comments

buildozer.spec

Logs

ImportError: dlopen failed: "/data/data/org.test.myapp/files/app/_python_bundle/site-packages/pyodbc.so" is for EM_X86_64 (62) instead of EM_AARCH64 (183)

rehmanjameel avatar Sep 01 '22 15:09 rehmanjameel

pyodbc doesn't have a recipe on python-for-android, but one is needed in order to build it as pyodbc is not a plain-python package.

I'm changing the title of the issue and adding the feature-request label, so we can keep track of it.

misl6 avatar Sep 01 '22 20:09 misl6

So, what exactly i have to do to solve this problem? Any suggestion please!

rehmanjameel avatar Sep 01 '22 20:09 rehmanjameel

I have found this script from internet but its not working for me if you can make some changes or can run it so it would be appreciate able.

from pythonforandroid.recipe import CompiledComponentsPythonRecipe


class PyodbcRecipe(CompiledComponentsPythonRecipe):
    version = '4.0.30'
    url = 'https://github.com/mkleehammer/pyodbc/archive/{version}.tar.gz'
    site_packages_name = 'pyodbc'
    depends = ['setuptools']

    call_hostpython_via_targetpython = False
    install_in_hostpython = True
    install_in_targetpython = False


recipe = PyodbcRecipe()

Here is the link where from I found it

rehmanjameel avatar Sep 01 '22 21:09 rehmanjameel

Hi, I'm still struggling with recipe for pyodbc. That is my try that doesn't work, because pyodbc.so is missing.

from pythonforandroid.recipe import PythonRecipe
class Pyodbc(PythonRecipe):
    version = 'pyodbc'
    url = 'https://github.com/mkleehammer/pyodbc/archive/refs/tags/4.0.32.tar.gz'
    depends = ['python3', 'numpy']
    site_packages_name = 'pyodbc'
    call_hostpython_via_targetpython = False
    install_in_hostpython = True

recipe = Pyodbc()

In the documentation I've found this: Installing libs Some recipes generate .so files that must be manually copied into the android project. You can use code like the following to accomplish this, copying to the correct lib cache dir:

def build_arch(self, arch):
    do_the_build()  # e.g. running ./configure and make

    import shutil
    shutil.copyfile('a_generated_binary.so',
                    self.ctx.get_libs_dir(arch.arch))

Any suggestions how to fix this problem. Thanks Tim

TimCoding85 avatar Aug 19 '23 10:08 TimCoding85

This issue is a feature-request for an pyodbc recipe.

Until a volunteer writes one (and submits as a PR), we don't have a solution for you; perhaps that could be you?

Julian-O avatar Nov 20 '23 06:11 Julian-O