[vtkusers] vtk6 porting question (segfault)

Trevor Irons trevorirons at gmail.com
Tue Aug 14 16:37:03 EDT 2012


OK, I was able to build all of the examples OK.

My problem is that I do not use CMake in my application, so relying on
CMake is not a very good solution for me. Are there any resources for how
to write portable applications using VTK 6.0, I have been relying on users
to have VTK installed already. Maybe I should stick with 5.10 for a while.

Thanks again,

-- Trevor



On 14 August 2012 20:06, Bill Lorensen <bill.lorensen at gmail.com> wrote:

> The wiki examples should build with default settings for cmake.
>
>
>
>
> On Tue, Aug 14, 2012 at 3:42 PM, Trevor Irons <trevorirons at gmail.com>wrote:
>
>> Correction, I was following these directions.
>>
>> http://vtk.org/Wiki/VTK/Examples/Instructions/ForUsers
>>
>> -- Trevor
>>
>>
>>
>>
>> On 14 August 2012 19:41, Trevor Irons <trevorirons at gmail.com> wrote:
>>
>>> Thanks for the help. I think it's come down to not having
>>> VTK_USE_RENDERING defined.
>>> At least I get this error when following the directions on
>>> http://vtk.org/Wiki/VTK/Examples/Cxx.
>>>
>>> However, this does not seem to be an option when configuring VTK. There
>>> is VTK_Group_Rendering, but no VTK_USE_RENDERING option.
>>>
>>> I also find this strange, as in my installation directory
>>>  $ ls -l  libvtkRendering*.so
>>>
>>> libvtkRenderingAnnotation-6.0.so
>>> libvtkRenderingGL2PS-6.0.so
>>> libvtkRenderingMathText-6.0.so
>>> libvtkRenderingAnnotationPython27D-6.0.so
>>> libvtkRenderingGL2PSPython27D-6.0.so
>>> libvtkRenderingMathTextPython27D-6.0.so
>>> libvtkRenderingContext2D-6.0.so
>>> libvtkRenderingHybridOpenGL-6.0.so
>>> libvtkRenderingOpenGL-6.0.so
>>> libvtkRenderingContext2DPython27D-6.0.so
>>> libvtkRenderingHybridOpenGLPython27D-6.0.so
>>> libvtkRenderingOpenGLPython27D-6.0.so
>>> libvtkRenderingCore-6.0.so
>>> libvtkRenderingImage-6.0.so
>>> libvtkRenderingVolume-6.0.so
>>> libvtkRenderingCorePython27D-6.0.so
>>> libvtkRenderingImagePython27D-6.0.so
>>> libvtkRenderingVolumeOpenGL-6.0.so
>>> libvtkRenderingFreeType-6.0.so                 libvtkRenderingLOD-6.0.so
>>> libvtkRenderingVolumeOpenGLPython27D-6.0.so
>>> libvtkRenderingFreeTypeOpenGL-6.0.so
>>> libvtkRenderingLODPython27D-6.0.so
>>> libvtkRenderingVolumePython27D-6.0.so
>>> libvtkRenderingFreeTypeOpenGLPython27D-6.0.so
>>> libvtkRenderingLabel-6.0.so
>>>
>>> libvtkRenderingFreeTypePython27D-6.0.so
>>> libvtkRenderingLabelPython27D-6.0.so
>>>
>>> Generates quite a lot of hits. Thanks again for the tips and suggestions.
>>>
>>> -- Trevor
>>>
>>>
>>>
>>>
>>> On 14 August 2012 17:54, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>>>
>>>> The built examples will be in the bin directory of your VTK.
>>>>
>>>> A more extensive set of examples are on the Wiki:
>>>> http://vtk.org/Wiki/VTK/Examples/Cxx
>>>>
>>>> each has a valid CMakeLists.txt file.
>>>>
>>>> You can also build them all by following these instructions:
>>>> http://vtk.org/Wiki/VTK/Examples/Instructions/ForUsers
>>>>
>>>> Bill
>>>>
>>>>
>>>> On Tue, Aug 14, 2012 at 1:48 PM, Bill Lorensen <bill.lorensen at gmail.com
>>>> > wrote:
>>>>
>>>>> PLease keep repiles on the list.
>>>>>
>>>>> For VTK6 use:
>>>>>
>>>>> ${VTK_LIBRARIES} instead of vtkRendering
>>>>>
>>>>>
>>>>> On Tue, Aug 14, 2012 at 1:02 PM, Trevor Irons <trevorirons at gmail.com>wrote:
>>>>>
>>>>>> Hi Bill! Wow.
>>>>>>
>>>>>> I guess this is the underlying question. I enabled build examples in
>>>>>> CMake. But I honestly can't find where these are compiled to. My example is
>>>>>> from
>>>>>>
>>>>>> VTKSOURCE/Examples/Tutorial/Step1/Cxx/Cone.cxx
>>>>>>
>>>>>> And the CMakeLists there specifies
>>>>>>
>>>>>> PROJECT (Step1)
>>>>>>
>>>>>> IF(NOT VTK_BINARY_DIR)
>>>>>> FIND_PACKAGE(VTK REQUIRED)
>>>>>> IF(NOT VTK_USE_RENDERING)
>>>>>>   MESSAGE(FATAL_ERROR "Example ${PROJECT_NAME} requires
>>>>>> VTK_USE_RENDERING.")
>>>>>> ENDIF(NOT VTK_USE_RENDERING)
>>>>>> INCLUDE(${VTK_USE_FILE})
>>>>>> ENDIF(NOT VTK_BINARY_DIR)
>>>>>>
>>>>>> ADD_EXECUTABLE(Cone Cone.cxx)
>>>>>> TARGET_LINK_LIBRARIES(Cone vtkRendering)
>>>>>>
>>>>>> But vtkRendering I think is a pre 6.0 library? Where in the build
>>>>>> directory are the Examples built? Is there an updated CmakeLists file there?
>>>>>>
>>>>>> Thanks so much,
>>>>>>
>>>>>> -- Trevor
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 14 August 2012 16:51, Bill Lorensen <bill.lorensen at gmail.com>wrote:
>>>>>>
>>>>>>> Have you tried building your example with CMake. I suspect you are
>>>>>>> missing some libraries.
>>>>>>>
>>>>>>> On Tue, Aug 14, 2012 at 11:47 AM, Trevor Irons <
>>>>>>> trevorirons at gmail.com> wrote:
>>>>>>>
>>>>>>>> Sorry if this has been asked before, but I couldn't find it.
>>>>>>>>
>>>>>>>> I am having trouble porting an application over to VTK 6.0. I
>>>>>>>> followed the guide at
>>>>>>>> http://www.vtk.org/Wiki/VTK/VTK_6_Migration_Guide
>>>>>>>>
>>>>>>>> I am able to get my project to compile but I hit a seg fault at
>>>>>>>> execution. As a minimal example consider a pared down Cone.cxx from the
>>>>>>>> Examples
>>>>>>>>
>>>>>>>> // First include the required header files for the VTK classes we
>>>>>>>> are using.
>>>>>>>> #include "vtkConeSource.h"
>>>>>>>> #include "vtkPolyDataMapper.h"
>>>>>>>>
>>>>>>>> int main()
>>>>>>>> {
>>>>>>>>
>>>>>>>>   vtkConeSource *cone = vtkConeSource::New();
>>>>>>>>   cone->SetHeight( 3.0 );
>>>>>>>>   cone->SetRadius( 1.0 );
>>>>>>>>   cone->SetResolution( 10 );
>>>>>>>>
>>>>>>>>   vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
>>>>>>>>   coneMapper->SetInputConnection( cone->GetOutputPort() );
>>>>>>>>   //coneMapper->SetInputData( cone->GetOutput()
>>>>>>>> );                         // I tried this too
>>>>>>>>
>>>>>>>>   exit(0);
>>>>>>>>
>>>>>>>> }
>>>>>>>>
>>>>>>>> I have been compiling with
>>>>>>>>
>>>>>>>> g++ Cone.cxx -g -g3  -o testit  -I/usr/local/include/vtk-6.0/
>>>>>>>> -lvtkRenderingCore-6.0  -lvtkFiltersSources-6.0
>>>>>>>> -lvtkCommonExecutionModel-6.0
>>>>>>>>
>>>>>>>> on
>>>>>>>>
>>>>>>>> g++ --version
>>>>>>>> g++ (GCC) 4.7.1 20120721 (prerelease)
>>>>>>>> Copyright (C) 2012 Free Software Foundation, Inc.
>>>>>>>> This is free software; see the source for copying conditions.
>>>>>>>> There is NO
>>>>>>>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
>>>>>>>> PURPOSE.
>>>>>>>>
>>>>>>>> And when I execute, I just see a segmentation fault. I assume I am
>>>>>>>> doing something wrong, but I can't figure out what.
>>>>>>>>
>>>>>>>> I ran it through gdb, but it just said the fault was in
>>>>>>>> SetInputConnection, or SetInputData, I tried both. This is with the tip of
>>>>>>>> VTK from the git repository.
>>>>>>>>
>>>>>>>> Thanks for any suggestions.
>>>>>>>>
>>>>>>>> -- Trevor
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> 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
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Unpaid intern in BillsBasement at noware dot com
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Unpaid intern in BillsBasement at noware dot com
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Unpaid intern in BillsBasement at noware dot com
>>>>
>>>>
>>>
>>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120814/dac62547/attachment.htm>


More information about the vtkusers mailing list