vaiorabbit / ruby-opengl

Yet another OpenGL wrapper for Ruby (and wrapper code generator).
Other
86 stars 11 forks source link

Error running with proprietary nvidia drivers in linux #25

Closed danini-the-panini closed 8 years ago

danini-the-panini commented 8 years ago

I am running Ubuntu 16.04 with a ASUS GTX670 DirectCU II, using drivers from package nvidia-361, and I am running into the following issue on both version 1.6.0 and the master branch:

$ LIBGL_DEBUG=verbose ruby ./report_env.rb 
libGL: screen 0 does not appear to be DRI2 capable
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
libGL: Can't open configuration file /home/daniel/.drirc: No such file or directory.
libGL: Can't open configuration file /home/daniel/.drirc: No such file or directory.
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
Failed to create the OpenGL context.

However, running glxgears works fine, and I have been playing the steam version of ARK with no issues.

It looks like the opengl bindings are trying to load a software rasterizer instead of the nvidia drivers.

I checked, and I definitely have a DRI device:

$ ls -l /dev/dri
total 0
crw-rw----+ 1 root video 226,   0 Aug 27 08:32 card0
crw-rw----+ 1 root video 226,   1 Aug 27 08:32 card1
crw-rw----  1 root video 226,  64 Aug 27 08:32 controlD64
crw-rw----+ 1 root video 226, 128 Aug 27 08:32 renderD128

glxinfo reports the following:

OpenGL version string: 4.5.0 NVIDIA 361.42
OpenGL shading language version string: 4.50 NVIDIA

Ruby version:

ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]

I think it has something to do with loading 32-bit drivers (it seems I only have 64-bit drivers installed), but that doesn't make sense since Ruby has been compiled for 64-bit architecture.

I'm not sure if this is a problem with ruby-opengl or my system, but any assistance would be much appreciated.

danini-the-panini commented 8 years ago

UPDATE After playing around a bit, I found that manually passing in the location of the nvidia libGL.so fixed the problem,

OpenGL.load_lib('libGL.so', '/usr/lib/nvidia-361')
$ ruby report_env.rb
Version: 4.5.0 NVIDIA 361.42
Extensions:
...

So, the problem is now that ruby-opengl does not seem to automatically pick up the correct location of libGL.so like other opengl programs. Perhaps special consideration needs to be made for proprietary drivers?

vaiorabbit commented 8 years ago

The method 'load_lib' does not provide any automatic search feature. Users must give 'load_lib' appropriate path strings manually.

And, sorry, I don't use Linux as a desktop environment now and can't examine your problem. This might help:

danini-the-panini commented 8 years ago

No problem, thank you for clearing that up for me. :+1: