CMake error due to broken VTK in ubuntu 18.04

Hi,

I am trying to compile cb-geoMPM, however, I run into the same error.
Below is the log. Can anyone help me out?

XXX@XXX-pc:~/cbGeo_mpm$ mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++ /home/ehsan/cbGeo_mpm/
– The CXX compiler identification is GNU 7.4.0
– Check for working CXX compiler: /usr/bin/g++
– Check for working CXX compiler: /usr/bin/g++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– Boost version: 1.65.1
– Found the following Boost libraries:
– filesystem
– system
– Found Eigen3: /usr/include/eigen3 (Required is at least version “2.91.0”)
– Found MPI_CXX: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_cxx.so (found version “3.1”)
– Found MPI: TRUE (found version “3.1”)
CMake Error at cmake/FindMPI.cmake:1683 (list):
list does not recognize sub-command JOIN
Call Stack (most recent call first):
CMakeLists.txt:49 (find_package)
– The C compiler identification is GNU 7.4.0
– Check for working C compiler: /usr/bin/cc
– Check for working C compiler: /usr/bin/cc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– HDF5: Using hdf5 compiler wrapper to determine CXX configuration
– Found HDF5: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_cpp.so;/usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so;/usr/lib/x86_64-linux-gnu/libpthread.so;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so (found version “1.10.0.1”) found components: CXX HL
– Found OpenMP_C: -fopenmp (found version “4.5”)
– Found OpenMP_CXX: -fopenmp (found version “4.5”)
– Found OpenMP: TRUE (found version “4.5”)
– Found TBB: /usr/include (found version “2017.0”)
– Looking for pthread.h
– Looking for pthread.h - found
– Looking for pthread_create
– Looking for pthread_create - found
– Found Threads: TRUE
– The imported target “vtkRenderingPythonTkWidgets” references the file
“/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so”
but this file does not exist. Possible reasons include:

  • The file was deleted, renamed, or moved to another location.
  • An install or uninstall procedure did not complete successfully.
  • The installation package was faulty and contained
    “/usr/lib/cmake/vtk-7.1/VTKTargets.cmake”
    but not all the files it references.
    – The imported target “vtk” references the file
    “/usr/bin/vtk”
    but this file does not exist. Possible reasons include:
  • The file was deleted, renamed, or moved to another location.
  • An install or uninstall procedure did not complete successfully.
  • The installation package was faulty and contained
    “/usr/lib/cmake/vtk-7.1/VTKTargets.cmake”
    but not all the files it references.
    – Configuring incomplete, errors occurred!
    See also “/home/ehsan/cbGeo_mpm/build/CMakeFiles/CMakeOutput.log”.

Hi @Ehsanizadi, looks like the vtk library shipped with Ubuntu seems to be broken. To work around this, and not use vtk for visualization, comment out the following lines in CMakeLists.txt: https://github.com/cb-geo/mpm/blob/develop/CMakeLists.txt#L85-L91

#find_package(VTK)
#if (VTK_FOUND)
# include(${VTK_USE_FILE})
#  link_libraries(${VTK_LIBRARIES})
#  add_definitions("-DUSE_VTK")
#  set(mpm_vtk ${mpm_SOURCE_DIR}/src/vtk_writer.cc)
#endif()

This should allow you to go through with the compilation.

Alternatively remove the libvtk7-dev version that’s installed at the system level in Ubuntu. And use a manual install of vtk.

# CMake 3.15
sudo apt-get install software-properties-common
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
sudo apt update
sudo apt upgrade
# OpenGL and X11:Xt
sudo apt-get install freeglut3-dev libxt-dev
# VTK
git clone git://vtk.org/VTK.git VTK
cd VTK && mkdir build && cd build/
cmake -DCMAKE_BUILD_TYPE:STRING=Release ..
make -j
sudo make install

This should let you run the mpm code with VTK on Ubuntu 18.04.