Error when building Paraview 5.9.1 with Python enabled

Hi ParaView support,
I am trying to install Paraview 5.9.1 on Ubuntu 18.04. I am using the ccmake process outlined in this archived site: https://www.paraview.org/Wiki/ParaView:Build_And_Install

After running “make” and the compilation process 96% completing, I am getting the following error:

/usr/bin/ld: /usr/local/lib/libpython3.8.a(tokenizer.o): relocation R_X86_64_PC32 against symbol `PyExc_SyntaxError’ can not be used when making a shared object; recompile with -fPIC

/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status

How do I recompile Paraview with “-fPIC”? I have searched the forums and cannot find my problem on here.

I have set the following python parameters:

PARAVIEW_USE_PYTHON = ON
Python3_EXECUTABLE /usr/local/bin/python3.8
Python3_INCLUDE_DIR /usr/local/include/python3.8
Python3_LIBRARY /usr/local/lib/libpython3.8.a

Thanks in advance, dsan.

Which is deprecated, new guide is here:

https://gitlab.kitware.com/paraview/paraview/-/blob/master/Documentation/dev/build.md

I tried using the new installation instructions before and I didn’t understand how to configure directories to point the installer to new versions of Qt5 and Python. I have successfully used ccmake for installing v5.11.1 without Python, but am running into issues with v5.9.1 with Python.

If I use ninja, and this installation command:

cmake -GNinja -DPARAVIEW_USE_PYTHON=ON -DPARAVIEW_USE_MPI=ON -DVTK_SMP_IMPLEMENTATION_TYPE=TBB -DCMAKE_BUILD_TYPE=Release ../paraview

I get the following error:

CMake Warning at VTK/CMake/vtkModule.cmake:4222 (find_package):
  Could not find a configuration file for package "Qt5" that is compatible
  with requested version "5.12".

The following configuration files were considered but not accepted:

    /usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake, version: 5.9.5

Call Stack (most recent call first):
  Qt/Core/CMakeLists.txt:165 (vtk_module_find_package)


CMake Error at VTK/CMake/vtkModule.cmake:4228 (message):
  Could not find the Qt5 external dependency.
Call Stack (most recent call first):
  Qt/Core/CMakeLists.txt:165 (vtk_module_find_package)

I downloaded Qt5.12.0 and installed a separate directory in /home/user/Qt5.12.0/5.12.0/. I need to retain the existing Qt because it is being used in OpenFOAM. The Qt5.12.0 file mentioned above is found in:

/home/usr/Qt5.12.0/5.12.0/gcc_64/lib/cmake/Qt5/Qt5Config.cmake

What flag do I need to tell cmake where the revised Qt5.12.0 path is?

I succeeded. For posterity:
To direct ninja to a separate Qt installation, edit the CMakeCache.txt file. I had to change the directory to my new installation of Qt5.12.0 with the following Qt variables:

I retried installing with ninja and came back to the same error in the first post. “recompile with -fPIC” refers to an error with the python installation which somehow was initially installed without shared libraries.

I followed these directions to install a fresh copy of python3.8 https://tttapa.github.io/Pages/Ubuntu/Software-Installation/Python.html, and left it in my /home/usr/.local/ folder so that I did not disturb the system python version. The key is to install with the following minimum settings.

./configure --enable--shared

With new python installed, I edited the CMakeCache.txt file to direct the Python references to the new installation in /home/usr/.local/ files:
image

Or use CMake as usual, -DQt5_DIR.