Mpmtest error loading shared VTK libraries

I have successfully compiled as outlined on 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: 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 VTK
cd VTK && mkdir build && cd build/
make -j
sudo make install

How was VTK linked when building?

OS: Ubuntu 18.04

I followed the manual VTK build on (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

please add message("Found VTK")

  message("Found VTK")

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/ (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/;/usr/lib/x86_64-linux-gnu/hdf5/serial/;/usr/lib/x86_64-linux-gnu/;/usr/lib/x86_64-linux-gnu/;/usr/lib/x86_64-linux-gnu/;/usr/lib/x86_64-linux-gnu/;/usr/lib/x86_64-linux-gnu/ (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 - Success
– Found Threads: TRUE
– 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/;/usr/lib/x86_64-linux-gnu/
– Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/;/usr/lib/x86_64-linux-gnu/ - 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/ 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 (0x00007ffe0dbca000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd6f5808000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd6f5603000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd6f53e9000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd6f50f7000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd6f4b9f000) => /lib/x86_64-linux-gnu/ (0x00007fd6f4980000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd6f475d000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd6f4521000) => /usr/local/lib/ (0x00007fd6f4220000) => /usr/local/lib/ (0x00007fd6f3fb6000) => /usr/local/lib/ (0x00007fd6f3987000) => /usr/local/lib/ (0x00007fd6f332a000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd6f2fa1000) => /lib/x86_64-linux-gnu/ (0x00007fd6f2c03000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd6f29d4000) => /lib/x86_64-linux-gnu/ (0x00007fd6f27bc000) => /lib/x86_64-linux-gnu/ (0x00007fd6f23cb000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd6f2143000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd6f1e91000) => /lib/x86_64-linux-gnu/ (0x00007fd6f1c89000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd6f1a4c000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd6f1849000) => /lib/x86_64-linux-gnu/ (0x00007fd6f162c000) => /lib/x86_64-linux-gnu/ (0x00007fd6f1428000)
	/lib64/ (0x00007fd6f6215000) => /usr/local/lib/ (0x00007fd6f1212000) => /usr/local/lib/ (0x00007fd6f0f57000) => /usr/local/lib/ (0x00007fd6f0d42000) => /usr/local/lib/ (0x00007fd6f0b26000) => /usr/local/lib/ (0x00007fd6f08d5000) => /usr/local/lib/ (0x00007fd6f06c2000) => /usr/local/lib/ (0x00007fd6f048f000) => /usr/local/lib/ (0x00007fd6f025d000) => /usr/local/lib/ (0x00007fd6f003f000) => /usr/local/lib/ (0x00007fd6efe0e000) => /usr/local/lib/ (0x00007fd6efbee000) => /usr/local/lib/ (0x00007fd6ef9ba000) => /lib/x86_64-linux-gnu/ (0x00007fd6ef7b7000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd6ef5ac000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd6ef3a2000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd6ef19a000) => /usr/local/lib/ (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

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

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

(thanks @bodhinandach )

1 Like