packages icon indicating copy to clipboard operation
packages copied to clipboard

unbound failed to build with python

Open beelze opened this issue 1 year ago • 10 comments

Maintainer: @BKPepe Environment: (mips_24kc_musl/ath79_generic, OpenWrt 23.05)

Unbound-1.19.1 failed to build with PACKAGE_libunbound_pythonmodule=y

Seems that one issue is in Makefile:

 $(if $(CONFIG_PACKAGE_libunbound_python),--with-pythonmodule,) \

Here expected to be PACKAGE_libunbound_pythonmodule instead of CONFIG_PACKAGE_libunbound_python

Issuing make package/unbound/configure V=sc I've got:

checking for python... /mnt/bulk/openwrt-build/openwrt/staging_dir/host/bin/python
checking for the sysconfig Python module... yes
checking for Python include path... -I/usr/include/python3.11
checking for Python library path... -L/usr/lib64 -L/usr/lib/python3.11 -L. -lpython3.11
checking for Python site-packages path... /usr/lib/python3.11/site-packages
checking consistency of all components of python development environment... no
configure: error: 
  Could not link test program to Python. Maybe the main Python library has been
  installed in some non-standard library path. If so, pass it to configure,
  via the LDFLAGS environment variable.
  Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"

seems configure is looking for python stuff outside <buildroot>. Here's configure log: build.log

beelze avatar Mar 14 '24 03:03 beelze

I am not the maintainer. Feel free to propose pull request or ask @EricLuehrsen , the maintainer of unbound here.

BKPepe avatar Mar 14 '24 13:03 BKPepe

@EricLuehrsen , is there any chance to resolve an issue? Tried to fix it myself but no luck

beelze avatar Mar 14 '24 17:03 beelze

You see here it picks up host python:

checking for Python site-packages path... /usr/lib/python3.11/site-packages

brada4 avatar Mar 14 '24 18:03 brada4

I'm not sure if the host python is needed for build process, but unbound itself (with pythonmodule) should be linked against libpython. I believe the proper lib is ./staging_dir/target-mips_24kc_musl/usr/lib/libpython3.11.so.1.0 but not /usr/lib64/libpython3.11.so.1.0, so -L/usr/lib64 is obviously wrong

beelze avatar Mar 15 '24 03:03 beelze

Additionally, because of swig is needed for building unbound with python, Makefile needed something like PKG_BUILD_DEPENDS:=PACKAGE_libunbound_pythonmodule:swig/host Idk about proper syntax, though...

beelze avatar Mar 15 '24 07:03 beelze

This custom option was built a long time ago. I haven't worked with unbound+python in awhile, so I am unclear on what dependencies may have shifted.

EricLuehrsen avatar Mar 16 '24 21:03 EricLuehrsen

@EricLuehrsen Yes, there is a few changes that should be done (not only python-related). Currently I'm working on it.

beelze avatar Mar 18 '24 15:03 beelze

@EricLuehrsen I've managed to successfully build and run unbound with pythonmodule (along with other small fixes), Are you interested in it? Just in case, here's a patch

A little explanation about minor changes:

  1. --with-user is not supported by configure, but --with-username is
  2. PACKAGE_libunbound_ipset is n because of openwrt nowadays uses nftables instead iptables and ipset userspace utility (along with kernel module) isn't installed by default
  3. Building unbound with pythonmodule requires host swig, so I've put a dependency

beelze avatar Mar 19 '24 14:03 beelze

musl?

brada4 avatar Mar 19 '24 16:03 brada4

Yes, I've biult unbound with target-mips_24kc_musl

beelze avatar Mar 19 '24 16:03 beelze