Building ParaView 5.10.1 on a Debian 10 machine

Dear ParaView users,

I have encountered an issue when trying to install ParaView 5.10.1 on a Debian 10 machine. I expect the issue to be an easy fix, but unfortunately I was not able to resolve it myself.

To build ParaView from source, I followed the build instructions described here. At first, I made sure to install all required dependencies as specified in the build instructions. Then, I cloned the GitHub repository and checked out the proper tag:

git clone --recursive https://gitlab.kitware.com/paraview/paraview.git
cd ParaView
git checkout v5.10.1
git submodule update --init --recursive

For building and installing ParaView, I created the following shell script (note that I disabled QT, as I only require pvserver):

#!/bin/sh

# Settings
BASE_DIR="<some-path>"
PARAVIEW_SOURCE_DIR="$BASE_DIR/ParaView"
PARAVIEW_BUILD_DIR="$BASE_DIR/build"
PARAVIEW_INSTALL_DIR="$BASE_DIR/paraview-5.10.1-install"
OSPRAY_DIR="$BASE_DIR/ospray-2.10.0.x86_64.linux"

# Create the build directory
mkdir -p $PARAVIEW_BUILD_DIR
cd $PARAVIEW_BUILD_DIR

# Generate Ninja build files
cmake -GNinja $PARAVIEW_SOURCE_DIR \
    -DPARAVIEW_USE_PYTHON=ON \
    -DPARAVIEW_USE_MPI=OFF \
    -DPARAVIEW_USE_CUDA=OFF \
    -DPARAVIEW_USE_QT=OFF \
    -DVTK_SMP_IMPLEMENTATION_TYPE=TBB \
    -DPARAVIEW_ENABLE_RAYTRACING=ON \
    -DCMAKE_C_COMPILER=clang \
    -DCMAKE_CXX_COMPILER=clang++ \
    -DCMAKE_INSTALL_PREFIX="$PARAVIEW_INSTALL_DIR" \
    -DCMAKE_PREFIX_PATH="$OSPRAY_DIR" \
    -DCMAKE_BUILD_TYPE=Release 

# If generation of Ninja build files was succesful, start the build
if [ $? -eq 0 ]; then
    ninja install
else
    echo "Generating build files failed."
fi

Note that in the BASE_DIR directory, I placed the OSPRay binaries downloaded from here.

CMake’s generation stage goes well. Unfortunately, I receive the following linker errors during the build stage:

/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::interface7::internal::task_arena_base::internal_max_concurrency(tbb::interface7::task_arena const*)'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::internal::get_initial_auto_partitioner_divisor()'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::interface7::internal::task_arena_base::internal_initialize()'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `typeinfo for tbb::task'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned long) const'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::task_group_context::is_group_execution_cancelled() const'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::internal::concurrent_vector_base_v3::internal_grow_by(unsigned long, unsigned long, void (*)(void*, void const*, unsigned long), void const*)'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::task::self()'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::internal::concurrent_vector_base_v3::~concurrent_vector_base_v3()'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::internal::NFS_Allocate(unsigned long, unsigned long, void*)'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned long) const'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::task_group_context::cancel_group_execution()'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::internal::concurrent_vector_base_v3::internal_capacity() const'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::internal::concurrent_vector_base_v3::internal_clear(void (*)(void*, unsigned long))'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::internal::allocate_via_handler_v3(unsigned long)'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::interface7::internal::task_arena_base::internal_execute(tbb::interface7::internal::delegate_base&) const'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::interface7::internal::task_arena_base::internal_terminate()'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::task::note_affinity(unsigned short)'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::internal::NFS_Free(void*)'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::task_group_context::~task_group_context()'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::task_group_context::init()'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::internal::thread_get_id_v3()'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::internal::allocate_root_with_context_proxy::free(tbb::task&) const'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::internal::allocate_root_with_context_proxy::allocate(unsigned long) const'
/usr/bin/ld: lib/libvtkCommonCore-pv5.10.so.5.10: undefined reference to `tbb::internal::deallocate_via_handler_v3(void*)'

The errors are clearly related to either a missing TBB library or a wrong version of the TBB library. However, I did install libtbb-dev as stated in the build instructions. From the instructions, I quote:

Ubuntu 18.04 LTS / Debian 10
sudo apt-get install git cmake build-essential libgl1-mesa-dev libxt-dev qt5-default libqt5x11extras5-dev libqt5help5 qttools5-dev qtxmlpatterns5-dev-tools libqt5svg5-dev python3-dev python3-numpy libopenmpi-dev libtbb-dev ninja-build

Notice the second-to-last entry in the apt-get command. To be sure, I checked my installed packages and found the following entry:

libtbb-dev/oldstable,now 2018~U6-4 amd64 [installed]

The TBB library thus seems to be present on the system.

I hope someone has a good suggestion on how to overcome this issue.

Best regards,
Danny

A simple work around is of course to disable TBB SMP backend and to use STDThread.

Another thing to try would be to build VTK with TBB and see if the error is the same.

FYI @Charles_Gueunet

@mwestphal Thank you for the suggestion! Changing the SMP backend from TBB to STDThread indeed worked.

I tried building VTK with the TBB SMP backend using the following commands:

git clone --recursive https://gitlab.kitware.com/vtk/vtk.git
cd vtk
mkdir build
cd build
cmake -GNinja .. \
    -DVTK_USE_MPI=OFF \
    -DVTK_USE_CUDA=OFF \
    -DVTK_SMP_IMPLEMENTATION_TYPE=TBB \
    -DCMAKE_BUILD_TYPE=Release
ninja

During CMake’s generation stage, it gives me the following message:

-- Could NOT find TBB (missing: TBB_DIR)

However, the configuration stage finishes without errors. I can also build the code without errors, so it seems to be working fine. I checked CMake’s cache variables for any variables related to TBB using cmake -LA . -N | grep "TBB", which gives me the following output:

TBB_DIR:PATH=TBB_DIR-NOTFOUND
TBB_INCLUDE_DIR:PATH=/usr/include
TBB_LIBRARY_DEBUG:FILEPATH=/usr/lib/x86_64-linux-gnu/libtbb.so
TBB_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libtbb.so
TBB_MALLOC_INCLUDE_DIR:PATH=/usr/include
TBB_MALLOC_LIBRARY_DEBUG:FILEPATH=/usr/lib/x86_64-linux-gnu/libtbbmalloc.so
TBB_MALLOC_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libtbbmalloc.so
TBB_MALLOC_PROXY_INCLUDE_DIR:PATH=/usr/include
TBB_MALLOC_PROXY_LIBRARY_DEBUG:FILEPATH=/usr/lib/x86_64-linux-gnu/libtbbmalloc_proxy.so
TBB_MALLOC_PROXY_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libtbbmalloc_proxy.so
VTK_SMP_IMPLEMENTATION_TYPE:STRING=TBB

It seems that the only problematic variable is TBB_DIR, as all other TBB related variables contain the proper (file)paths.

I once more tried to build ParaView with the script I supplied above (so including the -DVTK_SMP_IMPLEMENTATION_TYPE=TBB option) to compare its output with the output of the VTK build. I didn’t notice this the first time, but during the configuration stage it also gives me the same message about the missing TBB_DIR variable. However, in this case the TBB related cache variables have different values:

TBB_DIR:PATH=TBB_DIR-NOTFOUND
TBB_INCLUDE_DIR:PATH=/usr/include
TBB_LIBRARY_DEBUG:FILEPATH=<some-path>/ospray-2.10.0.x86_64.linux/lib/libtbb.so
TBB_LIBRARY_RELEASE:FILEPATH=<some-path>/ospray-2.10.0.x86_64.linux/lib/libtbb.so
TBB_MALLOC_INCLUDE_DIR:PATH=/usr/include
TBB_MALLOC_LIBRARY_DEBUG:FILEPATH=<some-path>/ospray-2.10.0.x86_64.linux/lib/libtbbmalloc.so
TBB_MALLOC_LIBRARY_RELEASE:FILEPATH=<some-path>/ospray-2.10.0.x86_64.linux/lib/libtbbmalloc.so
TBB_MALLOC_PROXY_INCLUDE_DIR:PATH=/usr/include
TBB_MALLOC_PROXY_LIBRARY_DEBUG:FILEPATH=/usr/lib/x86_64-linux-gnu/libtbbmalloc_proxy.so
TBB_MALLOC_PROXY_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libtbbmalloc_proxy.so
VTK_SMP_IMPLEMENTATION_TYPE:STRING=TBB

As you can see, it is a mix of the TBB libraries supplied by the OSPRay package and the TBB libraries present on the system. I suspect this is caused by the -DCMAKE_PREFIX_PATH="$OSPRAY_DIR" option. I use that option to make sure CMake can find the required OSPRay libraries, but it thus also brings additional TBB libraries into scope.

My current fix is to exchange the aforementioned option by -Dospray_DIR=<path>, where <path> is the path to the osprayConfig.cmake file (located in the OSPRay package). Using this option, the TBB related cache variables match the ones I had in the VTK build. With the proper paths in these cache variables, I no longer get the linker errors.

Unfortunately, I didn’t find out why TBB_DIR seems to be missing.

TBB_DIR is just a shortcut for setting the other TBB related variables - it is safe to ignore this warning when the other variables are set correctly.

2 Likes

CMake grabbing ospray TBB is unfortunate, but it feels like more of a cmake issue than ParaView.

I’m glad you figured it out though :slight_smile:

1 Like

@mwestphal It indeed was a CMake issue rather than a ParaView issue. Unfortunately, I only found out after your suggestion to build VTK with TBB :sweat_smile: