Well, I found out the reason for the error, but I'm not sure what's the best way to solve it.<div><br></div><div>The problem resides in the install name of all VTK shared libraries. For example, libVtkCommon.5.8.dylib has an install name of 'libVtkCommon.5.8.dylib' instead of '/usr/local/lib/vtk-5.8/libVtkCommon.5.8.dylib'.</div>
<div><br></div><div>Is there any setting in CMake that I can change to fix the problem?</div><div><br></div><div>Yifei<br><br><div class="gmail_quote">On Fri, Sep 16, 2011 at 2:43 PM, Yifei Li <span dir="ltr"><<a href="mailto:yifli82@gmail.com">yifli82@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi all,<div><br></div><div>I got the following runtime error (no building errors):</div><p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Menlo">
<b>dyld: Library not loaded: libvtkCommon.5.8.dylib</b></p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Menlo"><b> Referenced from: /Users/yifli/Documents/Projects/InteractiveSegmentation/build/Debug/InteractiveSegmentation</b></p>
<div><span style="font-family:Menlo;font-size:11px"><b> Reason: image not found</b></span></div><div><br></div><div>However, I checked that libvtkCommon.5.8.dylib does exist:</div><div>-rwxr-xr-x 1 root wheel 3327352 Sep 14 21:56 libvtkCommon.5.8.0.dylib</div>
<div>lrwxr-xr-x 1 root wheel 24 Sep 14 21:27 libvtkCommon.5.8.dylib -> libvtkCommon.5.8.0.dylib</div><div>lrwxr-xr-x 1 root wheel 22 Sep 14 21:27 libvtkCommon.dylib -> libvtkCommon.5.8.dylib</div>
<div>
<br></div><div>The application I'm trying to run is a QMainWindow that has a QVTKWidget in it. The CMakeLists.txt I use is:</div><div><br></div><div>cmake_minimum_required(VERSION 2.8)</div><div><br></div><div>project(Simple)</div>
<div><br></div><div>find_package(VTK)</div><div>include(${VTK_USE_FILE})</div><div><br></div><div>find_package(Qt4)</div><div>include(${QT_USE_FILE})</div><div><br></div><div>include_directories(${CMAKE_CURRENT_BINARY_DIR})</div>
<div><br></div><div>set(headers MainWindow.h)</div><div>set(srcs main.cpp MainWindow.cpp)</div><div>set(uis mainwindow.ui)</div><div><br></div><div>qt4_wrap_ui(ui_srcs ${uis})</div><div>qt4_wrap_cpp(moc_headers ${headers})</div>
<div><br></div><div>add_executable(Simple ${srcs} ${ui_srcs} ${moc_headers} ${headers})</div><div>target_link_libraries(Simple</div><div> ${QT_LIBRARIES}</div><div> ${VTK_LIBRARIES}</div><div>
QVTK</div><div>)</div><div> </div><font color="#888888"><div>Yifei</div>
</font></blockquote></div><br></div>