[vtkusers] VTK with OpenVR on Linux (HTC Vive)

Ken Martin ken.martin at kitware.com
Wed Oct 17 13:08:43 EDT 2018


Awesome! Glad you tracked it down and got it working. More recent versions
of VTK removed that option so hopefully it will not bite others like it did
you.

On Wed, Oct 17, 2018 at 12:40 PM, <deubel at dornheim-medical-images.com>
wrote:

> Dear Ken,
> Thank you very much!
> Using a clean git-clone worked. I cannot build VTK with the BUILD_TESTING
> option, but I can live with that.
>
> Best wishes,
> Max.D.
>
> 17. Oktober 2018 14:26, "Ken Martin" <ken.martin at kitware.com
> <ken.martin at kitware.com?to=%22Ken%20Martin%22%20%3Cken.martin at kitware.com%3E>>
> schrieb:
>
> Hmm everything looks fine. Maybe something is left over on your VTK build
> causing openvr to try to link to factory methods. Make sure
> VTK_OPENVR_OBJECT_FACTORY
> is off/false in your cmake cache and do a clean rebuild of VTK.
> On Wed, Oct 17, 2018 at 8:02 AM, <deubel at dornheim-medical-images.com>
> wrote:
>
> Dear Ken,
>
> I did as you requested.
> In 2D, it works just fine, but when including the vtkOpenVR headers, it
> cannot build anymore.
> The make error message while linking is the same as before.
> This is the modified code file: https://pastebin.com/NDk2kzhc
> And the modified CMakeLists: https://pastebin.com/Gs9szZGc
> (This builds and runs with the old vtk version)
>
> Make error message:
> Scanning dependencies of target Cylinder
> [ 50%] Building CXX object CMakeFiles/Cylinder.dir/Cylinder.cxx.o
> [100%] Linking CXX executable Cylinder
> CMakeFiles/Cylinder.dir/Cylinder.cxx.o: In function
> `vtkRenderingOpenGL2_AutoInit::~vtkRenderingOpenGL2_AutoInit()':
> Cylinder.cxx:(.text._ZN28vtkRenderingOpenGL2_AutoInitD2Ev[_Z
> N28vtkRenderingOpenGL2_AutoInitD5Ev]+0x1): undefined reference to
> `vtkRenderingOpenVR_AutoInit_Destruct()'
> CMakeFiles/Cylinder.dir/Cylinder.cxx.o: In function `_GLOBAL__sub_I_main':
> Cylinder.cxx:(.text.startup+0x470): undefined reference to
> `vtkRenderingOpenVR_AutoInit_Construct()'
> collect2: error: ld returned 1 exit status
> CMakeFiles/Cylinder.dir/build.make:149: recipe for target 'Cylinder'
> failed
> make[2]: *** [Cylinder] Error 1
> CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Cylinder.dir/all'
> failed
> make[1]: *** [CMakeFiles/Cylinder.dir/all] Error 2
> Makefile:83: recipe for target 'all' failed
> make: *** [all] Error 2
>
> Best wishes,
> Max.D.
>
>
>
> 17. Oktober 2018 13:37, "Ken Martin" <ken.martin at kitware.com
> <ken.martin at kitware.com?to=%22Ken%20Martin%22%20%3Cken.martin at kitware.com%3E>>
> schrieb:
>
> Maybe try starting with something like this
> https://lorensen.github.io/VTKExamples/site/Cxx/GeometricObjects/Cylinder/
> Get that built and running on your system. Then edit that to add in the
> openvr codes.
> On Wed, Oct 17, 2018 at 5:59 AM, <deubel at dornheim-medical-images.com>
> wrote:
>
> Dear Ken,
> Unfortunately, this still doesn't work on the current master(pulled some
> minutes ago). This is my current CMakeLists.txt:
> https://pastebin.com/J2UyX6tr
>
> The error looks pretty much the same as before:
> [ 50%] Linking CXX executable vtkOpenVRHelloWorld
> CMakeFiles/vtkOpenVRHelloWorld.dir/CylinderRenderingProperties.cxx.o: In
> function `vtkRenderingOpenGL2_AutoInit::~vtkRenderingOpenGL2_AutoInit()':
> CylinderRenderingProperties.cxx:(.text._ZN28vtkRenderingOpen
> GL2_AutoInitD2Ev[_ZN28vtkRenderingOpenGL2_AutoInitD5Ev]+0x1): undefined
> reference to `vtkRenderingOpenVR_AutoInit_Destruct()'
> CMakeFiles/vtkOpenVRHelloWorld.dir/CylinderRenderingProperties.cxx.o: In
> function `_GLOBAL__sub_I_main':
> CylinderRenderingProperties.cxx:(.text.startup+0x340): undefined
> reference to `vtkRenderingOpenVR_AutoInit_Construct()'
> collect2: error: ld returned 1 exit status
> CMakeFiles/vtkOpenVRHelloWorld.dir/build.make:149: recipe for target
> 'vtkOpenVRHelloWorld' failed
> make[2]: *** [vtkOpenVRHelloWorld] Error 1
> CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/vtkOpenVRHelloWorld.dir/all'
> failed
> make[1]: *** [CMakeFiles/vtkOpenVRHelloWorld.dir/all] Error 2
> Makefile:83: recipe for target 'all' failed
> make: *** [all] Error 2
>
> Here you can find the verbose make output: https://pastebin.com/uKkPwWJP
>
> What is AutoInit?
>
> Do you have another idea what to try?
>
> Best wishes,
> Max.D.
>
> 9. Oktober 2018 20:55, "Ken Martin" <ken.martin at kitware.com
> <ken.martin at kitware.com?to=%22Ken%20Martin%22%20%3Cken.martin at kitware.com%3E>>
> schrieb:
>
> Maybe try something like the following in your CMakeLists. It works for me
> without adding any autoinit stuff.
> find_package(VTK REQUIRED)
> vtk_module_config(VTK
> vtkCommonCore
> vtkCommonDataModel
> vtkFiltersGeneral
> vtkIOImage
> vtkIOXML
> vtkInteractionStyle
> vtkRenderingOpenGL2
> vtkRenderingOpenVR
> )
> include(${VTK_USE_FILE})
> On Tue, Oct 9, 2018 at 12:27 PM, <deubel at dornheim-medical-images.com>
> wrote:
>
> Dear Ken,
> I tried to paste those lines in like that: https://pastebin.com/SRmt1GNp
>
> More fixing seems to be needed, as I am getting a very similar (but
> longer) linker error message:
>
> [100%] Linking CXX executable vtkOpenVRHelloWorld
> CMakeFiles/vtkOpenVRHelloWorld.dir/CylinderRenderingProperties.cxx.o: In
> function `vtkRenderingOpenVR_ModuleInit::vtkRenderingOpenVR_ModuleInit()':
> /media/max/home/max/vtkOpenVRHelloWorld/CylinderRenderingProperties.cxx:5:
> undefined reference to `vtkRenderingOpenVR_AutoInit_Construct()'
> CMakeFiles/vtkOpenVRHelloWorld.dir/CylinderRenderingProperties.cxx.o: In
> function `vtkRenderingOpenVR_ModuleInit::~vtkRenderingOpenVR_ModuleIn
> it()':
> /media/max/home/max/vtkOpenVRHelloWorld/CylinderRenderingProperties.cxx:5:
> undefined reference to `vtkRenderingOpenVR_AutoInit_Destruct()'
> CMakeFiles/vtkOpenVRHelloWorld.dir/CylinderRenderingProperties.cxx.o: In
> function `vtkRenderingOpenGL2_AutoInit::vtkRenderingOpenGL2_AutoInit()':
> /media/max/home/max/build-vtk-current-master-Desktop_Qt_5_11
> _2_GCC_64bit-Default/Rendering/OpenGL2/vtkRenderingOpenGL2Module.h:47:
> undefined reference to `vtkRenderingOpenVR_AutoInit_Construct()'
> CMakeFiles/vtkOpenVRHelloWorld.dir/CylinderRenderingProperties.cxx.o: In
> function `vtkRenderingOpenGL2_AutoInit::~vtkRenderingOpenGL2_AutoInit()':
> /media/max/home/max/build-vtk-current-master-Desktop_Qt_5_11
> _2_GCC_64bit-Default/Rendering/OpenGL2/vtkRenderingOpenGL2Module.h:47:
> undefined reference to `vtkRenderingOpenVR_AutoInit_Destruct()'
> collect2: error: ld returned 1 exit status
> CMakeFiles/vtkOpenVRHelloWorld.dir/build.make:149: recipe for target
> 'vtkOpenVRHelloWorld' failed
> make[2]: *** [vtkOpenVRHelloWorld] Error 1
> CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/vtkOpenVRHelloWorld.dir/all'
> failed
> make[1]: *** [CMakeFiles/vtkOpenVRHelloWorld.dir/all] Error 2
> Makefile:83: recipe for target 'all' failed
> make: *** [all] Error 2
>
> Do you a hint on what to try next?
>
> Best wishes,
> Max.D.
>
>
>
> 9. Oktober 2018 15:12, "Ken Martin" <ken.martin at kitware.com
> <ken.martin at kitware.com?to=%22Ken%20Martin%22%20%3Cken.martin at kitware.com%3E>>
> schrieb:
>
> You may need
> #include "vtkAutoInit.h"
> VTK_MODULE_INIT(vtkRenderingOpenGL2)
> VTK_MODULE_INIT(vtkRenderingOpenVR)
> or similar. Give that a shot - Ken
> On Tue, Oct 9, 2018 at 7:55 AM, <deubel at dornheim-medical-images.com>
> wrote:
>
> Dear Ken,
> I finally managed to get my code building and running on both Windows and
> Linux.
> You can find it here:
> https://transfer.sh/gJ1Sg/vtkOpenVRHelloWorld.zip
>
> Unfortunately, it doesn't work with the latest VTK-Version from
> https://gitlab.kitware.com/vtk/vtk
> After some testing, I found the first commit it doesn't build with:
> https://gitlab.kitware.com/vtk/vtk/commit/61bc6b5b4b8f0d2d11
> 1f6c10af3dd79488f919cc
> (VTK builds, but my program doesn't build with this VTK Version)
>
> Even though I already use the vtkOpenVR* classes explicitly, it doesn't
> build.
> Is there something else I have to change to make it compatible?
>
> Make produces the following Linker error:
>
> [ 50%] Linking CXX executable vtkOpenVRHelloWorld
> CMakeFiles/vtkOpenVRHelloWorld.dir/CylinderRenderingProperties.cxx.o: In
> function `vtkRenderingOpenGL2_AutoInit::vtkRenderingOpenGL2_AutoInit()':
> /media/max/home/max/build-vtk-current-master-Desktop_Qt_5_11
> _2_GCC_64bit-Default/Rendering/OpenGL2/vtkRenderingOpenGL2Module.h:47:
> undefined reference to `vtkRenderingOpenVR_AutoInit_Construct()'
> CMakeFiles/vtkOpenVRHelloWorld.dir/CylinderRenderingProperties.cxx.o: In
> function `vtkRenderingOpenGL2_AutoInit::~vtkRenderingOpenGL2_AutoInit()':
> /media/max/home/max/build-vtk-current-master-Desktop_Qt_5_11
> _2_GCC_64bit-Default/Rendering/OpenGL2/vtkRenderingOpenGL2Module.h:47:
> undefined reference to `vtkRenderingOpenVR_AutoInit_Destruct()'
>
> Any help would be appreciated!
>
> Best regards,
> Max.D.
>
>
> 4. Oktober 2018 16:10, "Ken Martin" <ken.martin at kitware.com
> <ken.martin at kitware.com?to=%22Ken%20Martin%22%20%3Cken.martin at kitware.com%3E>>
> schrieb:
>
> You need to create an use an OpenVRCamera. From your code it doesn't look
> like you are. I doubt that is the crash but it could be.
> Does the example work on windows? Since linux is an unknown I would think
> it would be best to make sure you have something working on windows, then
> port to linux.
> On Thu, Oct 4, 2018 at 9:56 AM, <deubel at dornheim-medical-images.com>
> wrote:
>
> Hey Guys,
> Has anyone of you been able to use the vtkOpenVR classes on Linux?
> I can run Steam with SteamVR on a Ubuntu 18.04 system, but when I try to
> run the HelloWorld Example of VTK modified for VR, I encounter a
> segmentation fault.
> You can find the code I used here: https://pastebin.com/gjsvKy58
> The whole project with binary and core dump can be found here:
> https://transfer.sh/6vONY/build.zip
>
> Do you have any suggestions on how to get this working?
>
> Thanks in advance!
>
> Best regards,
> Max.Deubel
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensou
> rce/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/vtkusers
>
>
>
>
> --
> Ken Martin PhD
> Distinguished Engineer
> Kitware Inc.
> 101 East Weaver Street
> <https://maps.google.com/?q=101+East+Weaver+Street+Carrboro,+North+Carolina+27510+USA&entry=gmail&source=g>
> Carrboro, North Carolina
> <https://maps.google.com/?q=101+East+Weaver+Street+Carrboro,+North+Carolina+27510+USA&entry=gmail&source=g>
> 27510 USA
> <https://maps.google.com/?q=101+East+Weaver+Street+Carrboro,+North+Carolina+27510+USA&entry=gmail&source=g>
> This communication, including all attachments, contains confidential and
> legally privileged information, and it is intended only for the use of the
> addressee. Access to this email by anyone else is unauthorized. If you are
> not the intended recipient, any disclosure, copying, distribution or any
> action taken in reliance on it is prohibited and may be unlawful. If you
> received this communication in error please notify us immediately and
> destroy the original message. Thank you.
>
>
>
>
> --
> Ken Martin PhD
> Distinguished Engineer
> Kitware Inc.
> 101 East Weaver Street
> <https://maps.google.com/?q=101+East+Weaver+Street+Carrboro,+North+Carolina+27510+USA&entry=gmail&source=g>
> Carrboro, North Carolina
> <https://maps.google.com/?q=101+East+Weaver+Street+Carrboro,+North+Carolina+27510+USA&entry=gmail&source=g>
> 27510 USA
> <https://maps.google.com/?q=101+East+Weaver+Street+Carrboro,+North+Carolina+27510+USA&entry=gmail&source=g>
> This communication, including all attachments, contains confidential and
> legally privileged information, and it is intended only for the use of the
> addressee. Access to this email by anyone else is unauthorized. If you are
> not the intended recipient, any disclosure, copying, distribution or any
> action taken in reliance on it is prohibited and may be unlawful. If you
> received this communication in error please notify us immediately and
> destroy the original message. Thank you.
>
>
>
>
> --
> Ken Martin PhD
> Distinguished Engineer
> Kitware Inc.
> 101 East Weaver Street
> <https://maps.google.com/?q=101+East+Weaver+Street+Carrboro,+North+Carolina+27510+USA&entry=gmail&source=g>
> Carrboro, North Carolina
> <https://maps.google.com/?q=101+East+Weaver+Street+Carrboro,+North+Carolina+27510+USA&entry=gmail&source=g>
> 27510 USA
> <https://maps.google.com/?q=101+East+Weaver+Street+Carrboro,+North+Carolina+27510+USA&entry=gmail&source=g>
> This communication, including all attachments, contains confidential and
> legally privileged information, and it is intended only for the use of the
> addressee. Access to this email by anyone else is unauthorized. If you are
> not the intended recipient, any disclosure, copying, distribution or any
> action taken in reliance on it is prohibited and may be unlawful. If you
> received this communication in error please notify us immediately and
> destroy the original message. Thank you.
>
>
>
>
> --
> Ken Martin PhD
> Distinguished Engineer
> Kitware Inc.
> 101 East Weaver Street
> <https://maps.google.com/?q=101+East+Weaver+Street+Carrboro,+North+Carolina+27510+USA&entry=gmail&source=g>
> Carrboro, North Carolina
> <https://maps.google.com/?q=101+East+Weaver+Street+Carrboro,+North+Carolina+27510+USA&entry=gmail&source=g>
> 27510 USA
> <https://maps.google.com/?q=101+East+Weaver+Street+Carrboro,+North+Carolina+27510+USA&entry=gmail&source=g>
> This communication, including all attachments, contains confidential and
> legally privileged information, and it is intended only for the use of the
> addressee. Access to this email by anyone else is unauthorized. If you are
> not the intended recipient, any disclosure, copying, distribution or any
> action taken in reliance on it is prohibited and may be unlawful. If you
> received this communication in error please notify us immediately and
> destroy the original message. Thank you.
>
>
>
>
>
> --
> Ken Martin PhD
> Distinguished Engineer
> Kitware Inc.
> 101 East Weaver Street
> <https://maps.google.com/?q=101+East+Weaver+Street+Carrboro,+North+Carolina+27510+USA&entry=gmail&source=g>
> Carrboro, North Carolina
> <https://maps.google.com/?q=101+East+Weaver+Street+Carrboro,+North+Carolina+27510+USA&entry=gmail&source=g>
> 27510 USA
> <https://maps.google.com/?q=101+East+Weaver+Street+Carrboro,+North+Carolina+27510+USA&entry=gmail&source=g>
> This communication, including all attachments, contains confidential and
> legally privileged information, and it is intended only for the use of the
> addressee. Access to this email by anyone else is unauthorized. If you are
> not the intended recipient, any disclosure, copying, distribution or any
> action taken in reliance on it is prohibited and may be unlawful. If you
> received this communication in error please notify us immediately and
> destroy the original message. Thank you.
>
>
>
>


-- 
Ken Martin PhD
Distinguished Engineer
Kitware Inc.
101 East Weaver Street
Carrboro, North Carolina
27510 USA

This communication, including all attachments, contains confidential and
legally privileged information, and it is intended only for the use of the
addressee.  Access to this email by anyone else is unauthorized. If you are
not the intended recipient, any disclosure, copying, distribution or any
action taken in reliance on it is prohibited and may be unlawful. If you
received this communication in error please notify us immediately and
destroy the original message.  Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20181017/35e5c9ae/attachment.html>


More information about the vtkusers mailing list