Skip to content

build v1.10.0, --enable-rpath, fails to rpath python lib #222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pgnd opened this issue Apr 16, 2020 · 3 comments
Closed

build v1.10.0, --enable-rpath, fails to rpath python lib #222

pgnd opened this issue Apr 16, 2020 · 3 comments

Comments

@pgnd
Copy link

pgnd commented Apr 16, 2020

building

	cd unbound
	git checkout release-1.10.0

on linux/64, with

	pyenv which python3
		/usr/local/pyenv/versions/3.8-dev/bin/python3
	python3 -V
		Python 3.8.2+

spec'ing this^ python to config, enabling rpath

	PYTHON=$( pyenv which python3 ) \
	./configure \
	 ...
	 --enable-rpath \
	 --with-pyunbound \
	 --with-pythonmodule \
	 ...

python is found, but note, NO rpath'ing

	...
	checking for python... /usr/local/pyenv/versions/3.8-dev/bin/python3
	checking for the distutils Python package... yes
	checking for Python include path... -I/usr/local/pyenv/versions/3.8-dev/include/python3.8
	checking for Python library path... -L/usr/local/pyenv/versions/3.8-dev/lib -L/usr/local/pyenv/versions/3.8-dev/lib/python3.8 -L. -lpython3.8
	checking for Python site-packages path... /usr/local/pyenv/versions/3.8-dev/lib/python3.8/site-packages
	checking consistency of all components of python development environment... yes
	...

builds/installs with NO error

	make
	make install

but resulting bin is missing lib link,

	ldd /usr/local/unbound/sbin/unbound | grep python
		libpython3.8.so.1.0 => not found

OTOH, forcing the correct rpath'ing, building with

	export LDFLAGS+=" -L/usr/local/pyenv/versions/3.8-dev/lib -Wl,-rpath,/usr/local/pyenv/versions/3.8-dev/lib -lpython3.8"
	export CPPFLAGS+=" -I/usr/local/pyenv/versions/3.8-dev/include/python3.8"
	PYTHON=$( pyenv which python3 ) \
	./configure \
	 ...
	 --enable-rpath \
	 --with-pyunbound \
	 --with-pythonmodule \
	 ...

fixes the missing lib,

	ldd /usr/local/unbound/sbin/unbound | grep python
		libpython3.8.so.1.0 => /usr/local/pyenv/versions/3.8-dev/lib/libpython3.8.so.1.0 (0x00007f66d6fc0000)
@wcawijngaards
Copy link
Member

The rpath or finding dynamic libraries at runtime is a piece of system administration, not really our software. And I think in this case the solution may be in adding the library path for python 3.8 to the search path at runtime for dynamic libraries. For a Linux system over here that is man ld.so.conf or add a line with /usr/local/pyenv/versions/3.8-dev/lib to /etc/ld.so.conf or add a file with one line with /usr/local/pyenv/versions/3.8-dev/lib into the directory with ld.so.conf files and call it (for example) /etc/ld.so.conf.d/python3.conf . And then run ldconfig .

Or perhaps there is other information elsewhere about adding dynamic library paths to the dynamic library search path list. The rpath option is exactly for this use case though, eg. a user wants to have some libraries in locations not listed by the system and the rpath option lists the directory of the library into the binary so it can be found. So perhaps use rpath because that solves this problem precisely.

Since I got the impression that the problem is already solved, perhaps this is not that bug, or really some other issue like lack of documentation or so?

@pgnd
Copy link
Author

pgnd commented Apr 17, 2020

@wcawijngaards

hi

the problem is already solved, perhaps this is not that bug, or really some other issue like lack of documentation or so

I think the simplest question is, if "--enable-rpath" config option

...
--disable-rpath disable hardcoded rpath (default=enabled)
...
(this^^ is confusing a bit ... is rpath'ing ENABLED or DISABLED by default? or it it the CONFIG OPTION ...)

, doesn't actually properly hardcode lib paths, which is its purpose, then what's it for here? if it's failing to properly rpath all/any, or just some, of the linked libs, then that's a bug imo.

mod'ing LD_LIBRARY_PATH, a user-env changeable ENV var, is the wrong solution here for packaging.

@wcawijngaards
Copy link
Member

We have that option for packagers that want to disable rpath. But the description looks clear to me. The bug is that when you enable rpath, it does not add the python directory to the rpath directory list.

Thanks for the report! Fixed it by adding the python lib directory to the rpath directory list (unless the lib dir is "/usr/lib" or "/usr/lib64").

@wcawijngaards wcawijngaards changed the title build v1.10.0, --with-rpath, fails to rpath python lib build v1.10.0, --enable-rpath, fails to rpath python lib Apr 20, 2020
jedisct1 added a commit to jedisct1/unbound that referenced this issue Apr 20, 2020
* nlnet/master:
  - Fix for count of reply states in the mesh.
  Fix that it is --enable-rpath, for NLnetLabs#222.
  - Fix NLnetLabs#222: --with-rpath, fails to rpath python lib.
  - Document SNI support in unbound-anchor.8.in.
  - Update Changelog for PR NLnetLabs#221.
  - Enable SNI by default in unbound-anchor.
  Revert "- Remove SNI support from unbound-anchor; TLS is used only for"
  - Remove SNI support from unbound-anchor; TLS is used only for   encryption and not validation.
  - Add SNI support on more TLS connections (fixes NLnetLabs#193). - Add SNI support to unbound-anchor.
  - Add doxygen documentation for DSCP.
  - Fix for posix shell syntax for trap in run_msg.sh test script.
  - Fix for posix shell syntax for trap in nsd-control-setup.
  - Fix help return code in unbound-control-setup script.
  - Fix NLnetLabs#220: auth-zone section in config may lead to segfault.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants