Link to python error when compiling ParaView with -DPARAVIEW_BUILD_TESTING=ON

Hi all,

I’m facing a link problem when i try to build ParaView when the option PARAVIEW_BUILD_TESTING is on.
When it is OFF, ParaView build successfully.
The errors arise when compiling some of the test modules of the VTKExtensions such as IOCGNS.

The error message is the following:

FAILED: bin/vtkPVVTKExtensionsIOCGNSWriterCxxTests 
: && /usr/bin/c++ -O2 -g -DNDEBUG -Wl,-lc  -Wl,-lc VTKExtensions/IOCGNS/Testing/Cxx/CMakeFiles/vtkPVVTKExtensionsIOCGNSWriterCxxTests.dir/vtkPVVTKExtensionsIOCGNSWriterCxxTests.cxx.o VTKExtensions/IOCGNS/Testing/Cxx/CMakeFiles/vtkPVVTKExtensionsIOCGNSWriterCxxTests.dir/TestPartitionedDataSetCollection2.cxx.o VTKExtensions/IOCGNS/Testing/Cxx/CMakeFiles/vtkPVVTKExtensionsIOCGNSWriterCxxTests.dir/TestStructuredGrid.cxx.o VTKExtensions/IOCGNS/Testing/Cxx/CMakeFiles/vtkPVVTKExtensionsIOCGNSWriterCxxTests.dir/TestUnstructuredGrid.cxx.o VTKExtensions/IOCGNS/Testing/Cxx/CMakeFiles/vtkPVVTKExtensionsIOCGNSWriterCxxTests.dir/TestPartitionedDataSet.cxx.o VTKExtensions/IOCGNS/Testing/Cxx/CMakeFiles/vtkPVVTKExtensionsIOCGNSWriterCxxTests.dir/TestPartitionedDataSetCollection.cxx.o VTKExtensions/IOCGNS/Testing/Cxx/CMakeFiles/vtkPVVTKExtensionsIOCGNSWriterCxxTests.dir/TestPolydata.cxx.o VTKExtensions/IOCGNS/Testing/Cxx/CMakeFiles/vtkPVVTKExtensionsIOCGNSWriterCxxTests.dir/TestPolyhedral.cxx.o VTKExtensions/IOCGNS/Testing/Cxx/CMakeFiles/vtkPVVTKExtensionsIOCGNSWriterCxxTests.dir/TestCellAndPointData.cxx.o VTKExtensions/IOCGNS/Testing/Cxx/CMakeFiles/vtkPVVTKExtensionsIOCGNSWriterCxxTests.dir/TestMultiBlockDataSet.cxx.o VTKExtensions/IOCGNS/Testing/Cxx/CMakeFiles/vtkPVVTKExtensionsIOCGNSWriterCxxTests.dir/TestMappedUnstructuredGrid.cxx.o VTKExtensions/IOCGNS/Testing/Cxx/CMakeFiles/vtkPVVTKExtensionsIOCGNSWriterCxxTests.dir/TestTimeWriting.cxx.o VTKExtensions/IOCGNS/Testing/Cxx/CMakeFiles/vtkPVVTKExtensionsIOCGNSWriterCxxTests.dir/TestRectilinearGrid.cxx.o VTKExtensions/IOCGNS/Testing/Cxx/CMakeFiles/vtkPVVTKExtensionsIOCGNSWriterCxxTests.dir/TestImageData.cxx.o -o bin/vtkPVVTKExtensionsIOCGNSWriterCxxTests  -Wl,-rpath,/opt/paraview_build/lib:/usr/lib/x86_64-linux-gnu/openmpi/lib:/usr/lib/x86_64-linux-gnu/hdf5/serial  lib/libvtkTestingDataModel-pv5.12.so.5.12  lib/libvtkIOIOSS-pv5.12.so.5.12  lib/libvtkPVCoreKit-pv5.12.so.5.12  /usr/lib/x86_64-linux-gnu/libexpat.so  lib/libvtkParallel-pv5.12.so.5.12  lib/libvtkIO-pv5.12.so.5.12  lib/libvtkFilters-pv5.12.so.5.12  lib/libvtkverdict-pv5.12.so.5.12  /usr/lib/x86_64-linux-gnu/libpugixml.so.1.13  lib/libvtkCommon-pv5.12.so.5.12  lib/libvtksys-pv5.12.so.5.12  lib/libvtktoken-pv5.12.so.5.12  lib/libvtkloguru-pv5.12.so.5.12  lib/libvtkkissfft-pv5.12.so.5.12  /usr/lib/x86_64-linux-gnu/libdouble-conversion.so  /usr/lib/x86_64-linux-gnu/liblz4.so  /usr/lib/x86_64-linux-gnu/liblzma.so  /usr/lib/x86_64-linux-gnu/libz.so  lib/libvtkcgns-pv5.12.so.5.12  lib/libvtkfmt-pv5.12.so.5.12  /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so  /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so  /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_hl.so  -ldl  -Wl,-rpath-link,/opt/paraview_build/lib:/usr/lib/x86_64-linux-gnu/hdf5/serial && :
/usr/bin/ld: /opt/paraview_build/lib/libvtkWrappingPythonCore3.11-pv5.12.so.1: undefined reference to `PyUnicode_InternFromString'
/usr/bin/ld: /opt/paraview_build/lib/libvtkWrappingPythonCore3.11-pv5.12.so.1: undefined reference to `PyDict_DelItemString'
/usr/bin/ld: /opt/paraview_build/lib/libvtkPythonInterpreter-pv5.12.so.1: undefined reference to `_Py_Dealloc'
/usr/bin/ld: /opt/paraview_build/lib/libvtkWrappingPythonCore3.11-pv5.12.so.1: undefined reference to `PyByteArray_AsString'
/usr/bin/ld: /opt/paraview_build/lib/libvtkWrappingPythonCore3.11-pv5.12.so.1: undefined reference to `PyLong_FromLong'
/usr/bin/ld: /opt/paraview_build/lib/libvtkWrappingPythonCore3.11-pv5.12.so.1: undefined reference to `PyExc_KeyError'
/usr/bin/ld: /opt/paraview_build/lib/libvtkPythonInterpreter-pv5.12.so.1: undefined reference to `PyStatus_Exception'
/usr/bin/ld: /opt/paraview_build/lib/libvtkWrappingPythonCore3.11-pv5.12.so.1: undefined reference to `PyExc_NotImplementedError'
/usr/bin/ld: /opt/paraview_build/lib/libvtkWrappingPythonCore3.11-pv5.12.so.1: undefined reference to `PyByteArray_Type'
/usr/bin/ld: /opt/paraview_build/lib/libvtkWrappingPythonCore3.11-pv5.12.so.1: undefined reference to `PyNumber_Absolute'
/usr/bin/ld: /opt/paraview_build/lib/libvtkWrappingPythonCore3.11-pv5.12.so.1: undefined reference to `PyDescr_NewClassMethod'
/usr/bin/ld: /opt/paraview_build/lib/libvtkPythonInterpreter-pv5.12.so.1: undefined reference to `PyType_IsSubtype'
/usr/bin/ld: /opt/paraview_build/lib/libvtkWrappingPythonCore3.11-pv5.12.so.1: undefined reference to `PyErr_Fetch'
/usr/bin/ld: /opt/paraview_build/lib/libvtkPythonInterpreter-pv5.12.so.1: undefined reference to `Py_PreInitialize'
...
collect2: error: ld returned 1 exit status

I have made a reproducer through the following Dockerfile
Dockerfile (2.8 KB)

When built, run the container and in the /opt/paraview_build just run cmake --build ..

I found a hack to workaround. It is to add a dependency to ParaView::RemotingApplication in the TEST_DEPENDS section of the vtk.module files involved.

Should i open an issue on gitlab?

Thanks in advance

I confirm that I reproduce the issue using the provided Dockerfile.

Should i open an issue on gitlab?

Yes

Ah, this looks like a kit build…forward link logic may be lacking there.

@mwestphal i opened https://gitlab.kitware.com/paraview/paraview/-/issues/22423

@ben.boeckel i’m sorry but i do not understand your answer.

Does it mean that i’am missing something in the CMake configuration?

No, it’s a VTK bug that this doesn’t work, but you can avoid it by turning kits off (-DPARAVIEW_BUILD_WITH_KITS=OFF).

@ben.boeckel with -DPARAVIEW_BUILD_WITH_KITS=OFF the compilation succeeds.
Thanks!