Custom Build and Python Packages

Hi everybody! I'm running a custom build of openwrt v 19.7.03 with ramips devices. Well i cutomise my packages and also manage to build some from sources. Now I need to do some kind of IPC communication with a C application and a Python. In openwrt exist the zmq package to do this. Selecting and building zqm for the C application every thing is fine. But this does not exist for the python/3. I take as example some feeds makefiles for python3 libraries at openwrt folders and with some info from the web. I successfully managed to build the pyzmq package with the files bellow.
But when importing zmq at python3 it trows me errors:

root@OpenWrt:/# python3
Python 3.7.7 (default, May 16 2020, 18:32:20)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import zmq
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.7/site-packages/zmq/__init__.py", line 103, in <module>
  File "/usr/lib/python3.7/site-packages/zmq/backend/__init__.py", line 32, in <module>
  File "/usr/lib/python3.7/site-packages/zmq/backend/__init__.py", line 27, in <module>
  File "/usr/lib/python3.7/site-packages/zmq/backend/select.py", line 32, in select_backend
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
  File "/usr/lib/python3.7/site-packages/zmq/backend/cython/__init__.py", line 6, in <module>
ImportError: Error relocating /usr/lib/python3.7/site-packages/zmq/backend/cython/utils.cpython-37.so: zmq_curve_public: symbol not found

Makefile:


include $(TOPDIR)/rules.mk

PKG_NAME:=python-zmq
PKG_VERSION:=22.0.3
PKG_RELEASE:=1

PKG_SOURCE:=pyzmq-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://files.pythonhosted.org/packages/15/81/009a2cd08bc5de6ed092c94508b45d6dbc6f6d0bbeddbe14d36b51f28216/
PKG_HASH:=824ad5888331aadeac772bce27e1c2fbcab82fade92edbd234542c4e12f0dca9

PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-pyzmq-$(PKG_VERSION)


PKG_MAINTAINER:=jonh lemons <beatles@beatles.com>
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=COPYING.BSD

include $(INCLUDE_DIR)/package.mk
include ../python-package.mk
include ../python3-package.mk

PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)

define Package/python3-zmq
  SUBMENU:=Python
  SECTION:=lang
  CATEGORY:=Languages
  TITLE:=Python bindings for 0MQ
  URL:=https://github.com/zeromq/pyzmq
  VARIANT:=python3
  DEPENDS:=\
     +python3-light \
     +python3-asyncio\
     +python3-ctypes \
     +python3-distutils \
     +python3-logging \
     +libzmq
endef

define Package/python3-zmq/description
  This package contains Python bindings for 0MQ.
  0MQ is a lightweight and fast messaging implementation.
endef

define prepare_pyzmq_setup
	$(CP) ./files/setup.cfg $(PKG_BUILD_DIR)/setup.cfg
endef

Hooks/Compile/Pre += prepare_pyzmq_setup

PYTHON3_PKG_SETUP_ARGS:= --zmq=$(PKG_BUILD_DIR)/zmq

$(eval $(call Py3Package,python3-zmq))
$(eval $(call BuildPackage,python3-zmq))
$(eval $(call BuildPackage,python3-zmq-src))

patch (0001-setup.py-use-darwin-hack-for-all-platforms.patch)

setup.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)


--- a/setup.py
+++ b/setup.py
@@ -233,10 +233,7 @@ def _add_rpath(settings, path):
 
     Implemented here because distutils runtime_library_dirs doesn't do anything on darwin
     """
-    if sys.platform == 'darwin':
-        settings['extra_link_args'].extend(['-Wl,-rpath', '-Wl,%s' % path])
-    else:
-        settings['runtime_library_dirs'].append(path)
+    settings['extra_link_args'].extend(['-Wl,-rpath','-Wl,%s' % path])
 
 
 def settings_from_prefix(prefix=None):

setup.cfg

[global]
skip_check_zmq = True

Any help are welcome...

Thanks!

I will ping back my post. The problem was related with python version. I managed to bump my python version to 1.8.5 and everything was fine. Just a little question how to integrate external generic files on a custom build? The cloned versions of openwrt does not include any more the "files" folder at build dir.

Thanks!