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

Errors in zmq recipe

Open yves-surrel opened this issue 3 years ago • 8 comments

Versions

  • Python: 3.9
  • OS: MacOS 11.7
  • Buildozer: 1.4.0

Description

1- Get error when issuing buildozer -v android debug. As it does not seem to be related to buildozer but to the recipe, I post the issue here.

In file included from src/mtrie.cpp:32:
./src/generic_mtrie_impl.hpp:52:46: error: ISO C++ requires the name after '::~' to be found in the same scope as the name before '::~' [-Werror,-Wdtor-name]
template <typename T> zmq::generic_mtrie_t<T>::~generic_mtrie_t ()
                      ~~~~~~~~~~~~~~~~~~~~~~~^~
                                             ::generic_mtrie_t

After fixing that one (see below), I get:

  STDOUT:
Making install in doc
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: Nothing to be done for `install-exec-am'.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
 config/install-sh -c -d '/Users/yves/buildozer_dps/.buildozer/android/platform/build-arm64-v8a/build/other_builds/libzmq/arm64-v8a__ndk_target_21/libzmq/install/include'
 config/install-sh -c -d '/Users/yves/buildozer_dps/.buildozer/android/platform/build-arm64-v8a/build/other_builds/libzmq/arm64-v8a__ndk_target_21/libzmq/install/lib/pkgconfig'
 config/install-sh -c -d '/Users/yves/buildozer_dps/.buildozer/android/platform/build-arm64-v8a/build/other_builds/libzmq/arm64-v8a__ndk_target_21/libzmq/install/lib'
mkdir: /Users/yves/buildozer_dps/.buildozer/android/platform/build-arm64-v8a/build/other_builds/libzmq/arm64-v8a__ndk_target_21/libzmq/install: File exists
mkdir: /Users/yves/buildozer_dps/.buildozer/android/platform/build-arm64-v8a/build/other_builds/libzmq/arm64-v8a__ndk_target_21/libzmq/install: Not a directory
mkdir: /Users/yves/buildozer_dps/.buildozer/android/platform/build-arm64-v8a/build/other_builds/libzmq/arm64-v8a__ndk_target_21/libzmq/install: File exists
mkdir: /Users/yves/buildozer_dps/.buildozer/android/platform/build-arm64-v8a/build/other_builds/libzmq/arm64-v8a__ndk_target_21/libzmq/install/lib: Not a directory
mkdir: /Users/yves/buildozer_dps/.buildozer/android/platform/build-arm64-v8a/build/other_builds/libzmq/arm64-v8a__ndk_target_21/libzmq/install: Not a directory

buildozer.spec

Command:

buildozer -v android debug

Spec file:

requirements = pyzmq
  1. Fix of 1st error

By editing <PROJET_DIR>/.buildozer/android/platform/build-arm64-v8a/build/other_builds/libzmq/arm64-v8a__ndk_target_21/libzmq/src/generic_mtrie_impl.hpp, changing line

template <typename T> zmq::generic_mtrie_t<T>::~generic_mtrie_t ()

to

template <typename T> zmq::generic_mtrie_t<T>::~generic_mtrie_t<T> ()
  1. Fix of 2nd error

By deleting file /Users/yves/buildozer_dps/.buildozer/android/platform/build-arm64-v8a/build/other_builds/libzmq/arm64-v8a__ndk_target_21/libzmq/INSTALL (I thought Unix was case-sensitive...?)

yves-surrel avatar Nov 21 '22 08:11 yves-surrel

Is this still a problem?

kuzeyron avatar Jan 23 '25 17:01 kuzeyron

Currently libzmq has different issues: https://github.com/kivy/python-for-android/issues/3070

emendir avatar Jan 25 '25 19:01 emendir

Currently libzmq has different issues: #3070

Sorry, I'm wrong, those other issues arise from pyzmq, not libzmq.

emendir avatar Jan 26 '25 09:01 emendir

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have the means to take action. Please reach out if you have or find the answers we need so that we can investigate further.

github-actions[bot] avatar Mar 07 '25 05:03 github-actions[bot]

FYI, I have been using for a couple of month the following recipe, without getting any error:

from pythonforandroid.recipe import Recipe
from pythonforandroid.logger import shprint
from pythonforandroid.util import current_directory
from os.path import join
import sh
import os

class LibZMQRecipe(Recipe):
    version = '4.3.5'
    url = 'https://github.com/zeromq/libzmq/releases/download/v{version}/zeromq-{version}.zip'
    depends = []
    built_libraries = {'libzmq.so': 'src/.libs'}
    need_stl_shared = True

    def build_arch(self, arch):
        env = self.get_recipe_env(arch)
        env['LDFLAGS'] = env.get('LDFLAGS', '') + ' -latomic' + ' -lc++_shared'

        # Set the CC and CXX environment variables to the NDK toolchain compilers
        ndk_dir = self.ctx.ndk_dir

        env['CXXFLAGS'] = env.get('CXXFLAGS', '') + ' -mno-outline-atomics'

        curdir = self.get_build_dir(arch.arch)
        prefix = join(curdir, "install")

        with current_directory(curdir):
            shprint(
                sh.Command('sh'), './configure',
                '--host={}'.format(arch.command_prefix),
                '--without-docs',
                '--prefix={}'.format(prefix),
                '--with-libsodium=no',
                '--disable-libunwind',
                '--disable-Werror',
                _env=env
            )
            shprint(sh.make, _env=env)

            # Remove the INSTALL file to prevent errors
            install_file_path = join(curdir, 'INSTALL')
            if os.path.exists(install_file_path):
                os.remove(install_file_path)
                
            shprint(sh.make, 'install', _env=env)

recipe = LibZMQRecipe()

yves-surrel avatar Mar 07 '25 13:03 yves-surrel

FYI, I have been using for a couple of month the following recipe, without getting any error:

@yves-surrel Are you using it in combination with pyzmq? I can't get the latter to work https://github.com/kivy/python-for-android/issues/3070

emendir avatar Mar 13 '25 17:03 emendir

Yes, pyzmq is in my requirements statement in bulldozer.spec.

My recipe is working OK on my MacBook Pro Sequoia.

yves-surrel avatar Mar 14 '25 07:03 yves-surrel

FYI, I have been using for a couple of month the following recipe, without getting any error:

I can't get this recipe to work on Ubuntu 24 using the buildozer docker container. This is the output I get.

  CC       external/unity/unity.o
  CXX      tests/libtestutil_a-testutil.o
  CXX      tests/libtestutil_a-testutil_monitoring.o
  CXX      tests/libtestutil_a-testutil_security.o
  CXX      tests/libtestutil_a-testutil_unity.o
  AR       external/unity/libunity.a
  AR       tests/libtestutil.a
  CXXLD    src/libzmq.la
ld: error: unable to find library -lbsd
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [Makefile:4122: src/libzmq.la] Error 1
make[1]: Leaving directory '/home/user/hostcwd/.buildozer/android/platform/build-arm64-v8a/build/other_builds/libzmq/arm64-v8a__ndk_target_21/libzmq'
make: *** [Makefile:8439: all-recursive] Error 1


  STDERR:

# Command failed: ('/usr/bin/python3', '-m', 'pythonforandroid.toolchain', 'create', '--dist_name=nfsApk', '--bootstrap=sdl2', '--requirements=python3,kivy,kivymd,libzmq', '--arch=arm64-v8a', '--copy-libs', '--color=always', '--storage-dir=/home/user/hostcwd/.buildozer/android/platform/build-arm64-v8a', '--ndk-api=21', '--ignore-setup-py', '--debug')
# Error code: 1
# ENVIRONMENT:
#     PATH = '/home/user/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
#     HOSTNAME = 'b8b833d86edf'
#     USER = 'user'
#     HOME_DIR = '/home/user'
#     WORK_DIR = '/home/user/hostcwd'
#     SRC_DIR = '/home/user/src'
#     LANG = 'en_US.UTF-8'
#     LANGUAGE = 'en_US.UTF-8'
#     LC_ALL = 'en_US.UTF-8'
#     HOME = '/home/user'
#     PACKAGES_PATH = '/home/user/.buildozer/android/packages'
#     ANDROIDSDK = '/home/user/.buildozer/android/platform/android-sdk'
#     ANDROIDNDK = '/home/user/.buildozer/android/platform/android-ndk-r25b'
#     ANDROIDAPI = '31'
#     ANDROIDMINAPI = '21'
# 
# 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

emendir avatar Apr 25 '25 17:04 emendir