[vtkusers] Re: vtkLocal and python

Sean McInerney seanm at nmr.mgh.harvard.edu
Thu Apr 8 16:37:27 EDT 2004


Hi John,

   Maybe I am missing something, but CMake does not seem to be 
complaining about anything being missing. The reason your problem crops 
up at link time is probably due to a lack of dependency specification in 
your vtkLocal CMakeLists.txt. ld finds undefined symbols (from 
vtkFiltering in your case), but has no idea itself where to find them. 
The linker can be clued in about dependencies for any kind of target 
(executable, library, or module) via the 'TARGET_LINK_LIBRARIES' 
command. What you seem to need is:

   TARGET_LINK_LIBRARIES (vtkLocal vtkFiltering)

... and for your vtkLocalTest executable ...

   TARGET_LINK_LIBRARIES (vtkLocalTest vtkLocal)

-Sean

P.S. If this does not help, you may have to tell cmake where the VTK 
libraries can be found via the 'LINK_DIRECTORIES' command ... but I 
think this information should already be in the cache. If I am wrong, add:

   LINK_DIRECTORIES (${VTK_LIBRARY_DIR})


> Message: 3
> Cc: Glen Lehmann <glehmann at imaging.robarts.ca>,
> 	VTK Users <vtkusers at public.kitware.com>
> From: Glen Lehmann <glehmann at imaging.robarts.ca>
> Subject: Re: [vtkusers] vtkLocal and python
> Date: Thu, 8 Apr 2004 09:37:46 -0400
> To: John Hunter <jdhunter at nitace.bsd.uchicago.edu>
> 
> Hi John,
> 
> Yup, you need to put the .cxx files in CMakeLists.txt but the .h's  
> shouldn't be necessary.
> 
> To get rid of the build error comment out the "SUBDIRS(Testing") line  
> at the bottom of the CMakeLists.txt file.  CMake is looking for a  
> CMakeLists.txt in the Testing dir.
> 
> Once the build works you can use make install to install everything.
> 
> If you want the module to load when you call "from vtkpython import *"  
> then you need to do exactly what you did with the __init__.py and  
> local.py files (this doesn't happen automatically).
> 
> I prefer to add the location of vtkLocal to my environment paths and  
> just call "from libvtkLocalPython" import *" but that doesn't work  
> vtkLocal needs to be installed system-wide.
> 
> To see the gcc commands set:
> CMAKE_VERBOSE_MAKEFILE:BOOL=TRUE.
> 
> Hope that helps,
> Cheers,
> Glen
> 
> 
> 
> On Apr 8, 2004, at 9:03 AM, John Hunter wrote:
> 
> 
>>I just built and installed a filter (vtkRemoveCellsFilter) using
>>vtkLocal for use with python.  It went OK, but I had to do several
>>things manually so I am wondering if I missed the obvious way to do
>>it.
>>
>>Here is what I did:
>>
>>  * put the *.cxx and *.h file in vtkLocal and edited the
>>    CMakeLists.txt file as described in the README.  Ran cmake -i and
>>    then make in the vtkLocal dir.
>>
>>  * The make failed with a link error in the Testing dir but the libs
>>    were built (make output below).  I suspect this is why I had to do
>>    the rest by hand
>>
>>  * Copied the bin/libvtk* to /usr/local/lib/vtk/
>>
>>  * edited python site-packages/vtk_python/vtk/__init__.py to add the
>>    'local' kit and then created local.py to import all the symbols
>>    from libvtkLocalPython.
>>
>>I'm guessing all of the last steps would have worked automatically had
>>my make not failed.  Any suggestions about what I can do to fix the
>>make?
>>
>>BTW: how do I see the actual gcc commands generated by cmake/make?
>>
>>Thanks,
>>John Hunter
>>
>>
>>
>>hunter:~/c/src/VTK-4.4/Examples/Build/vtkLocal> make
>>/hunter/jdhunter/c/src/VTK-4.4/Examples/Build/vtkLocal/Testing:  
>>building default_target
>>cmake.depends is up-to-date
>>/hunter/jdhunter/c/src/VTK-4.4/Examples/Build/vtkLocal/Testing/Cxxq:  
>>building default_target
>>Building executable  
>>/hunter/jdhunter/c/src/VTK-4.4/Examples/Build/vtkLocal/bin/ 
>>vtkLocalTest...
>>/usr/local/lib/vtk/libvtkLocal.so: undefined reference to  
>>`vtkPolyDataSource::GetOutput()'
>>/usr/local/lib/vtk/libvtkLocal.so: undefined reference to `typeinfo  
>>for vtkPolyDataToPolyDataFilter'
>>/usr/local/lib/vtk/libvtkLocal.so: undefined reference to `vtable for  
>>vtkPolyDataSource'
>>/usr/local/lib/vtk/libvtkLocal.so: undefined reference to  
>>`vtkPolyDataToPolyDataFilter::CollectRevisions(std:: 
>>basic_ostream<char, std::char_traits<char> >&)'
>>/usr/local/lib/vtk/libvtkLocal.so: undefined reference to  
>>`vtkPolyDataToPolyDataFilter::SetInput(vtkPolyData*)'
>>/usr/local/lib/vtk/libvtkLocal.so: undefined reference to  
>>`vtkPolyDataToPolyDataFilter::GetInput()'
>>/usr/local/lib/vtk/libvtkLocal.so: undefined reference to  
>>`vtkPolyDataToPolyDataFilter::PrintSelf(std::basic_ostream<char,  
>>std::char_traits<char> >&, vtkIndent)'
>>/usr/local/lib/vtk/libvtkLocal.so: undefined reference to  
>>`vtkPolyDataToPolyDataFilter::vtkPolyDataToPolyDataFilter[not-in- 
>>charge]()'
>>/usr/local/lib/vtk/libvtkLocal.so: undefined reference to  
>>`vtkPolyDataSource::ComputeInputUpdateExtents(vtkDataObject*)'
>>collect2: ld returned 1 exit status
>>make[5]: ***  
>>[/hunter/jdhunter/c/src/VTK-4.4/Examples/Build/vtkLocal/bin/ 
>>vtkLocalTest] Error 1
>>make[4]: *** [default_target] Error 2
>>make[3]: *** [default_target_Cxx] Error 2
>>make[2]: *** [default_target] Error 2
>>make[1]: *** [default_target_Testing] Error 2
>>make: *** [default_target] Error 2
>>hunter:~/c/src/VTK-4.4/Examples/Build/
> 



More information about the vtkusers mailing list