<div dir="ltr">VTK_USE_RPATH should be sufficient...<br><br><div><br><div class="gmail_quote">On Fri, Sep 5, 2008 at 5:51 PM, Darren Weber <span dir="ltr"><<a href="mailto:darren.weber.lists@gmail.com">darren.weber.lists@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="Ih2E3d">On Wed, Sep 3, 2008 at 3:28 PM, Mike Jackson<br>
<<a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a>> wrote:<br>
> Cross posting to vtkusers list as that may be more appropriate:<br>
><br>
><br>
> Can you rebuild VTK with these two settings:<br>
><br>
> CMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \<br>
<br>
</div>Where is this? I don't see it in ccmake. How do you set it?<br>
<br>
> VTK_USE_RPATH=ON<br>
<br>
This I can see in ccmake<br>
<div><div></div><div class="Wj3C7c"><br>
><br>
> Run ccmake on your vtk build directory and set those two cmake variables.<br>
> Configure and build. After the build completes, then run "make install".<br>
><br>
> The default installation location is in /usr/local. I would change it to<br>
> /usr/local/vtk-5.2.<br>
><br>
> Next, Get rid of extra Python builds on your system. The only python build<br>
> should be in /System/Library/Frameworks.<br>
><br>
> Now try to build your project. If everything goes correctly you should NOT<br>
> need to mess with DYLD_LIBRARY_PATH. The reason why you are having to set<br>
> that variable is because, as you found out, the vtk libraries do NOT have an<br>
> "install_path" (same as rpath on linux) set in them. Without that set to<br>
> anything besides the library name the linker will not be able to encode the<br>
> correct path in anything else that depends on the vtk libraries. Which is<br>
> some of your problems.<br>
><br>
> Let us know if you can get this far.<br>
><br>
> Mike<br>
> On Sep 3, 2008, at 2:19 PM, Darren Weber wrote:<br>
><br>
>> I think we may be on the "right" track with addition(s) to the DYLD path,<br>
>> ie:<br>
>><br>
>> [ dweber@elegans ~/src/kitware/VTK_build ]$ echo $DYLD_LIBRARY_PATH<br>
>><br>
>> [ dweber@elegans ~/src/kitware/VTK_build ]$ export<br>
>> DYLD_LIBRARY_PATH=/usr/local/lib/vtk-5.2<br>
>> [ dweber@elegans ~/src/kitware/VTK_build ]$ echo $DYLD_LIBRARY_PATH<br>
>> /usr/local/lib/vtk-5.2<br>
>> [ dweber@elegans ~/src/kitware/VTK_build ]$ python<br>
>> Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53)<br>
>> [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin<br>
>> Type "help", "copyright", "credits" or "license" for more information.<br>
>>>>><br>
>>>>> import vtk<br>
>><br>
>> Traceback (most recent call last):<br>
>> File "<stdin>", line 1, in <module><br>
>> File "/usr/local/lib/python2.5/site-packages/vtk/__init__.py", line<br>
>> 43, in <module><br>
>> from io import *<br>
>> File "/usr/local/lib/python2.5/site-packages/vtk/io.py", line 7, in<br>
>> <module><br>
>> from libvtkIOPython import *<br>
>> ImportError:<br>
>> dlopen(/usr/local/lib/python2.5/site-packages/vtk/libvtkIOPython.so,<br>
>> 10): Library not loaded: libpq.5.dylib<br>
>> Referenced from:<br>
>> /usr/local/lib/python2.5/site-packages/vtk/libvtkIOPython.so<br>
>> Reason: image not found<br>
>>>>><br>
>><br>
>> This is another failure, but this time it is related to the PostgreSQL<br>
>> library that resides in another location (under /Library path). So, I<br>
>> conclude from this test that dlopen is now finding the vtk dylib<br>
>> files.<br>
>><br>
>> Now, we can get the following "diagnostics" on the .so from the prior<br>
>> import problem:<br>
>><br>
>> [ dweber@elegans ~/src/kitware/VTK_build ]$ otool -L<br>
>> /usr/local/lib/python2.5/site-packages/vtk/libvtkCommonPython.so<br>
>> /usr/local/lib/python2.5/site-packages/vtk/libvtkCommonPython.so:<br>
>> libvtkCommonPythonD.5.2.dylib (compatibility version 0.0.0, current<br>
>> version 0.0.0)<br>
>> /Library/Frameworks/Python.framework/Versions/2.5/Python<br>
>> (compatibility version 2.5.0, current version 2.5.0)<br>
>> libvtkCommon.5.2.dylib (compatibility version 0.0.0, current<br>
>> version 0.0.0)<br>
>> libvtksys.5.2.dylib (compatibility version 0.0.0, current version<br>
>> 0.0.0)<br>
>> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current<br>
>> version 111.1.1)<br>
>> /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current<br>
>> version 7.4.0)<br>
>> /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current<br>
>> version 1.0.0)<br>
>> [ dweber@elegans ~/src/kitware/VTK_build ]$<br>
>><br>
>><br>
>> Notice how some of the system libaries have full paths (ie,<br>
>> /usr/lib/....), but the vtk dylib files have no paths. Hence, when we<br>
>> specify the DYLD_LIBRARY_PATH, the python import process is now<br>
>> finding these extra libraries because dlopen is now searching at least<br>
>> the /usr/local/lib/vtk... path (recursively? maybe not, because it<br>
>> doesn't work if we use /usr/local/lib without the specific vtk path).<br>
>><br>
>> Similarly, now we can see the full library dependency for the<br>
>> IOPython.so file using:<br>
>><br>
>> [ dweber@elegans ~/src/kitware/VTK_build ]$ otool -L<br>
>> /usr/local/lib/python2.5/site-packages/vtk/libvtkIOPython.so<br>
>> /usr/local/lib/python2.5/site-packages/vtk/libvtkIOPython.so:<br>
>> libvtkIOPythonD.5.2.dylib (compatibility version 0.0.0, current<br>
>> version 0.0.0)<br>
>> libvtkIO.5.2.dylib (compatibility version 0.0.0, current version<br>
>> 0.0.0)<br>
>> /usr/local/lib/libpqxx-2.6.9.dylib (compatibility version 0.0.0,<br>
>> current version 0.0.0)<br>
>> libpq.5.dylib (compatibility version 5.0.0, current version 5.1.0)<br>
>> /usr/local/mysql/lib/libmysqlclient.15.dylib (compatibility version<br>
>> 16.0.0, current version 16.0.0)<br>
>> /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version<br>
>> 1.2.3)<br>
>> libvtkFilteringPythonD.5.2.dylib (compatibility version 0.0.0,<br>
>> current version 0.0.0)<br>
>> libvtkCommonPythonD.5.2.dylib (compatibility version 0.0.0, current<br>
>> version 0.0.0)<br>
>> /Library/Frameworks/Python.framework/Versions/2.5/Python<br>
>> (compatibility version 2.5.0, current version 2.5.0)<br>
>> libvtkFiltering.5.2.dylib (compatibility version 0.0.0, current<br>
>> version 0.0.0)<br>
>> libvtkDICOMParser.5.2.dylib (compatibility version 0.0.0, current<br>
>> version 0.0.0)<br>
>> libvtkNetCDF.5.2.dylib (compatibility version 0.0.0, current<br>
>> version 0.0.0)<br>
>> libvtkmetaio.5.2.dylib (compatibility version 0.0.0, current<br>
>> version 0.0.0)<br>
>> libvtksqlite.5.2.dylib (compatibility version 0.0.0, current<br>
>> version 0.0.0)<br>
>> libvtkpng.5.2.dylib (compatibility version 0.0.0, current version<br>
>> 0.0.0)<br>
>> libvtktiff.5.2.dylib (compatibility version 0.0.0, current version<br>
>> 0.0.0)<br>
>> libvtkzlib.5.2.dylib (compatibility version 0.0.0, current version<br>
>> 0.0.0)<br>
>> libvtkjpeg.5.2.dylib (compatibility version 0.0.0, current version<br>
>> 0.0.0)<br>
>> libvtkexpat.5.2.dylib (compatibility version 0.0.0, current version<br>
>> 0.0.0)<br>
>> libvtkCommon.5.2.dylib (compatibility version 0.0.0, current<br>
>> version 0.0.0)<br>
>> libvtksys.5.2.dylib (compatibility version 0.0.0, current version<br>
>> 0.0.0)<br>
>> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current<br>
>> version 111.1.1)<br>
>> /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current<br>
>> version 7.4.0)<br>
>> /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current<br>
>> version 1.0.0)<br>
>> [ dweber@elegans ~/src/kitware/VTK_build ]$<br>
>><br>
>><br>
>> It's curious that it has a full path to /usr/local/lib/libpqxx (which<br>
>> I had to build and install on this system), but it has no full path to<br>
>> the associated libpq. I don't fully understand this link dependency,<br>
>> as I thought libpqxx would be the primary link target and, in turn, it<br>
>> would link to libpq. (This postgreSQL stuff is another topic on the<br>
>> list somewhere.)<br>
>><br>
>> It's also curious that 'locate' can find the libpq, but dlopen does<br>
>> not. So, something about the locate environment of default settings<br>
>> is different from the dlopen environment, eg:<br>
>><br>
>> {{{<br>
>> [ dweber@elegans ~/src/kitware/VTK_build ]$ locate libpq.5.dylib<br>
>> /Library/PostgreSQL/8.3/lib/libpq.5.dylib<br>
>> /Library/PostgreSQL/8.3/pgAdmin3.app/Contents/Frameworks/libpq.5.dylib<br>
>> [ dweber@elegans ~/src/kitware/VTK_build ]$<br>
>> }}}<br>
>><br>
>> So, now we modify the DYLD path to find libpq and WHA-LA, the import is<br>
>> working!<br>
>><br>
>> {{{<br>
>> [ dweber@elegans ~/src/kitware/VTK_build ]$ export<br>
>> DYLD_LIBRARY_PATH=/usr/local/lib/vtk-5.2:/Library/PostgreSQL/8.3/lib<br>
>> [ dweber@elegans ~/src/kitware/VTK_build ]$ echo $DYLD_LIBRARY_PATH<br>
>> /usr/local/lib/vtk-5.2:/Library/PostgreSQL/8.3/lib<br>
>> [ dweber@elegans ~/src/kitware/VTK_build ]$ python<br>
>> Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53)<br>
>> [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin<br>
>> Type "help", "copyright", "credits" or "license" for more information.<br>
>>>>><br>
>>>>> import vtk<br>
>>>>><br>
>> }}}<br>
>><br>
>><br>
>> I'll have to double check the default settings on DYLD path for the<br>
>> system. This is A fix on this particular system, so the problem<br>
>> remains for any general OSX distribution to fix this in an elegant<br>
>> manner. What would you recommend for a system-wide fix to these path<br>
>> settings and how would you implement this within cmake? (Again, I<br>
>> need to RTFM, it's overdue. I will persist with OSX.)<br>
>><br>
>> Thanks heaps for getting me back on track with OSX! Power to the people<br>
>> ;-)<br>
>><br>
>> Darren<br>
>><br>
>><br>
>> [PS, I suppose I could remove the /Library/Frameworks/Python.framework<br>
>> installs to fall back on the /System/.... python installation, but it<br>
>> probably makes little difference apart from disk space. I know it's<br>
>> not wise to touch the /System area, so that's off limits. I guess the<br>
>> only advantage to the /Library installs from <a href="http://python.org" target="_blank">python.org</a> is to keep up<br>
>> with patches and new releases. Actually I can't decide on whether to<br>
>> use the binary packages direct from <a href="http://python.org" target="_blank">python.org</a> or the macports /opt<br>
>> installation, the latter seems to provide an option for ipython and<br>
>> that would be a real bonus. The macports install may be as close as I<br>
>> need to get to a source build for python. I've opted to use macports<br>
>> rather than fink, but that may be a mistake too ;-) I do like the<br>
>> Debian package system, which is the basis for fink. I just don't know<br>
>> whether fink is keeping up with things the way that Ubuntu does; it<br>
>> takes the best of Debian on popular platforms. I've opted for<br>
>> macports only because I know they will be specific to the OSX way of<br>
>> doing things - but why did they choose /opt/ instead of the default<br>
>> /usr or /usr/local path? Gheez.]<br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> On Wed, Sep 3, 2008 at 10:16 AM, Prabhu Ramachandran<br>
>> <<a href="mailto:prabhu@aero.iitb.ac.in">prabhu@aero.iitb.ac.in</a>> wrote:<br>
>>><br>
>>> Darren Weber wrote:<br>
>>>><br>
>>>> I've discovered a minor problem with the VTK python installation (from<br>
>>>> build) on OSX. I'm basically having library path issues and I don't<br>
>>>> know<br>
>>>> how to bend VTK build-install to fit OSX python or how to bend OSX<br>
>>>> python to<br>
>>>> use the default VTK install paths.<br>
>>><br>
>>> [...]<br>
>>>><br>
>>>> However, despite my attempt to get the module installed in the "right"<br>
>>>> place, I get this traceback during the import:<br>
>>>><br>
>>>> dweber@weber-mbp ~/src/kitware/VTK_build ]$ which python<br>
>>><br>
>>> [...]<br>
>>>><br>
>>>> ImportError:<br>
>>>><br>
>>>> dlopen(/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/vtk/libvtkCommonPython.so,<br>
>>>> 10): Library not loaded: libvtkCommonPythonD.5.2.dylib<br>
>>>> Referenced from:<br>
>>>><br>
>>>> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/vtk/libvtkCommonPython.so<br>
>>>> Reason: image not found<br>
>>>>>>><br>
>>>><br>
>>>><br>
>>>> This is where the libvtkCommon* libs are at:<br>
>>>><br>
>>>> /usr/local/lib/python2.5/site-packages/vtk/libvtkCommonPython.so<br>
>>>> /usr/local/lib/vtk-5.2/libvtkCommonPythonD.5.2.0.dylib<br>
>>>> /usr/local/lib/vtk-5.2/libvtkCommonPythonD.5.2.dylib<br>
>>>> /usr/local/lib/vtk-5.2/libvtkCommonPythonD.dylib<br>
>>><br>
>>> Try this:<br>
>>><br>
>>> export DYLD_LIBRARY_PATH=/usr/local/lib/vtk-5.2<br>
>>><br>
>>> Then rerun Python and see if import vtk works at all.<br>
>>><br>
>>> cheers,<br>
>>> prabhu<br>
>>><br>
>><br>
><br>
> _________________________________________________<br>
> | Mike Jackson - Principal Software Engineer |<br>
> | BlueQuartz Software |<br>
> | <a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a> |<br>
> | <a href="http://www.bluequartz.net" target="_blank">www.bluequartz.net</a> |<br>
> ---------------------------------------------------<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
_______________________________________________<br>
</div></div><div class="Ih2E3d">vtk-developers mailing list<br>
<a href="mailto:vtk-developers@vtk.org">vtk-developers@vtk.org</a><br>
</div><a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
</blockquote></div><br></div></div>