# Building VTK in Ubuntu 21.04. OpenGL missing.

**URL:** https://discourse.vtk.org/t/building-vtk-in-ubuntu-21-04-opengl-missing/9256
**Category:** Support
**Created:** [August 31, 2022, 8:28am UTC](https://discourse.vtk.org/t/building-vtk-in-ubuntu-21-04-opengl-missing/9256 "2022-08-31T08:28:45Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Jatin\_Chaudhary](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jatin_chaudhary/32/5726_2.png) [@Jatin\_Chaudhary](https://discourse.vtk.org/u/Jatin_Chaudhary)
#### Post date: [August 31, 2022, 8:28am UTC](https://discourse.vtk.org/t/building-vtk-in-ubuntu-21-04-opengl-missing/9256/1 "2022-08-31T08:28:45Z")

</div>

Hello,

I tried to build VTK using the instructions on the GitHub page of VTK. I got the following error:

CMake Error at CMake/vtkModule.cmake:4579 (message):  
Could not find the OpenGL external dependency.  
Call Stack (most recent call first):  
CMake/vtkModule.cmake:5173 (vtk\_module\_find\_package)  
Utilities/OpenGL/CMakeLists.txt:58 (vtk\_module\_third\_party\_external)

I tried to install OpenGL, but it depends on other packages. I tried to go down the chain in terms of dependencies, but unfortunately, cannot install OpenGL even after multiple attempts. I have implemented the following codes to install OpenGL and its various dependencies:

sudo apt-get install libegl1-mesa-dev  
FindOpenGL.cmake  
sudo apt-get install libgl1-mesa-dev  
sudo apt update  
sudo apt-get install freeglut3-dev  
sudo apt reinstall freeglut3-dev  
sudo apt --fix-broken install  
sudo apt --fix-missing  
sudo apt-get upgrade  
sudo apt-get install mesa-utils  
sudo apt install libgtkglext1

Thanking you  
Jatin

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [August 31, 2022, 7:13pm UTC](https://discourse.vtk.org/t/building-vtk-in-ubuntu-21-04-opengl-missing/9256/2 "2022-08-31T19:13:21Z")

</div>

The [ubuntu build-depends for vtk9](https://packages.ubuntu.com/source/impish/vtk9) might provide some clues about what is missing. One package it suggests is `libglu1-mesa-dev` (the `glu` library that goes with the `gl` library).

But YMMV if you have third-party OpenGL drivers on your system.
