Mpmtest error loading shared VTK libraries

I have successfully compiled as outlined on https://github.com/cb-geo/mpm getting Built target mpm & Built target mpmtest outputs in my terminal.

When running ./mpmtest in ~/Documents/cb-geo/mpm/build I get the following error:

./mpmtest: error while loading shared libraries: libvtkIOXMLParser-9.0.so.1: cannot open shared object file: No such file or directory

This library is located at: ~/VTK/build/lib.

Where does my VTK directory need to be located such that./mpmtest can find it?

Hi @jgiven100

Could you please let me know which OS you tried to build mpm code.

If you installed in Ubuntu, did you try to install VTK manually?

git clone https://gitlab.kitware.com/vtk/vtk.git VTK
cd VTK && mkdir build && cd build/
cmake -DCMAKE_BUILD_TYPE:STRING=Release ..
make -j
sudo make install

How was VTK linked when building?

OS: Ubuntu 18.04

I followed the manual VTK build on https://github.com/cb-geo/mpm (i.e. same as what your reply describes).

I did not specifically link the VTK beyond what is outlined in the lines you include above - I thought sudo make install would appropriately build?

I’m unable to reproduce the error on a fresh Docker install of Ubuntu

In CMakeLists.txt https://github.com/cb-geo/mpm/blob/develop/CMakeLists.txt#L127

please add message("Found VTK")

# VTK
find_package(VTK)
if (VTK_FOUND)
  add_definitions("-DUSE_VTK")
  message("Found VTK")
  include_directories(${VTK_INCLUDE_DIRS})
  link_libraries(${VTK_LIBRARIES})
endif()

Remove everything in build directory and could you please share the text output when you run the cmake command?

joel@joel-002:~/Documents/cb-geo/mpm$ mkdir build && cd build && cmake -DCMAKE_CXX_COMPILER=g++ cmake -DNO_KAHIP=True …
– The CXX compiler identification is GNU 7.5.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
– Found Boost: /usr/include (found version β€œ1.65.1”) found components: 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”)
– The C compiler identification is GNU 7.5.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
– Performing Test CMAKE_HAVE_LIBC_PTHREAD
– Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
– Found Threads: TRUE
– Could NOT find MKL (missing: MKL_INCLUDE_DIR MKL_LIBRARIES)
– Checking for package β€˜KaHIP’
– KaHIP could not be found/configured. (missing: KAHIP_LIBRARIES KAHIP_INCLUDE_DIRS KAHIP_TEST_RUNS)
– Found X11: /usr/include
– Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
– Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
– Looking for gethostbyname
– Looking for gethostbyname - found
– Looking for connect
– Looking for connect - found
– Looking for remove
– Looking for remove - found
– Looking for shmat
– Looking for shmat - found
– Looking for IceConnectionNumber in ICE
– Looking for IceConnectionNumber in ICE - found
– Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so found components: OpenGL GLX
Found VTK
– Checking for package β€˜Partio’
– Partio could not be found/configured. (missing: PARTIO_LIBRARIES PARTIO_INCLUDE_DIRS)
– Configuring done
– Generating done
– Build files have been written to: /home/joel/Documents/cb-geo/mpm/build

Thanks, looks like CMake is able to find vtk. Could you please post the output of ldd ./mpmtest

~/Documents/cb-geo/mpm/build$ ldd ./mpmtest
	linux-vdso.so.1 (0x00007ffe0dbca000)
	libboost_filesystem.so.1.65.1 => /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.65.1 (0x00007fd6f5808000)
	libboost_system.so.1.65.1 => /usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1 (0x00007fd6f5603000)
	libmpi_cxx.so.20 => /usr/lib/x86_64-linux-gnu/libmpi_cxx.so.20 (0x00007fd6f53e9000)
	libmpi.so.20 => /usr/lib/x86_64-linux-gnu/libmpi.so.20 (0x00007fd6f50f7000)
	libhdf5_serial.so.100 => /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.100 (0x00007fd6f4b9f000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd6f4980000)
	libhdf5_serial_hl.so.100 => /usr/lib/x86_64-linux-gnu/libhdf5_serial_hl.so.100 (0x00007fd6f475d000)
	libtbb.so.2 => /usr/lib/x86_64-linux-gnu/libtbb.so.2 (0x00007fd6f4521000)
	libvtkIOXML-9.0.so.1 => /usr/local/lib/libvtkIOXML-9.0.so.1 (0x00007fd6f4220000)
	libvtkIOCore-9.0.so.1 => /usr/local/lib/libvtkIOCore-9.0.so.1 (0x00007fd6f3fb6000)
	libvtkCommonDataModel-9.0.so.1 => /usr/local/lib/libvtkCommonDataModel-9.0.so.1 (0x00007fd6f3987000)
	libvtkCommonCore-9.0.so.1 => /usr/local/lib/libvtkCommonCore-9.0.so.1 (0x00007fd6f332a000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fd6f2fa1000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd6f2c03000)
	libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007fd6f29d4000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fd6f27bc000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd6f23cb000)
	libopen-rte.so.20 => /usr/lib/x86_64-linux-gnu/libopen-rte.so.20 (0x00007fd6f2143000)
	libopen-pal.so.20 => /usr/lib/x86_64-linux-gnu/libopen-pal.so.20 (0x00007fd6f1e91000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fd6f1c89000)
	libhwloc.so.5 => /usr/lib/x86_64-linux-gnu/libhwloc.so.5 (0x00007fd6f1a4c000)
	libsz.so.2 => /usr/lib/x86_64-linux-gnu/libsz.so.2 (0x00007fd6f1849000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fd6f162c000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd6f1428000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fd6f6215000)
	libvtkIOXMLParser-9.0.so.1 => /usr/local/lib/libvtkIOXMLParser-9.0.so.1 (0x00007fd6f1212000)
	libvtkCommonExecutionModel-9.0.so.1 => /usr/local/lib/libvtkCommonExecutionModel-9.0.so.1 (0x00007fd6f0f57000)
	libvtkCommonSystem-9.0.so.1 => /usr/local/lib/libvtkCommonSystem-9.0.so.1 (0x00007fd6f0d42000)
	libvtkCommonMisc-9.0.so.1 => /usr/local/lib/libvtkCommonMisc-9.0.so.1 (0x00007fd6f0b26000)
	libvtksys-9.0.so.1 => /usr/local/lib/libvtksys-9.0.so.1 (0x00007fd6f08d5000)
	libvtkdoubleconversion-9.0.so.1 => /usr/local/lib/libvtkdoubleconversion-9.0.so.1 (0x00007fd6f06c2000)
	libvtklz4-9.0.so.1 => /usr/local/lib/libvtklz4-9.0.so.1 (0x00007fd6f048f000)
	libvtklzma-9.0.so.1 => /usr/local/lib/libvtklzma-9.0.so.1 (0x00007fd6f025d000)
	libvtkzlib-9.0.so.1 => /usr/local/lib/libvtkzlib-9.0.so.1 (0x00007fd6f003f000)
	libvtkCommonTransforms-9.0.so.1 => /usr/local/lib/libvtkCommonTransforms-9.0.so.1 (0x00007fd6efe0e000)
	libvtkCommonMath-9.0.so.1 => /usr/local/lib/libvtkCommonMath-9.0.so.1 (0x00007fd6efbee000)
	libvtkloguru-9.0.so.1 => /usr/local/lib/libvtkloguru-9.0.so.1 (0x00007fd6ef9ba000)
	libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007fd6ef7b7000)
	libnuma.so.1 => /usr/lib/x86_64-linux-gnu/libnuma.so.1 (0x00007fd6ef5ac000)
	libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007fd6ef3a2000)
	libaec.so.0 => /usr/lib/x86_64-linux-gnu/libaec.so.0 (0x00007fd6ef19a000)
	libvtkexpat-9.0.so.1 => /usr/local/lib/libvtkexpat-9.0.so.1 (0x00007fd6eef62000)

Treid ./mpmtest again and output reads All tests passed

I must have incorrectly compiled before. Compiling again was successful. Thank you for the help!

1 Like

@kks32
Recently switched to running ubuntu 20.04 and ran into a similar problem. This time it was solved with:

sudo ldconfig
reboot
rmdir build
mkdir build && cd build && cmake -DCMAKE_CXX_COMPILER=g++ -DNO_KAHIP=True .. 

(thanks @bodhinandach )

1 Like