[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dpkg-shlibdeps: error: cannot find library (Was: Bug#977308: shasta: hardcoded dependencies on boost 1.71)



On 2020-12-18, at 15:32:01 +0100, Andreas Tille wrote:
> I tried no override_dh_shlibdeps in shasta debian/rules, which has
> lead to:
>
> dpkg-shlibdeps: error: cannot find library
> /usr/lib/python3/dist-packages/shasta.cpython-39-x86_64-linux-gnu.so
> needed by debian/shasta/usr/bin/shasta (ELF format: 'elf64-x86-64'
> abi:      '0201003e00000000'; RPATH: '')
> dpkg-shlibdeps: error: cannot continue due to the error above Note:
> libraries are not searched in other binary packages that do not have
> any shlibs or symbols file.  To help dpkg-shlibdeps find private
> libraries, you might need to use -l.
> dh_shlibdeps: error: dpkg-shlibdeps -Tdebian/shasta.substvars
> debian/shasta/usr/bin/shasta returned exit code 2
> dh_shlibdeps: error: Aborting due to earlier error
>
> and in the pbuilder chroot I also tried the there commands I added to
> the comment in
>
>
> https://salsa.debian.org/med-team/shasta/-/commit/366edd672be428cc553b34b99bc614aa698175d6
>
> with no success - dpkg-shlibdeps simply did not found the shared
> library which exists at the said place.  I wonder what might be wrong
> here and how to fix this.

If you haven't got this sorted yet, try the attached patch.  It also
corrects the SONAME of shasta.so.  It does mean there's an RPATH in the
executable, however.

The problem with the previous solution is that it sets the NEEDED value
in the executable to the absolute path of the shared library, instead of
the SONAME, so it didn't matter what directory was passed,
dpkg-shlibdeps wouldn't find a library with the right SONAME.

J.
diff --git a/debian/rules b/debian/rules
index 0e286eb38f66..f1593bfc0179 100755
--- a/debian/rules
+++ b/debian/rules
@@ -9,6 +9,7 @@ include /usr/share/dpkg/default.mk
 export DEB_BUILD_MAINT_OPTIONS=hardening=+all
 
 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+MULTIARCH_SONAME = shasta.cpython-$(shell py3versions -vd | sed 's/\.//')-$(DEB_HOST_MULTIARCH).so
 
 %:
 	dh $@ --with python3,sphinxdoc
@@ -24,22 +25,23 @@ override_dh_auto_build:
 	find . -name "shasta.so" -exec cp {} docs/PythonApi/ \;
 	PYTHONPATH=docs/PythonApi/ python3 -m sphinx -N -bhtml docs/PythonApi/ build/html # HTML generator
 
+override_dh_python3:
+	dh_python3
+	patchelf \
+		--set-soname $(MULTIARCH_SONAME) \
+		$(CURDIR)/debian/python3-shasta/usr/lib/python3/dist-packages/$(MULTIARCH_SONAME)
+
 override_dh_install-arch:
 	dh_install -a
 	# Rename shastaDynamic to shasta for ease
 	mv debian/shasta/usr/bin/shastaDynamic debian/shasta/usr/bin/shasta
 	# The library is in a more unusual place (nested within /usr/lib), so modify
 	# the ELF
-	chrpath -d debian/shasta/usr/bin/shasta
-	patchelf --replace-needed shasta.so /usr/lib/python3/dist-packages/shasta.cpython-`py3versions -vd | sed 's/\.//'`-${DEB_HOST_MULTIARCH}.so \
+	chrpath -r /usr/lib/python3/dist-packages \
+		debian/shasta/usr/bin/shasta
+	patchelf \
+		--replace-needed shasta.so $(MULTIARCH_SONAME) \
 		debian/shasta/usr/bin/shasta
-
-override_dh_shlibdeps:
-	# Tried:
-	#dh_shlibdeps -v -Lpython3-shasta
-	#dh_shlibdeps -v -l/usr/lib/python3/dist-packages
-	#dh_shlibdeps -v -l$(CURDIR)/debian/python3-shasta/usr/lib/python3/dist-packages
-	# but all failed :-(
 
 override_dh_missing:
 	# No need to install docker files

Attachment: signature.asc
Description: PGP signature


Reply to: