1

I try to learn VTK and when I execute the tutorials code it give me this error:

dyld: Library not loaded: libvtkDomainsChemistryOpenGL2-7.1.1.dylib

Where is this library?

I use macOS Sierra and I install the vtk by this: enter link description here

Can you help me?

Community
  • 1
  • 1
  • Your problem likely resembles the one I just described [here](https://stackoverflow.com/questions/47697761/) – normanius Dec 07 '17 at 15:27

1 Answers1

0

The proper choice of cmake flags certainly will help solving your problem. Reading question and answer of this SO post may be helpful.

I am not fully convinced if you followed the referenced instructions exactly, because in the excerpt of the CMakeCache (see here, point 5), BUILD_SHARED_LIBS was disabled. However, your problem indicates that your binary was linked dynamically. Here I'm missing further details about your setup.

Let me maybe share the cmake command that I used to build vtk (with python wrapper and shared libraries). This worked for vtk 7.x.

mkdir build
cd build
INSTALL_DIR="/opt/dev/versions/vtk/vtk-7.1.0-shared"
cmake .. -DCMAKE_BUILD_TYPE=Release \
         -DVTK_WRAP_PYTHON=ON \
         -DBUILD_EXAMPLES=OFF \
         -DBUILD_SHARED_LIBS=ON \
         -DBUILD_TESTING=OFF \
         -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
         -DCMAKE_MACOSX_RPATH=ON \
         -DCMAKE_INSTALL_RPATH="$INSTALL_DIR/lib" \
         -DPYTHON_INCLUDE_DIR="/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/" \
         -DPYTHON_LIBRARY="/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib"
make -j8
make install

Note that I had to set the python related flags to ensure that the correct python environment is used. (Often, there are multiple python environments available on a Mac: The python distributed by MacOS itself, a user python that was installed via homebrew or macports, or the framework that was acquired via www.python.org. For me the third option applied.)

normanius
  • 8,629
  • 7
  • 53
  • 83