Install libosmesa6-dev by entering the following commands in the terminal:
sudo apt update sudo apt install libosmesa6-dev
Mesa Off-screen rendering extension -- development files
This package provides the required environment for developing programs that use the off-screen rendering extension of Mesa. . For more information on OSmesa see the libosmesa6 package.