libGL.so.1 problem when running with bumblebee

I’ve been using Linux Graphics Debugger for a long time without bumblebee, and didn’t had any problems, but due to vsync problems I needed to install bumblebee. Now with bumblebee it won’t work anymore. When I run my OpenGL application within Linux Graphics Debugger, I get this error:

NGD: Starting GTI initialization...
Found libGL.so.1 but it does not appear to be an Nvidia driver library.
NGD: Fatal Error: Cannot find any system GLX library.

No matter if I run debugger with optirun or without. I checked with ldd command what libraries debugger uses, and it says, that it uses mesa’s libGL.so.1. If I run ldd with optirun it shows that it uses primus library, but it never shows nvidia’s library.

If I check with pmap which library is being used while debugger is running, then it says it uses nvidia’s libGL.so and two another (probably primus or mesa). I can identify that it uses nvidia’s libGL, because it’s the only named with driver version at the end: libGL.so.352.63.

So even it runs with nvidia libGL library, why it says that found library does not appear to be Nvidia driver library? Is there anyway to workaround this problem without uninstalling bumblebee?

I have the exact same problem

I just installed the driver as available in my Ubuntu 15.10 repository, primus is being used by default to swap between Intel and Nvidia, and requires a full X restart (logging out and logging in).

For some reason the ~/.tgd/libs/libNvidia_gfx_debugger.so fails to load/bind to the correct libGL and find the correct GLX

I cannot simply disable primus, its required to get access to the nvidia GPU on the laptop, and I think it even ships with the new drivers?