# Building VTK for Arm64 with OpenGL ES

**URL:** https://discourse.vtk.org/t/building-vtk-for-arm64-with-opengl-es/707
**Category:** Support
**Created:** [April 8, 2019, 7:35pm UTC](https://discourse.vtk.org/t/building-vtk-for-arm64-with-opengl-es/707 "2019-04-08T19:35:24Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![adamrankin](https://discourse.vtk.org/user_avatar/discourse.vtk.org/adamrankin/32/247_2.png) [@adamrankin](https://discourse.vtk.org/u/adamrankin)
#### Post date: [April 8, 2019, 7:35pm UTC](https://discourse.vtk.org/t/building-vtk-for-arm64-with-opengl-es/707/1 "2019-04-08T19:35:24Z")

</div>

Hello,

I am trying to build VTK on FriendlyDesktop (Ubuntu flavour) on my NanoPC-T4, and am running into a build error.

```auto
/home/pi/devel/PB-x64/Deps/vtk/GUISupport/Qt/QVTKOpenGLNativeWidget.cxx: In member function ‘virtual void QVTKOpenGLNativeWidget::paintGL()’:
/home/pi/devel/PB-x64/Deps/vtk/GUISupport/Qt/QVTKOpenGLNativeWidget.cxx:537:3: error: ‘QOpenGLFunctions_3_2_Core’ was not declared in this scope
   QOpenGLFunctions_3_2_Core* f =
   ^ ~~~~~~~~~~~~~~~~~~~~~~~~
/home/pi/devel/PB-x64/Deps/vtk/GUISupport/Qt/QVTKOpenGLNativeWidget.cxx:537:3: note: suggested alternative: ‘QOpenGLFunctionsPrivate’
   QOpenGLFunctions_3_2_Core* f =
   ^ ~~~~~~~~~~~~~~~~~~~~~~~~
   QOpenGLFunctionsPrivate
/home/pi/devel/PB-x64/Deps/vtk/GUISupport/Qt/QVTKOpenGLNativeWidget.cxx:537:30: error: ‘f’ was not declared in this scope
   QOpenGLFunctions_3_2_Core* f =
                              ^
/home/pi/devel/PB-x64/Deps/vtk/GUISupport/Qt/QVTKOpenGLNativeWidget.cxx:538:83: error: no matching function for call to ‘QOpenGLContext::versionFunctions<QOpenGLFunctions_3_2_Core>()’
     QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_2_Core>();
                                                                                   ^
In file included from /opt/qt-5.12.2/include/QtGui/QOpenGLContext:1:0,
                 from /home/pi/devel/PB-x64/Deps/vtk/GUISupport/Qt/QVTKOpenGLNativeWidget.cxx:20:

```

I have set the VTK\_OPENGL\_HAS\_ES and VTK\_OPENGL\_HAS\_EGL flags, and the appropriate libraries seem to be found.

I have built my own Qt with the `-opengl es2` backend selected. Has anyone successfully built for arm64/opengl es?

---

<div class="post-metadata">

### Author: ![adamrankin](https://discourse.vtk.org/user_avatar/discourse.vtk.org/adamrankin/32/247_2.png) [@adamrankin](https://discourse.vtk.org/u/adamrankin)
#### Post date: [April 8, 2019, 8:00pm UTC](https://discourse.vtk.org/t/building-vtk-for-arm64-with-opengl-es/707/2 "2019-04-08T20:00:31Z")

</div>

So, exploring the code at it looks like QVTKOpenGLNativeWidget cannot be compiled with OpenGL ES, as the header for `QOpenGLFunctions_3_2_Core` has a guard against it. I am exploring some workarounds.

---

<div class="post-metadata">

### Author: ![adamrankin](https://discourse.vtk.org/user_avatar/discourse.vtk.org/adamrankin/32/247_2.png) [@adamrankin](https://discourse.vtk.org/u/adamrankin)
#### Post date: [April 9, 2019, 1:56pm UTC](https://discourse.vtk.org/t/building-vtk-for-arm64-with-opengl-es/707/3 "2019-04-09T13:56:16Z")

</div>

By removing `QVTKOpenGLNativeWidget` from my working copy and appropriate `CMakeLists.txt` changes I am able to build. This project is using CTK so hopefully it will still work with `QVTKOpenGLWidget` (which it should according to its `CMakeLists.txt`)

---

<div class="post-metadata">

### Author: ![adamrankin](https://discourse.vtk.org/user_avatar/discourse.vtk.org/adamrankin/32/247_2.png) [@adamrankin](https://discourse.vtk.org/u/adamrankin)
#### Post date: [April 10, 2019, 9:13pm UTC](https://discourse.vtk.org/t/building-vtk-for-arm64-with-opengl-es/707/4 "2019-04-10T21:13:37Z")

</div>

Some minor changes to `QVTKOpenGLNativeWidget` enable compilation of VTK. Specifically using `QOpenGLExtraFunctions` instead of `QOpenGLFunctions_3_2_Core`.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [April 11, 2019, 8:28am UTC](https://discourse.vtk.org/t/building-vtk-for-arm64-with-opengl-es/707/5 "2019-04-11T08:28:21Z")

</div>

Hi Adam,

Thanks for your work. We do not test on Arm64 obviously but your contributions are welcome. Feel free to open a merge request so your changes can be integrated into VTK.

---

<div class="post-metadata">

### Author: ![adamrankin](https://discourse.vtk.org/user_avatar/discourse.vtk.org/adamrankin/32/247_2.png) [@adamrankin](https://discourse.vtk.org/u/adamrankin)
#### Post date: [April 12, 2019, 1:31pm UTC](https://discourse.vtk.org/t/building-vtk-for-arm64-with-opengl-es/707/6 "2019-04-12T13:31:58Z")

</div>

Of course, I know it’s not a normal use case, but I thought I’d explore it anyways.

`QVTKOpenGLNativeWidget` seems like an easy fix (if I understand the Qt OpenGL wrapping correctly), but `QVTKGraphicsItem` (via `vtkOpenGLError`) will be a bit harder to unravel. For now I’ve just disabled `Module_vtkGUISupportQtOpenGL` as I don’t need it (I think).
