[vtkusers] How to fix Mac OS X problem of applications not being able to dine dyld libraries

Andrew Wiles adwiles at alumni.uwaterloo.ca
Thu Sep 3 15:31:44 EDT 2009


Hello Elvis,

I have been following through your technote below and another one  
October 21, 2008 to get Qt and VTK working in XCode.  Thanks for all  
your work on this.

I have basically got to the same point you did below with the  
libvtkQtChart library.  Did you ever find a solution?  I can't seem to  
find any reference to a solution in Google.  I can launch my program  
from the command line, but I can't use a debugger in XCode or QtCreator.

Cheers.
Andrew
___________________________________
Andrew D. Wiles, PhD, PEng
Dept. of Medical Biophysics, The University of Western Ontario
Imaging Research Laboratories, Robarts Research Institute
Lab email: awiles at imaging.robarts.ca
Personal email:  adwiles at alumni.uwaterloo.ca
Laboratory web: www.imaging.robarts.ca
Laboratory phone: (519) 663-5777 x24136
Personal web: www.imaging.robarts.ca/~awiles









On 16-Oct-08, at 7:59 AM, Elvis Dowson wrote:

> Hi,
>           When I compile VTK shared libraries and use them with  
> Xcode, I can launch them fine from the command terminal. However,  
> when I try to launch it from Xcode, it exits with reason 5. If I try  
> to launch the same application package using Finder, it generates  
> and error message saying for example:
>
> Dyld Error Message:
>   Library not loaded: libQVTK.5.3.dylib
>   Referenced from: /Users/elvis/Project/C4I/Source/cxx/ 
> QVTKQtWidgetInOpenGLSceneTest/build/Debug/ 
> QVTKQtWidgetInOpenGLSceneTest.app/Contents/MacOS/ 
> QVTKQtWidgetInOpenGLSceneTest
>   Reason: image not found
>
> This is a known problem and the solution is to run install_tool_name  
> to fix the patch to the dynamic link libraries.
>
> However, now there is another problem. I've fixed all the paths to  
> the dynamic link libraries, but those libraries themselves refer to  
> other link libraries, so I'm a bit lost what to do.
>
> Dyld Error Message:
>   Library not loaded: libvtkQtChart.5.3.dylib
>   Referenced from: /Users/elvis/Project/C4I/Source/cxx/ 
> QVTKQtWidgetInOpenGLSceneTest/build/Debug/ 
> QVTKQtWidgetInOpenGLSceneTest.app/Contents/MacOS/../Frameworks/ 
> libQVTK.5.3.dylib
>   Reason: image not found
>
>  It's really messy having to deal with this. This situation is also  
> preventing me from using Xcode to debug my Qt/VTK program, since it  
> keeps crashing because it can't find the dynamic link libraries,  
> when I try to launch it from Xcode.
>
> Here is a small work in progress for an Xcode build script to fix  
> the correct path to the dynamic link libraries from the application  
> executable point of view. What I need now is a solution to also  
> update the references to the numerous dynamic link libraries that  
> the vtk dynamic link libraries themselves refer to !! (groan!!) :-)
>
> Best regards,
>
> Elvis Dowson
>
>
> Technote Xcode-3.1.1-001: How to fix dyld library not loaded error  
> message
>
> Procedure
>
> Step 01: Check the existing paths for the dynamic link libraries  
> using the otool
>
> otool -L QVTKQtWidgetInOpenGLSceneTest.app/Contents/MacOS/ 
> QVTKQtWidgetInOpenGLSceneTest
>
> QVTKQtWidgetInOpenGLSceneTest.app/Contents/MacOS/ 
> QVTKQtWidgetInOpenGLSceneTest:
> 	/usr/local/lib/libpng12.0.dylib (compatibility version 32.0.0,  
> current version 32.0.0)
> 	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version  
> 1.2.3)
> 	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current  
> version 111.1.1)
> 	libQVTK.5.3.dylib (compatibility version 0.0.0, current version  
> 0.0.0)
> 	libvtkHybrid.5.3.dylib (compatibility version 0.0.0, current  
> version 0.0.0)
> 	libvtkIO.5.3.dylib (compatibility version 0.0.0, current version  
> 0.0.0)
> 	libvtkImaging.5.3.dylib (compatibility version 0.0.0, current  
> version 0.0.0)
> 	libvtkRendering.5.3.dylib (compatibility version 0.0.0, current  
> version 0.0.0)
> 	libvtkWidgets.5.3.dylib (compatibility version 0.0.0, current  
> version 0.0.0)
> 	libvtkGraphics.5.3.dylib (compatibility version 0.0.0, current  
> version 0.0.0)
> 	libvtkFiltering.5.3.dylib (compatibility version 0.0.0, current  
> version 0.0.0)
> 	libvtkGenericFiltering.5.3.dylib (compatibility version 0.0.0,  
> current version 0.0.0)
> 	libvtkCommon.5.3.dylib (compatibility version 0.0.0, current  
> version 0.0.0)
> 	libvtkexoIIc.5.3.dylib (compatibility version 0.0.0, current  
> version 0.0.0)
> 	libvtkexpat.5.3.dylib (compatibility version 0.0.0, current version  
> 0.0.0)
> 	libvtkftgl.5.3.dylib (compatibility version 0.0.0, current version  
> 0.0.0)
> 	libvtkjpeg.5.3.dylib (compatibility version 0.0.0, current version  
> 0.0.0)
> 	libvtkpng.5.3.dylib (compatibility version 0.0.0, current version  
> 0.0.0)
> 	libvtktiff.5.3.dylib (compatibility version 0.0.0, current version  
> 0.0.0)
> 	libvtksys.5.3.dylib (compatibility version 0.0.0, current version  
> 0.0.0)
> 	libvtkzlib.5.3.dylib (compatibility version 0.0.0, current version  
> 0.0.0)
> 	libvtkfreetype.5.3.dylib (compatibility version 0.0.0, current  
> version 0.0.0)
> 	/Developer/Applications/Qt-4.4.3/lib/QtOpenGL.framework/Versions/4/ 
> QtOpenGL (compatibility version 4.4.0, current version 4.4.3)
> 	/Developer/Applications/Qt-4.4.3/lib/QtGui.framework/Versions/4/ 
> QtGui (compatibility version 4.4.0, current version 4.4.3)
> 	/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon  
> (compatibility version 2.0.0, current version 136.0.0)
> 	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit  
> (compatibility version 45.0.0, current version 949.35.0)
> 	/Developer/Applications/Qt-4.4.3/lib/QtCore.framework/Versions/4/ 
> QtCore (compatibility version 4.4.0, current version 4.4.3)
> 	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL  
> (compatibility version 1.0.0, current version 1.0.0)
> 	/System/Library/Frameworks/AGL.framework/Versions/A/AGL  
> (compatibility version 1.0.0, current version 1.0.0)
> 	/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current  
> version 7.4.0)
> 	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current  
> version 1.0.0)
>
>
> Step 02: Create a Run Build script
>
> In Xcode, right click on the target and select Add->New Build Phase- 
> >New Run Script Build Phase, and enter the follow script
>
> # Declare script variables
> export VTK_LIB_DIR=/Users/elvis/Tool/vtk-5.x/install/carbon-shared/ 
> lib/vtk-5.3
> export NEWLIBPATH="@loader_path/../Frameworks"
>
> # Declare list of library targets
> export TARGETS="libQVTK.5.3.dylib libvtkHybrid.5.3.dylib libvtkIO. 
> 5.3.dylib libvtkImaging.5.3.dylib libvtkRendering.5.3.dylib  
> libvtkWidgets.5.3.dylib libvtkGraphics.5.3.dylib libvtkFiltering. 
> 5.3.dylib libvtkGenericFiltering.5.3.dylib libvtkCommon.5.3.dylib  
> libvtkexoIIc.5.3.dylib libvtkexpat.5.3.dylib libvtkftgl.5.3.dylib  
> libvtkjpeg.5.3.dylib libvtkpng.5.3.dylib libvtktiff.5.3.dylib  
> libvtksys.5.3.dylib libvtkzlib.5.3.dylib libvtkfreetype.5.3.dylib"
>
> # Create folders in the application package
> mkdir "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks"
>
> # Change the reference to the dynamic link libraries in a loop for  
> all listed library targets
> for TARGET in ${TARGETS} ; do
> cp -f $VTK_LIB_DIR/${TARGET} "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/ 
> Contents/Frameworks/${TARGET}"
> install_name_tool -change ${TARGET} @loader_path/../Frameworks/$ 
> {TARGET} "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/ 
> $PRODUCT_NAME"
> done
>
> Step 03: Check the updates paths for the dynamic link libraries  
> using the otool
>
> otool -L QVTKQtWidgetInOpenGLSceneTest.app/Contents/MacOS/ 
> QVTKQtWidgetInOpenGLSceneTest
>
> QVTKQtWidgetInOpenGLSceneTest.app/Contents/MacOS/ 
> QVTKQtWidgetInOpenGLSceneTest:
> 	/usr/local/lib/libpng12.0.dylib (compatibility version 32.0.0,  
> current version 32.0.0)
> 	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version  
> 1.2.3)
> 	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current  
> version 111.0.0)
> 	@loader_path/../Frameworks/libQVTK.5.3.dylib (compatibility version  
> 0.0.0, current version 0.0.0)
> 	@loader_path/../Frameworks/libvtkHybrid.5.3.dylib (compatibility  
> version 0.0.0, current version 0.0.0)
> 	@loader_path/../Frameworks/libvtkIO.5.3.dylib (compatibility  
> version 0.0.0, current version 0.0.0)
> 	@loader_path/../Frameworks/libvtkImaging.5.3.dylib (compatibility  
> version 0.0.0, current version 0.0.0)
> 	@loader_path/../Frameworks/libvtkRendering.5.3.dylib (compatibility  
> version 0.0.0, current version 0.0.0)
> 	@loader_path/../Frameworks/libvtkWidgets.5.3.dylib (compatibility  
> version 0.0.0, current version 0.0.0)
> 	@loader_path/../Frameworks/libvtkGraphics.5.3.dylib (compatibility  
> version 0.0.0, current version 0.0.0)
> 	@loader_path/../Frameworks/libvtkFiltering.5.3.dylib (compatibility  
> version 0.0.0, current version 0.0.0)
> 	@loader_path/../Frameworks/libvtkGenericFiltering.5.3.dylib  
> (compatibility version 0.0.0, current version 0.0.0)
> 	@loader_path/../Frameworks/libvtkCommon.5.3.dylib (compatibility  
> version 0.0.0, current version 0.0.0)
> 	@loader_path/../Frameworks/libvtkexoIIc.5.3.dylib (compatibility  
> version 0.0.0, current version 0.0.0)
> 	@loader_path/../Frameworks/libvtkexpat.5.3.dylib (compatibility  
> version 0.0.0, current version 0.0.0)
> 	@loader_path/../Frameworks/libvtkftgl.5.3.dylib (compatibility  
> version 0.0.0, current version 0.0.0)
> 	@loader_path/../Frameworks/libvtkjpeg.5.3.dylib (compatibility  
> version 0.0.0, current version 0.0.0)
> 	@loader_path/../Frameworks/libvtkpng.5.3.dylib (compatibility  
> version 0.0.0, current version 0.0.0)
> 	@loader_path/../Frameworks/libvtktiff.5.3.dylib (compatibility  
> version 0.0.0, current version 0.0.0)
> 	@loader_path/../Frameworks/libvtksys.5.3.dylib (compatibility  
> version 0.0.0, current version 0.0.0)
> 	@loader_path/../Frameworks/libvtkzlib.5.3.dylib (compatibility  
> version 0.0.0, current version 0.0.0)
> 	@loader_path/../Frameworks/libvtkfreetype.5.3.dylib (compatibility  
> version 0.0.0, current version 0.0.0)
> 	/Developer/Applications/Qt-4.4.3/lib/QtOpenGL.framework/Versions/4/ 
> QtOpenGL (compatibility version 4.4.0, current version 4.4.3)
> 	/Developer/Applications/Qt-4.4.3/lib/QtGui.framework/Versions/4/ 
> QtGui (compatibility version 4.4.0, current version 4.4.3)
> 	/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon  
> (compatibility version 2.0.0, current version 136.0.0)
> 	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit  
> (compatibility version 45.0.0, current version 949.0.0)
> 	/Developer/Applications/Qt-4.4.3/lib/QtCore.framework/Versions/4/ 
> QtCore (compatibility version 4.4.0, current version 4.4.3)
> 	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL  
> (compatibility version 1.0.0, current version 1.0.0)
> 	/System/Library/Frameworks/AGL.framework/Versions/A/AGL  
> (compatibility version 1.0.0, current version 1.0.0)
> 	/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current  
> version 7.4.0)
> 	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current  
> version 1.0.0)
>
>
> Related Links
>
> 01. How To use Dynamic Libraries in Xcode 3.1 (using FMOD) -  
> BrockWoolf.com
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090903/a263ee41/attachment.htm>


More information about the vtkusers mailing list