[vtk-developers] vtkCommonCorePython static build failure

David Gobbi david.gobbi at gmail.com
Thu Jun 28 11:09:54 EDT 2012


Hi Pat,

I think that "must" is too strong a word.  With VTK 4, I used to build
python modules with a static VTK on a regular basis.  It can be done
by adding "-fPIC" and by making the python modules dynamically link to
each other, i.e. by making the python modules play a dual role as both
modules and libraries.  But I don't have any need to do that anymore
so I haven't played around with the CMake files to see if I can get it
working again.

 - David


On Thu, Jun 28, 2012 at 8:58 AM, Pat Marion <pat.marion at kitware.com> wrote:
> Hi,
>
> If you want python modules, you must build VTK with shared libraries.  But,
> you can make a fully static build where even the modules are static libs,
> and everything is then statically linked into the vtkpython interpreter
> binary.  To compile the python modules as static libs, turn OFF all the
> PYTHON_MODULE_vtk*Python_BUILD_SHARED options.
>
> Pat
>
>
>
> On Thu, Jun 28, 2012 at 10:34 AM, David Lonie <david.lonie at kitware.com>
> wrote:
>>
>> On Thu, Jun 28, 2012 at 10:26 AM, David Gobbi <david.gobbi at gmail.com>
>> wrote:
>> > On Thu, Jun 28, 2012 at 8:23 AM, David Lonie <david.lonie at kitware.com>
>> > wrote:
>> >> On Thu, Jun 28, 2012 at 10:01 AM, David Gobbi <david.gobbi at gmail.com>
>> >> wrote:
>> >>> On Thu, Jun 28, 2012 at 7:57 AM, David Lonie <david.lonie at kitware.com>
>> >>> wrote:
>> >>>> Ah, ok -- nevermind then :-)
>> >>>
>> >>> It never hurts to try, though... you can add "-fPIC" to your CXXFLAGS
>> >>> and
>> >>> rebuild VTK, and then if the modules are loaded into python in the
>> >>> right order
>> >>> it just might work... I think that vtk-python still loads its modules
>> >>> with
>> >>> RTLD_GLOBAL so it might be able to resolve symbols directly between
>> >>> the
>> >>> python modules instead of requiring shared libraries.
>> >>
>> >> Success! Adding -fPIC to CFLAGS and CXXFLAGS is all that was needed
>> >> for it to build.
>> >
>> > Yes, it will build, but I'm curious about whether you can "import vtk"
>> > from python without it complaining about missing symbols.  Can you
>> > try, just to satisfy my curiosity?
>>
>> It tries, but segfaults quickly.
>>
>> Dave
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>
>



More information about the vtk-developers mailing list