vaiorabbit / ruby-opengl

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

Fix libglfw.so name on linux #34

Closed spuyet closed 2 years ago

spuyet commented 2 years ago

I just tested on linux and the lib version must be appended to be loaded correctly, libglfw.so.3 is a symlink of the latest version available on the system:

$ ls -la /usr/lib/x86_64-linux-gnu/libglfw*
lrwxrwxrwx 1 root root     14 janv. 30 04:54 /usr/lib/x86_64-linux-gnu/libglfw.so.3 -> libglfw.so.3.3
-rw-r--r-- 1 root root 282616 janv. 30 04:54 /usr/lib/x86_64-linux-gnu/libglfw.so.3.3

You can see here that with the right name, the lib is loaded:

irb(main):005:0> Fiddle.dlopen("libglfw.so")
/home/sebastien/.rbenv/versions/3.1.2/lib/ruby/3.1.0/fiddle.rb:61:in `initialize': libglfw.so: cannot open shared object file: No such file or directory (Fiddle::DLError)
        from /home/sebastien/.rbenv/versions/3.1.2/lib/ruby/3.1.0/fiddle.rb:61:in `new'         
        from /home/sebastien/.rbenv/versions/3.1.2/lib/ruby/3.1.0/fiddle.rb:61:in `dlopen'
        from (irb):5:in `<main>'                        
        from /home/sebastien/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /home/sebastien/.rbenv/versions/3.1.2/bin/irb:25:in `load'
        from /home/sebastien/.rbenv/versions/3.1.2/bin/irb:25:in `<main>'

irb(main):006:0> Fiddle.dlopen("libglfw.so.3")
=> #<Fiddle::Handle:0x00007f057c99e840>
spuyet commented 2 years ago

I've also removed the "not tested" comment for opengl as it works fine: https://youtu.be/P55pcV9ZBIs