Skip to content

Problems in creation of recipe for zbar #854

@OpenCode

Description

@OpenCode

I'm trying to create a recipe for zbar python library. I've created a directory in recipes called zbar. In this one I've created a file called init.py with this code:

from pythonforandroid.toolchain import PythonRecipe


class ZBarRecipe(PythonRecipe):

    name = 'zbar'
    version = '0.10'
    url = 'https://pypi.python.org/packages/33/54/cc5819efc9ee7e34b60b41e1d2d4753b6dd0c26a41c9a552611f66aa106e/zbar-{version}.tar.bz2'
    depends = []
    site_packages_name = 'zbar'
    call_hostpython_via_targetpython = False

recipe = ZBarRecipe()

In my buildozer.spec I've this line

requirements = python2,kivy,unicodecsv,erppeek,zbar

When I run

buildozer android_new debug deploy run logcat

I obtain this error:

[INFO]:    Building zbar for armeabi-v7a
[INFO]:    zbar apparently isn't already in site-packages
[INFO]:    Installing zbar into site-packages
[INFO]:    -> directory context /home/fapruzzese/Projects/Kivy/kivy_demo_app/.buildozer/android/platform/build/build/other_builds/zbar/armeabi-v7a/zbar
[INFO]:    -> running hostpython setup.py install -O2 --root=/home/fapruzzese/Projects/Kivy/kivy_demo_app/.buildozer/android/platform/build/build/python-installs/...(and 49 more)
('name is', 'zbar', <class 'pythonforandroid.recipes.zbar.ZBarRecipe'>)                                                                                                                      
('path is', '/home/fapruzzese/.buildozer/android/platform/android-ndk-r9c/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/:/home/fapruzzese/.buildozer/android/platform/android-ndk-r9c/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/:/home/fapruzzese/.buildozer/android/platform/android-ndk-r9c:/home/fapruzzese/.buildozer/android/platform/android-sdk-20/tools:/home/fapruzzese/.buildozer/android/platform/apache-ant-1.9.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games')
           workinTraceback (most recent call last):                                                                                                                                          
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/fapruzzese/Projects/Kivy/kivy_demo_app/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 792, in <module>
    main()
  File "/home/fapruzzese/Projects/Kivy/kivy_demo_app/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 789, in main
    ToolchainCL()
  File "/home/fapruzzese/Projects/Kivy/kivy_demo_app/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 464, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/fapruzzese/Projects/Kivy/kivy_demo_app/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 145, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/fapruzzese/Projects/Kivy/kivy_demo_app/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 188, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx)
  File "pythonforandroid/build.py", line 561, in build_recipes
  File "pythonforandroid/recipe.py", line 788, in build_arch
  File "pythonforandroid/recipe.py", line 842, in install_python_package
  File "pythonforandroid/logger.py", line 173, in shprint
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 565, in next
    self.wait()
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 500, in wait
    self.handle_command_exit_code(exit_code)
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 516, in handle_command_exit_code
    raise exc(self.ran, self.process.stdout, self.process.stderr)
sh.ErrorReturnCode_1: 

  RAN: '/home/fapruzzese/Projects/Kivy/kivy_demo_app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/hostpython setup.py install -O2 --root=/home/fapruzzese/Projects/Kivy/kivy_demo_app/.buildozer/android/platform/build/build/python-installs/OdooApp --install-lib=lib/python2.7/site-packages'

  STDOUT:
running install
running build
running build_ext
building 'zbar' extension
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/fapruzzese/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/fapruzzese/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC -I/home/fapruzzese/Projects/Kivy/kivy_demo_app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/Include -I/home/fapruzzese/Projects/Kivy/kivy_demo_app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2 -c zbarmodule.c -o build/temp.linux-x86_64-2.7/zbarmodule.o
In file included from /home/fapruzzese/Projects/Kivy/kivy_demo_app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/Include/Python.h:58:0,
                 from zbarmodule.h:24,
                 from zbarmodule.c:24:
/home/fapruzzese/Projects/Kivy/kivy_demo_app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/Include/pyport.h:849:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
 #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
  ^
In file included from /home/fapruzzese/Projects/Kivy/kivy_demo_app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/Include/Python.h:126:0,
                 from zbarmodule.h:24,
                 from zbarmodule.c:24:
/home/fapruzzese/Projects/Kivy/kivy_demo_app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/Include/modsupport.h:27:1: warning: 'PyArg_ParseTuple' is an unrecognized format function type [-Wformat=]
 PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...) Py_FORMAT_PARSETUPLE(PyArg_ParseTuple, 2, 3);
 ^
In file included from zbarmodule.c:24:0:
zbarmodule.h:26:18: fatal error: zbar.h: No such file or directory
 #include <zbar.h>
                  ^
compilation terminated.
error: command 'arm-linux-androideabi-gcc' failed with exit status 1


  STDERR:

# Command failed: python -m pythonforandroid.toolchain --color=always --storage-dir=/home/fapruzzese/Projects/Kivy/kivy_demo_app/.buildozer/android/platform/build create --dist_name=OdooApp --bootstrap=sdl2 --requirements=python2,kivy,unicodecsv,erppeek,zbar --arch armeabi-v7a --copy-libs
# 
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2

In desktop environment this problem is solved by installation of libzbar-dev from system repository.

Can anyone help me, please? Thanks

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions