Hello,
paraview-dev from Debian Testing/Sid is broken. I tried to fix it, but
new bugs were popping up as soon as i fixed one. Here are my findings.

First, the VCS repository [1][2] is not up to date, it's missing
commits: Salsa has 5.7.0-2 [1], but Debian Sid has 5.7.0-4 [3]. I worked
on the newer version from Sid. I applied all patches from merge request
#1 [4] on top of ParaView 5.7.0-4 to fix bug #959387 [5].

One set of bugs is caused by debian/rules, because it alters the
filesystem after it has build ParaView. For example, it moves files from
/usr/lib/x86_64-linux-gnu/python3* to /usr/lib/python3* [6], renames
e.g. /usr/bin/pvbatch3.8 to /usr/bin/pvbatch and then dh_python3 renames
libraries e.g. from vtkClientServerPython.so to
vtkClientServerPython.cpython-38-x86_64-linux-gnu.so. Hence ParaView's
exported CMake files [7] cannot find those files at the original
locations. When you try to import ParaView into your own code using
CMake (and its find_package command), then CMake fails due to missing
files. For some ideas how to fix those bugs, please see file
debian.patch [8].

ParaView's CMake flag VTK_PYTHON_OPTIONAL_LINK must be OFF to fix vtk
issue #17692 [9].

Another problem is, that FFMPEG_VERSION in libavutil/ffversion.h [10]
from Debian package libavutil-dev [11] is "4.3-3+b2". ParaView picks up
this version in VTK/CMake/FindFFMPEG.cmake [12] during build, stores it
in CMake variable FFMPEG_VERSION and then exports it to file
VTK-vtk-module-find-packages.cmake [13]. The latter then contains
"find_package(FFMPEG 4.3-3+b2 ...", which breaks CMake's find_package
[14], because find_package's version format is
major[.minor[.patch[.tweak]]], but no plus or minus. So once again, when
you try to "find_package(ParaView...)" in your own CMakeLists.txt, then
CMake fails again. One workaround is to remove the additional version
postfix from the FFMPEG_VERSION CMake variable, please see file
vtk-cmake-findffmpeg-cmake.patch [15].

By the way, in ParaView's sources [1], there is a subdirectory "VTK"
which is a copy of the upstream vtk.git [16]. (This "VTK" folder is
actually a git submodule in the upstream repo [17]). The vtk code is
already packaged in Debian [18][19] and has a lot of patches [20], but
the VTK subdirectory in ParaView lacks most of these patches. Perhaps it
may be beneficial to either copy those patches [20] or copy the whole
already-patched vtk source tree from [19] to ParaView's VTK subdirectory.

Another quirk of Debian's ParaView package, that got me thinking, is
mpi4py. ParaView builds and links against its own variant of mpi4py, but
the resulting files are not integrated into the debian package. At
runtime the system provided mpi4py libraries are used. One has to be
very careful with keeping both versions, the
ParaView-build-in-but-not-installed and the system-provided mpi4py
libraries, in sync to prevent probably-hard-to-detect bugs.
Unfortunately i could not figure out yet how to force ParaView to use
mpi4py that is provided by the system.

After all patches [8][15] have been applied, my little toy project [21]
successfully compiles and links against ParaView. I never expected that
creating debian packages for ParaView is that hard! Hopefully, someday
someone with more debian skills fixes the "dh_python3 --no-ext-rename"
hack in debian/rules and uploads a fixed debian package. Thank you and
keep up the great work :-)

Regards
Jakob

[1] https://salsa.debian.org/science-team/paraview
[2] https://tracker.debian.org/pkg/paraview
[3] https://packages.debian.org/sid/paraview
[4] https://salsa.debian.org/science-team/paraview/-/merge_requests/1
[5] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=959387
[6] mv debian/tmp/usr/lib/*/python3* debian/tmp/usr/lib/
[7]
/usr/lib/x86_64-linux-gnu/cmake/paraview-5.7/ParaViewPython-targets-release.cmake
[8] debian.patch [attached to this mail]
[9] https://gitlab.kitware.com/vtk/vtk/-/issues/17692
[10] /usr/include/x86_64-linux-gnu/libavutil/ffversion.h
[11] https://packages.debian.org/buster/libavutil-dev
[12]
https://salsa.debian.org/science-team/paraview/-/blob/4c909f1888037e64a655f630910c9f90a5ae3bda/VTK/CMake/FindFFMPEG.cmake#L152
[13]
/usr/lib/x86_64-linux-gnu/cmake/paraview-5.7/vtk/VTK-vtk-module-find-packages.cmake
[14] https://cmake.org/cmake/help/latest/command/find_package.html
[15] vtk-cmake-findffmpeg-cmake.patch [attached to this mail]
[16] https://gitlab.kitware.com/vtk/vtk.git
[17] https://github.com/Kitware/ParaView
[18] https://salsa.debian.org/science-team/vtk7
[19] https://tracker.debian.org/pkg/vtk7
[20] https://salsa.debian.org/science-team/vtk7/-/tree/master/debian/patches
[21] paraview-example.zip [attached to this mail]

--- paraview-5.7.0.orig/debian/rules	2020-08-06 09:08:41.717132011 +0200
+++ paraview-5.7.0/debian/rules	2020-08-06 11:47:47.878542070 +0200
@@ -53,6 +53,8 @@
 	-DVTK_INSTALL_DATA_DIR="share/paraview" \
 	-DVTK_INSTALL_DOC_DIR="share/doc/paraview" \
 	-DVTK_INSTALL_PACKAGE_DIR="lib/cmake/paraview" \
+	-DPARAVIEW_PYTHON_SITE_PACKAGES_SUFFIX="lib/python3/dist-packages" \
+	-DVTK_PYTHON_OPTIONAL_LINK=OFF \
 	-DVTK_MODULE_USE_EXTERNAL_VTK_doubleconversion=ON \
 	-DVTK_MODULE_USE_EXTERNAL_VTK_eigen=ON \
 	-DVTK_MODULE_USE_EXTERNAL_VTK_hdf5=ON \
@@ -104,16 +106,17 @@
 
 override_dh_auto_install: $(foreach pyver,$(PY3VERS), my_install_python$(pyver))
 	# Use the defaut python3 version for the tools
-	cd debian/tmp/usr/bin $(foreach exe,pvbatch pvpython,&& mv $(exe)$(PY3DEF) $(exe))
-	# Move out python3 modules from archtriplet subfolder to have correct behavior from dh_python3
-	mv debian/tmp/usr/lib/*/python3* debian/tmp/usr/lib/
+	cd debian/tmp/usr/bin $(foreach exe,pvbatch pvpython,&& ln -s $(exe)$(PY3DEF) $(exe))
 	# Drop unwanted mpi4py module
-	rm -fr debian/tmp/usr/lib/python3*/site-packages/mpi4py
+	rm -fr debian/tmp/usr/lib/python3*/dist-packages/mpi4py
 
 my_test_python%: pyver=$(patsubst my_test_python%,%,$@)
 my_test_python%:
 	dh_auto_test -Bbuild.python$(pyver)
 
+override_dh_python3:
+	dh_python3 --no-ext-rename # Hack: Do not rename libraries from e.g. vtkClientServerPython.so to vtkClientServerPython.cpython-38-x86_64-linux-gnu.so!
+
 override_dh_auto_test: $(foreach pyver,$(PY3VERS), my_test_python$(pyver))
 
 override_dh_compress:
--- paraview-5.7.0.orig/debian/paraview.install	2020-08-06 10:33:31.855142294 +0200
+++ paraview-5.7.0/debian/paraview.install	2020-08-06 10:31:41.123012680 +0200
@@ -1,7 +1,7 @@
 debian/*.xpm usr/share/pixmaps/
 debian/*.desktop usr/share/applications/
 usr/bin/paraview
-usr/bin/pvbatch
+usr/bin/pvbatch*
 usr/bin/pvdataserver
 usr/bin/pvrenderserver
 usr/bin/pvserver
--- paraview-5.7.0.orig/debian/python3-paraview.install	2020-08-06 10:33:43.671156125 +0200
+++ paraview-5.7.0/debian/python3-paraview.install	2020-08-06 10:31:59.395034064 +0200
@@ -1,3 +1,3 @@
-usr/bin/pvpython
+usr/bin/pvpython*
 usr/lib/*/vtk
 usr/lib/python3*

<<attachment: paraview-example.zip>>

--- paraview-5.7.0.orig/VTK/CMake/FindFFMPEG.cmake	2019-10-09 12:24:09.000000000 +0200
+++ paraview-5.7.0/VTK/CMake/FindFFMPEG.cmake	2020-08-05 16:57:39.946570358 +0200
@@ -154,6 +154,7 @@
     file(STRINGS "${_ffmpeg_version_header_path}" _ffmpeg_version
       REGEX "FFMPEG_VERSION")
     string(REGEX REPLACE ".*\"n?\(.*\)\"" "\\1" FFMPEG_VERSION "${_ffmpeg_version}")
+    string(REGEX MATCH "[0-9\.]*" FFMPEG_VERSION "${FFMPEG_VERSION}")
     unset(_ffmpeg_version)
   else ()
     set(FFMPEG_VERSION FFMPEG_VERSION-NOTFOUND)

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
debian-science-maintainers mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/debian-science-maintainers

Reply via email to