Ошибка could not find opengl

I want to install VTK in Ubuntu. CMake sends me this error :

CMake Error at
/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108
(message): Could NOT find OpenGL (missing: OPENGL_gl_LIBRARY
OPENGL_INCLUDE_DIR) Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315
(_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-2.8/Modules/FindOpenGL.cmake:161
(FIND_PACKAGE_HANDLE_STANDARD_ARGS)
Rendering/OpenGL/CMakeLists.txt:196 (find_package)

CMake Error: The following variables are used in this project, but
they are set to NOTFOUND. Please set them or make sure they are set
and tested correctly in the CMake files: OPENGL_INCLUDE_DIR (ADVANCED)
used as include directory in directory
/home/pilou/Documents/src/VTK-6.2.0/Geovis/Core

I have hence installed freeglut3 and build-essential (as I have seen on Internet). But nothing has changed.

How could I find opengl to write my own link to CMake? What else could I do to install VTK?

asked Jul 1, 2015 at 20:19

guhur's user avatar

guhurguhur

2,4601 gold badge21 silver badges33 bronze badges

EDIT Following the answer, we don’t need to install freeglut (SDK for windows) but installing mesa is enough.

You can install mesa an implementation of OpenGL. See indications in the answer.

Therefore, if you have an error such that:

Could NOT find OpenGL

Then, you want to install libgl1-mesa-dev. With debian-based system:

sudo apt-get install libgl1-mesa-dev

For an error, such that:

Could NOT find OpenGL (missing: EGL)

Then, you want to install libegl1-mesa-dev. With debian-based system:

sudo apt-get install libegl1-mesa-dev

answered Jul 1, 2015 at 20:27

guhur's user avatar

guhurguhur

2,4601 gold badge21 silver badges33 bronze badges

4

You don’t need any version of GLUT to satisfy a dependency on OpenGL. What you need is OpenGL headers and libraries. In Ubuntu they are installed with the libgl1-mesa-dev package.

To get the EGL build dependencies, replace the gl1 part of package name with egl1.

answered Dec 21, 2017 at 13:31

Ruslan's user avatar

RuslanRuslan

17.9k8 gold badges64 silver badges133 bronze badges

4

I have met the same problem, and however, none of the solutions proposed above helps me. In my case I found that there is no soft link for libGL.so, and so I just
go to /usr/lib/x86_64-linux-gnu, and set up the soft link manually ln -s libGL.so.1 libGL.so. By the way, I meet the problem when I work on Docker container.

answered Jan 27, 2022 at 22:02

feelfree's user avatar

feelfreefeelfree

11.1k19 gold badges94 silver badges165 bronze badges

Follow this tutorial to make sure drivers are installed and available for access:

answered Mar 23, 2022 at 22:48

Achint Sharma's user avatar

Hi, I have the same problem.
`ERROR: Command errored out with exit status 1:
command: /home/jiangcm/anaconda3/envs/pix2surf/bin/python -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘/tmp/pip-req-build-yf46gqeh/setup.py'»‘»‘; file='»‘»‘/tmp/pip-req-build-yf46gqeh/setup.py'»‘»‘;f=getattr(tokenize, ‘»‘»‘open'»‘»‘, open)(file);code=f.read().replace(‘»‘»‘rn'»‘»‘, ‘»‘»‘n'»‘»‘);f.close();exec(compile(code, file, ‘»‘»‘exec'»‘»‘))’ bdist_wheel -d /tmp/pip-wheel-mofswr5q
cwd: /tmp/pip-req-build-yf46gqeh/
Complete output (49 lines):
running bdist_wheel
running build
— The CXX compiler identification is GNU 5.4.0
— The CUDA compiler identification is NVIDIA 10.0.130
— Check for working CXX compiler: /usr/bin/c++
— Check for working CXX compiler: /usr/bin/c++ — works
— Detecting CXX compiler ABI info
— Detecting CXX compiler ABI info — done
— Detecting CXX compile features
— Detecting CXX compile features — done
— Check for working CUDA compiler: /usr/local/cuda-10.0/bin/nvcc
— Check for working CUDA compiler: /usr/local/cuda-10.0/bin/nvcc — works
— Detecting CUDA compiler ABI info
— Detecting CUDA compiler ABI info — done
CMake Error at /opt/cmake-3.15.7/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find OpenGL (missing: OPENGL_opengl_LIBRARY)
Call Stack (most recent call first):
/opt/cmake-3.15.7/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/opt/cmake-3.15.7/share/cmake-3.15/Modules/FindOpenGL.cmake:397 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:5 (find_package)

— Configuring incomplete, errors occurred!
See also «/tmp/pip-req-build-yf46gqeh/build/CMakeFiles/CMakeOutput.log».
Traceback (most recent call last):
File «», line 1, in
File «/tmp/pip-req-build-yf46gqeh/setup.py», line 50, in
‘Programming Language :: Python :: 3.7’,
File «/home/jiangcm/anaconda3/envs/pix2surf/lib/python3.7/site-packages/setuptools/init.py», line 144, in setup
return distutils.core.setup(**attrs)
File «/home/jiangcm/anaconda3/envs/pix2surf/lib/python3.7/distutils/core.py», line 148, in setup
dist.run_commands()
File «/home/jiangcm/anaconda3/envs/pix2surf/lib/python3.7/distutils/dist.py», line 966, in run_commands
self.run_command(cmd)
File «/home/jiangcm/anaconda3/envs/pix2surf/lib/python3.7/distutils/dist.py», line 985, in run_command
cmd_obj.run()
File «/home/jiangcm/anaconda3/envs/pix2surf/lib/python3.7/site-packages/wheel/bdist_wheel.py», line 223, in run
self.run_command(‘build’)
File «/home/jiangcm/anaconda3/envs/pix2surf/lib/python3.7/distutils/cmd.py», line 313, in run_command
self.distribution.run_command(command)
File «/home/jiangcm/anaconda3/envs/pix2surf/lib/python3.7/distutils/dist.py», line 985, in run_command
cmd_obj.run()
File «/tmp/pip-req-build-yf46gqeh/setup.py», line 24, in run
build_csrc()
File «/tmp/pip-req-build-yf46gqeh/setup.py», line 18, in build_csrc
subprocess.check_call([‘cmake’, os.path.join(base_path, ‘csrc’)], cwd=build_path)
File «/home/jiangcm/anaconda3/envs/pix2surf/lib/python3.7/subprocess.py», line 363, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘cmake’, ‘/tmp/pip-req-build-yf46gqeh/csrc’]’ returned non-zero exit status 1.

ERROR: Failed building wheel for dirt
I installed libglu1-mesa-dev, libgl1-mesa-dev and mesa-common-dev. But it doesn't work. The output ofls -l /usr/lib/*/GLas follows:lrwxrwxrwx 1 root root 18 Jun 15 2018 /usr/lib/x86_64-linux-gnu/libEGL.so -> mesa-egl/libEGL.so
lrwxrwxrwx 1 root root 21 Jun 15 2018 /usr/lib/x86_64-linux-gnu/libGLESv2.so -> mesa-egl/libGLESv2.so
lrwxrwxrwx 1 root root 19 Apr 3 11:29 /usr/lib/x86_64-linux-gnu/libGLEWmx.so.1.13 -> libGLEWmx.so.1.13.0
-rw-r—r— 1 root root 448632 Nov 10 2015 /usr/lib/x86_64-linux-gnu/libGLEWmx.so.1.13.0
lrwxrwxrwx 1 root root 17 Nov 10 2015 /usr/lib/x86_64-linux-gnu/libGLEW.so -> libGLEW.so.1.13.0
lrwxrwxrwx 1 root root 17 Apr 3 11:29 /usr/lib/x86_64-linux-gnu/libGLEW.so.1.13 -> libGLEW.so.1.13.0
-rw-r—r— 1 root root 514176 Nov 10 2015 /usr/lib/x86_64-linux-gnu/libGLEW.so.1.13.0
lrwxrwxrwx 1 root root 13 Jun 15 2018 /usr/lib/x86_64-linux-gnu/libGL.so -> mesa/libGL.so
-rw-r—r— 1 root root 911218 Oct 24 2015 /usr/lib/x86_64-linux-gnu/libGLU.a
lrwxrwxrwx 1 root root 15 Oct 24 2015 /usr/lib/x86_64-linux-gnu/libGLU.so -> libGLU.so.1.3.1
lrwxrwxrwx 1 root root 15 Apr 3 11:29 /usr/lib/x86_64-linux-gnu/libGLU.so.1 -> libGLU.so.1.3.1
-rw-r—r— 1 root root 453352 Oct 24 2015 /usr/lib/x86_64-linux-gnu/libGLU.so.1.3.1
lrwxrwxrwx 1 root root 21 Feb 10 03:42 /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5 -> libQt5OpenGL.so.5.5.1
lrwxrwxrwx 1 root root 21 Feb 10 03:42 /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5.5 -> libQt5OpenGL.so.5.5.1
-rw-r—r— 1 root root 362752 Feb 10 03:43 /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5.5.1
lrwxrwxrwx 1 root root 20 Apr 5 2016 /usr/lib/x86_64-linux-gnu/libQtOpenGL.so.4 -> libQtOpenGL.so.4.8.7
lrwxrwxrwx 1 root root 20 Apr 5 2016 /usr/lib/x86_64-linux-gnu/libQtOpenGL.so.4.8 -> libQtOpenGL.so.4.8.7
My cmake and OpenGL version :cmake version 3.15.7

CMake suite maintained and supported by Kitware (kitware.com/cmake).`

OpenGL version:
the manufacturer's name:VMware, Inc. Renderer identifier:llvmpipe (LLVM 6.0, 256 bits) Version of OpenGL:3.0 Mesa 18.0.5 Version of OGLU:1.3

You can actually partly thank ChatGPT for this, as I was also stumped.

  1. Verify that you’ve got the needed .so files, and find the path to them
find /usr -name 'libGL.so'
# in my case, on a raspberry pi I get
# /usr/lib/aarch64-linux-gnu/libGL.so
  1. I believe you can either modify the CMakeLists.txt or change the commandline arguments for cmake.

    If you edit the cmake, add these two lines somewhere near the top.
    NOTE: the var names here are slightly different than the error message (but it still fixes the problem, at least for me)

set(OPENGL_gl_LIBRARY /usr/lib/x86_64-linux-gnu/libGL.so)
set(OPENGL_glx_LIBRARY /usr/lib/x86_64-linux-gnu/libGLX.so)
  1. If the cmake command still doesn’t work, you can try the following sanity check.
    If you’re using ssh, first reconnecting using
ssh -X blah_address 
# so that displays are enabled

Then (whether you’re on ssh or not) do

DISPLAY=:0
glxinfo | grep OpenGL

The output should look something like:

OpenGL vendor string: Broadcom
OpenGL renderer string: VC4 V3D 2.1
OpenGL version string: 2.1 Mesa 22.2.5
OpenGL shading language version string: 1.20
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 2.0 Mesa 22.2.5
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 1.0.16 

If it doesn’t, that means theres probably a problem with OpenGL itself, and is a seperate issue to go track down.

Arwenac

Gnoblar
Posts: 8
Joined: Thu Mar 27, 2014 8:28 pm

[SOLVED] Not finding OpenGl on Ubuntu

  • Quote

  • login to like this post

Hello,

For the last 2 days I have been trying to install Orge 1.8. I downloaded the source code and followed the wiki guide.
It builds without errors, as does the clean_ogre_cmake_project.
The problem that when I try to run the OgreApp it stops without giving an error.
After running in Debug mode I found that it cannot find the RenderSystem_GL library.
I was looking through the source and saw that it did not build the RenderSystem_GL library when running cmake.

— Could NOT find OpenGL (missing: OPENGL_gl_LIBRARY)

I already installed mesa-common-dev and I am able to run OpenGL demos like glxgears without a problem.
I also tried using the latest stable(1.9) build from the repository.

Because I don’t have much experience with editing Cmake files I didn’t want to change anything.
Upon searching I did find some of the same problems with windows but there they had to copy the dll file to the application folder. Since I could not find the same kind of .so file on my system I couldn’t try that.
Does anyone have an idea what I might be missing?

Btw I am running Ubuntu 13.10 with an ati radeon HD600G with the latest drivers.

Last edited by Arwenac on Mon Mar 31, 2014 8:23 pm, edited 1 time in total.

Arwenac

Gnoblar
Posts: 8
Joined: Thu Mar 27, 2014 8:28 pm

Re: Not finding OpenGl on Ubuntu

  • Quote

  • login to like this post

Post

by Arwenac » Fri Mar 28, 2014 10:37 am

When installing the package I get the following error:

Code: Select all

The following packages have unmet dependencies:
 libboost-date-time1.49-dev : Depends: libboost1.49-dev (= 1.49.0-4) but it is not going to be installed
                              Depends: libboost-serialization1.49-dev (= 1.49.0-4) but it is not going to be installed
 libboost-thread1.49-dev : Depends: libboost1.49-dev (= 1.49.0-4) but it is not going to be installed
E: Build-dependencies for ogre could not be satisfied.

User avatar

Herb

Orc
Posts: 412
Joined: Thu Jun 04, 2009 3:21 am
Location: Kalamazoo,MI
x 38

Re: Not finding OpenGl on Ubuntu

  • Quote

  • login to like this post

Post

by Herb » Fri Mar 28, 2014 12:49 pm

Hmmm…. I’m running Ogre on Ubuntu 13.10 x64 without a problem. I built it from scratch using the deps listed in the wiki. I’m not sure how up-to-date the ogre apt-get entry is….especially for 13.10. I am running a nvidia card, so I’ve already install the nvidia apt-get libs.

As for the boost error, run this command

Code: Select all

sudo apt-get install libboost-all-dev

That should take care of installing all the boost libs. Looks like the system is angry that not all the right boost components are on there.

Arwenac

Gnoblar
Posts: 8
Joined: Thu Mar 27, 2014 8:28 pm

Re: Not finding OpenGl on Ubuntu

  • Quote

  • login to like this post

Post

by Arwenac » Sat Mar 29, 2014 9:24 pm

It still gives me

Code: Select all

The following packages have unmet dependencies:
 libboost-date-time1.49-dev : Depends: libboost1.49-dev (= 1.49.0-4) but it is not going to be installed
                              Depends: libboost-serialization1.49-dev (= 1.49.0-4) but it is not going to be installed
 libboost-thread1.49-dev : Depends: libboost1.49-dev (= 1.49.0-4) but it is not going to be installed
E: Build-dependencies for ogre could not be satisfied.

That is why I tried to build from source.

User avatar

Herb

Orc
Posts: 412
Joined: Thu Jun 04, 2009 3:21 am
Location: Kalamazoo,MI
x 38

Re: Not finding OpenGl on Ubuntu

  • Quote

  • login to like this post

Post

by Herb » Sat Mar 29, 2014 9:40 pm

I think you can do an apt-get remove libboost* to purge out all the existing boost and then do the new apt-get install libboost-all-dev. Maybe you have an old version installed or something.

Arwenac

Gnoblar
Posts: 8
Joined: Thu Mar 27, 2014 8:28 pm

Re: Not finding OpenGl on Ubuntu

  • Quote

  • login to like this post

Post

by Arwenac » Sat Mar 29, 2014 11:10 pm

Ok, I purged boost. Now it at least installs.

While running main in the up the clean cmake project I still get errors about boost:

Code: Select all

[ 50%] Building CXX object CMakeFiles/OgreApp.dir/BaseApplication.cpp.o
[100%] Building CXX object CMakeFiles/OgreApp.dir/TutorialApplication.cpp.o
Linking CXX executable dist/bin/OgreApp
/usr/bin/ld: warning: libboost_thread.so.1.53.0, needed by /usr/local/lib/libOgreMain.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libboost_system.so.1.53.0, needed by /usr/local/lib/libOgreMain.so, not found (try using -rpath or -rpath-link)
/usr/local/lib/libOgreMain.so: undefined reference to `boost::this_thread::interruption_point()'
/usr/local/lib/libOgreMain.so: undefined reference to `boost::thread::native_handle()'
/usr/local/lib/libOgreMain.so: undefined reference to `boost::detail::get_tss_data(void const*)'
/usr/local/lib/libOgreMain.so: undefined reference to `boost::this_thread::disable_interruption::~disable_interruption()'
/usr/local/lib/libOgreMain.so: undefined reference to `typeinfo for boost::detail::thread_data_base'
/usr/local/lib/libOgreMain.so: undefined reference to `boost::detail::get_current_thread_data()'
/usr/local/lib/libOgreMain.so: undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
/usr/local/lib/libOgreMain.so: undefined reference to `boost::thread::detach()'
/usr/local/lib/libOgreMain.so: undefined reference to `boost::system::system_category()'
/usr/local/lib/libOgreMain.so: undefined reference to `boost::thread::hardware_concurrency()'
/usr/local/lib/libOgreMain.so: undefined reference to `boost::thread::join_noexcept()'
/usr/local/lib/libOgreMain.so: undefined reference to `boost::system::generic_category()'
/usr/local/lib/libOgreMain.so: undefined reference to `boost::thread::start_thread_noexcept()'
/usr/local/lib/libOgreMain.so: undefined reference to `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)'
/usr/local/lib/libOgreMain.so: undefined reference to `vtable for boost::detail::thread_data_base'
/usr/local/lib/libOgreMain.so: undefined reference to `boost::this_thread::disable_interruption::disable_interruption()'
collect2: error: ld returned 1 exit status
make[2]: *** [dist/bin/OgreApp] Error 1
make[1]: *** [CMakeFiles/OgreApp.dir/all] Error 2
make: *** [all] Error 2

I do have «libboost_thread.so.1.49.0.
It seems like the ogre neesd boost 1.49 to install but 1.53 to make the cmake project http://www.ogre3d.org/tikiwiki/tiki-ind … With+CMake

User avatar

Herb

Orc
Posts: 412
Joined: Thu Jun 04, 2009 3:21 am
Location: Kalamazoo,MI
x 38

Re: Not finding OpenGl on Ubuntu

  • Quote

  • login to like this post

Post

by Herb » Sun Mar 30, 2014 12:19 pm

The version of boost shouldn’t matter. This looks like it can’t find the libs to link to. The other thing you can just do is skip Boost entirely. apt-get cmake-curses-gui, then run ccmake instead of cmake in your ogre build directory. In there, set the threading level from 2 to 0 and clear the threading provider from boost to blank. Hit ‘c’ to reconfigure, and then ‘g’ to generate your new makefile. Give that a try, that should skip boost from even being used.

Arwenac

Gnoblar
Posts: 8
Joined: Thu Mar 27, 2014 8:28 pm

Re: Not finding OpenGl on Ubuntu

  • Quote

  • login to like this post

Post

by Arwenac » Sun Mar 30, 2014 9:49 pm

Ok I got the boost part kind of working. I had two conflicting boost versions installed at the same time. Not sure how I managed to do that.
So now when I run make it has a linker problem:

Code: Select all

[ 50%] Building CXX object CMakeFiles/OgreApp.dir/BaseApplication.cpp.o
[100%] Building CXX object CMakeFiles/OgreApp.dir/TutorialApplication.cpp.o
Linking CXX executable dist/bin/OgreApp
/usr/bin/ld: CMakeFiles/OgreApp.dir/BaseApplication.cpp.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
/usr/local/lib/libboost_system.so.1.53.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [dist/bin/OgreApp] Error 1
make[1]: *** [CMakeFiles/OgreApp.dir/all] Error 2
make: *** [all] Error 2

Upon searching I found it has to do with the order of linking libraries. But link.txt does not link to boost so I am not sure where I should change it.

Arwenac

Gnoblar
Posts: 8
Joined: Thu Mar 27, 2014 8:28 pm

Re: Not finding OpenGl on Ubuntu

  • Quote

  • login to like this post

Post

by Arwenac » Mon Mar 31, 2014 8:13 pm

I added -lboost_system in the link file so now the «Setting up an application» builds normally.
After debugging the project it still gave the error as listed in my first post

Code: Select all

-- Could NOT find OpenGL (missing: OPENGL_gl_LIBRARY)

.
Apparently it could not find libGl.so file. It wasn’t looking in the right directory but I couldn’t find where I should add the path. So I copied it to /usr/lib.
After that it could find openGl when building from source.

I can also run the clean_ogre_app with the opengl renderer :D

So it appears that it works now!
The only question I have left is that I lose my mouse and keyboard input when running the app. And is it correct that is is just a black screen with the logo and FPS counter?

Thank you so much for putting up with my noob questions XD

Решил, значит, зайти в Counter-Strike Global Offensive, чтобы посмотреть демо из Overwatch и причаститься к наказанию адептов WH, AIMbot и прочей нечисти, заодно и отдохнуть от работы.

Разумеется, перезагружаться в Windows для такой цели не стоит, поэтому спокойно запускаю Steam для Linux, жму на кнопку запуска,

и вот незадача — вылезает бессовестное окошко с заголовком:

Could not find required OpenGL entry point ‘glGetError’! Either your video card is unsupported, or your OpenGL driver needs to be updated.

При попытке запустить скрипта CS:GO напрямую, получаю вот такое:

ivan@pc ~ $ /SteamLibrary/steamapps/common/Counter-Strike Global Offensive/csgo.sh
SDL video target is ‘x11’
SDL failed to create GL compatibility profile (whichProfile=0!
PROBLEM: You appear to have OpenGL 0.0.0, but we need at least 2.0.0!
Could not find required OpenGL entry point ‘glGetError’! Either your video card is unsupported, or your OpenGL driver needs to be updated
/SteamLibrary/steamapps/common/Counter-Strike Global Offensive/csgo.sh: line 57: 17727 Ошибка сегментирования                   ${DEBUGGER} «${GAMEROOT}»/${GAMEEXE} «$@

Что странно — другие установленные игры (Portal 2, The Long Dark)
запускаются беспрекословно. В «Сведениях о системе» Steam (в разделе
«Справка») указано, в частности:

Версия драйвера:  4.5.0 NVIDIA 361.28

Версия OpenGL: 4.5

Т.е. Steam-таки в курсе версии OpenGL.
Оказывается, разработчики Nvidia добавили GLVND в драйверах версии 361.28, что и приводит к такому сюрпризу, поскольку в CS:GO для Linux Valve тоже что-то намутили.

Следовательно, нужно как-то нивелировать это нововведение.
И одним из способов (самым простым) будет добавление в опции запуска игры (правый клик по игре в библиотеке Steam — Свойства — Установить параметры запуска) вот такую строку:

__GLVND_DISALLOW_PATCHING=1 %command%

После этого всё работает как ожидалось. Как всегда, способ, может и не самый изящный, но работает.

Like this post? Please share to your friends:
  • Ошибка could not find any compatible direct3d
  • Ошибка could not establish connection to steam servers
  • Ошибка could not create tray icon
  • Ошибка could not create the java virtual machine
  • Ошибка could not create d3d11 device