[vtkusers] VTK with OpenVR on Linux (HTC Vive)
Ken Martin
ken.martin at kitware.com
Tue Oct 9 14:55:22 EDT 2018
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_ModuleInit(
> )':
> /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
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/20181009/40600b12/attachment.html>
More information about the vtkusers
mailing list