[vtkusers] Need Help Compiling VTK on OS X With Python Wrappers and a Local Python Installation

Darren Weber darren.weber.lists at gmail.com
Thu Feb 18 14:24:41 EST 2010


I have a little experience of the transition from Linux to OSX (not by
choice - Ubuntu is easier for me).

In general, OSX is a different beast from Linux, under the hood.  It may
help to learn a little about the Mach-Object format, including the dynamic
library system (this probably applies to both BSD-Darwin and OSX, so the
learning is not entirely specific to OSX).

This link is a short useful pointer on how to inspect and modify .dylib
files:
http://qin.laya.com/tech_coding_help/dylib_linking.html

The gory details:
http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html

Very general refs to OSX dev
http://developer.apple.com/mac/library/navigation/index.html

Best,
Darren




On Wed, Feb 17, 2010 at 3:35 PM, Darren Weber
<darren.weber.lists at gmail.com>wrote:

>
> I've put together some notes on my efforts to create a MacPorts port for
> ITK, see
> http://www.cmake.org/Wiki/ITK_MacPorts_Package_Maintainers
>
> In a way, those notes will also apply to the vtk-devel port (I should make
> a wiki page for vtk-devel).  For vtk-devel, the Portfile is here
>
> http://svn.macosforge.org/repository/macports/trunk/dports/graphics/vtk-devel/Portfile
>
> It's a lot to ask that you might learn something from reading this, but
> there are some sections in the Portfile that might be helpful.  Look at the
> configure.args section to get an idea of how I setup cmake for the MacPorts
> configuration.  (Note that these arguments are changed in the 'variants'
> sections.)
>
> For python stuff, go down to the section on wrapping and look at the py25
> variant and the functions that it calls, esp. pyPostDestroot. The python
> wrapping required a lot of tweaks to get all the library links right, when
> using shared libs (dylib on OSX).  Also look at the setPython function,
> because you could hack that to provide a custom python path for the
> wrapping.
>
> It's not easy, but I hope that helps a little,
> Darren
>
>
>
> On Fri, Jan 29, 2010 at 5:12 AM, Smith, Mark E CTR USAF AFMC AEDC/ATA <
> Mark.E.Smith at arnold.af.mil> wrote:
>
>> Thanks for the info Darren. I have given up the attempt to build and
>> install using the approach that I was attempting. I generally use Linux
>> platforms for development, but I also have a Mac and I was attempting to
>> build the same infrastructure on the Mac as I have on the Linux machines.
>>
>> I did not know that macports software could be installed in an alternate
>> directory. I will look into it. However, I want to use my local Python
>> installation, and that is where I have had difficulty.
>>
>> -----Original Message-----
>> From: Darren Weber [mailto:darren.weber.lists at gmail.com]
>> Sent: Thursday, January 28, 2010 2:09 PM
>> To: Berk Geveci
>> Cc: David Gobbi; Smith, Mark E CTR USAF AFMC AEDC/ATA; vtkusers at vtk.org
>> Subject: Re: [vtkusers] Need Help Compiling VTK on OS X With Python
>> Wrappers and a Local Python Installation
>>
>>
>> You might try using macports without a root installation path.  The
>> default path is /opt/local/, but that can be changed.  There may be some
>> ports that contain instructions that require root access (perhaps apache,
>> mysql, postgresql, etc. have system init scripts that require root access).
>>
>> Seems to me that your swimming a little too hard against the tide, esp.
>> with .so libs on OSX/Darwin.  How about you lighten your work load by asking
>> your sys admin to install all your libraries?  How about running your own
>> system with root access (try Ubuntu)?
>>
>> Take care,
>> Darren
>>
>>
>>
>>
>> On Tue, Dec 22, 2009 at 10:27 AM, Berk Geveci <berk.geveci at kitware.com>
>> wrote:
>>
>>
>>        Same here. I have no idea how to build Python such that it
>> generates
>>        .so libraries rather than .dylib. Even things like MacPorts, which
>> are
>>        very Unixy, generate dylibs. I know for sure that there is no way
>> of
>>        generating VTK libraries as .sos (Python modules on the other hand
>>        have the .so extension).
>>
>>        -berk
>>
>>
>>        On Mon, Dec 21, 2009 at 5:58 PM, David Gobbi <
>> david.gobbi at gmail.com> wrote:
>>        > Well, ya got me then.  Even when I build 3rd party unix
>> non-framework
>>        > stuff on the Mac, including python, I still get dylibs.  I didn't
>> know
>>        > the mac loader would even recognize .so libraries.
>>        >
>>        >   David
>>        >
>>        >
>>        > On Mon, Dec 21, 2009 at 3:36 PM, Smith, Mark E CTR USAF AFMC
>> AEDC/ATA
>>        > <Mark.E.Smith at arnold.af.mil> wrote:
>>        >> Except that when I built my local python installation I built it
>> for a
>>        >> unix platform using .so libraries. No frameworks. No dylibs.
>>        >>
>>        >> I think what I want is vtk built the same way, that is, for a
>> unix
>>        >> platform.
>>        >>
>>        >> -----Original Message-----
>>        >> From: David Gobbi [mailto:david.gobbi at gmail.com]
>>        >> Sent: Monday, December 21, 2009 4:09 PM
>>        >> To: Smith, Mark E CTR USAF AFMC AEDC/ATA
>>        >> Cc: Berk Geveci; vtkusers at vtk.org
>>        >> Subject: Re: [vtkusers] Need Help Compiling VTK on OS X With
>> Python
>>        >> Wrappers and a Local Python Installation
>>        >>
>>        >> Hi Mark,
>>        >>
>>        >> You're very close.  You need to set the PYTHON_LIBRARY variable
>> like so:
>>        >>
>>        >> /System/Library/Frameworks/Python.framework/Python
>>        >>
>>        >> Or like so:
>>        >>
>>        >> /System/Library/Frameworks/Python.framework/Versions/2.5/Python
>>        >>
>>        >> Of course using the correct path to your own python framework.
>>        >>
>>        >>   David
>>        >>
>>        >>
>>        >> On Mon, Dec 21, 2009 at 2:45 PM, Smith, Mark E CTR USAF AFMC
>> AEDC/ATA
>>        >> <Mark.E.Smith at arnold.af.mil> wrote:
>>        >>> Yes, but the build process complains that it wants a file and
>> not a
>>        >>> directory (at least on the PYTHON_LIBRARY setting). But since
>> the
>>        >>> default just points to the framework directory I cannot tell
>> what is
>>        >> the
>>        >>> correct thing to put here.
>>        >>>
>>        >>> -----Original Message-----
>>        >>> From: Berk Geveci [mailto:berk.geveci at kitware.com]
>>        >>> Sent: Monday, December 21, 2009 3:29 PM
>>        >>> To: Smith, Mark E CTR USAF AFMC AEDC/ATA
>>        >>> Cc: vtkusers at vtk.org
>>        >>> Subject: Re: [vtkusers] Need Help Compiling VTK on OS X With
>> Python
>>        >>> Wrappers and a Local Python Installation
>>        >>>
>>        >>> Did you try setting PYTHON_INCLUDE_DIR and PYTHON_LIBRARY to
>> point to
>>        >>> your Python build? Note that these are advanced settings so you
>> will
>>        >>> have to turn on advanced mode in CMake.
>>        >>>
>>        >>> On Mon, Dec 21, 2009 at 2:14 PM, Smith, Mark E CTR USAF AFMC
>> AEDC/ATA
>>        >>> <Mark.E.Smith at arnold.af.mil> wrote:
>>        >>>> I suspect that this question has been answered, but so for I
>> have not
>>        >>>> been able to find the answer. I want to build and install VTK
>> with
>>        >>>> Python wrappers on OS X. I must install VTK locally since I do
>> not
>>        >>> have
>>        >>>> root access. I have a local installation of Python. When I
>> build VTK
>>        >>> the
>>        >>>> system installation of Python and the libraries in the Python
>>        >>> framework
>>        >>>> are used. Thus, when I run my local python and attempt to
>> import vtk
>>        >> I
>>        >>>> get an error like below.
>>        >>>>
>>        >>>> Fatal Python error: Interpreter not initialized (version
>> mismatch?)
>>        >>>>
>>        >>>> I have LD_LIBRARY_PATH and DYLD_LIBRARY_PATH set to the path
>> where my
>>        >>>> local Python libraries exist. I have my path set to pickup my
>> local
>>        >>>> python executable and that is what is reported when I
>> configure with
>>        >>>> ccmake. My local python installation does not have frameworks
>> or
>>        >> dylib
>>        >>>> files. I am using VTK 5.4.2. Any suggestions how to solve this
>>        >>> problem?
>>        >>>>
>>        >>>> Thanks
>>        >>>> _______________________________________________
>>        >>>> Powered by www.kitware.com
>>        >>>>
>>        >>>> Visit other Kitware open-source projects at
>>        >>> http://www.kitware.com/opensource/opensource.html
>>        >>>>
>>        >>>> Please keep messages on-topic and check the VTK FAQ at:
>>        >>> http://www.vtk.org/Wiki/VTK_FAQ
>>        >>>>
>>        >>>> Follow this link to subscribe/unsubscribe:
>>        >>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>        >>>>
>>        >>> _______________________________________________
>>        >>> Powered by www.kitware.com
>>        >>>
>>        >>> Visit other Kitware open-source projects at
>>        >> http://www.kitware.com/opensource/opensource.html
>>        >>>
>>        >>> Please keep messages on-topic and check the VTK FAQ at:
>>        >> http://www.vtk.org/Wiki/VTK_FAQ
>>        >>>
>>        >>> Follow this link to subscribe/unsubscribe:
>>        >>> http://www.vtk.org/mailman/listinfo/vtkusers
>>        >>>
>>        >>
>>        >
>>        _______________________________________________
>>        Powered by www.kitware.com
>>
>>        Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>>        Please keep messages on-topic and check the VTK 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/20100218/885809cb/attachment.htm>


More information about the vtkusers mailing list