Index: /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.cpp
===================================================================
--- /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.cpp	(revision 76247)
+++ /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.cpp	(revision 76248)
@@ -81,5 +81,4 @@
 
 #else
-// # define OGLGETPROCADDRESS(x)   glXGetProcAddress((const GLubyte *)x)
 # define OGLGETPROCADDRESS MyGLXGetProcAddress
 static void *MyGLXGetProcAddress(const char *pszSymbol)
@@ -90,34 +89,37 @@
     if (s_hGL == NULL)
     {
-        rc = RTLdrLoadSystem("libGL.so", /* fNoUnload = */ true, &s_hGL);
+        static const char s_szLibGL[] = "libGL.so.1";
+        rc = RTLdrLoadEx(s_szLibGL, &s_hGL, RTLDRLOAD_FLAGS_GLOBAL | RTLDRLOAD_FLAGS_NO_UNLOAD, NULL);
         if (RT_FAILURE(rc))
-           s_hGL = NULL;
-    }
-
-    typedef void(*)() (* PFNGLXGETPROCADDRESS)(const GLubyte * procName);
+        {
+            LogRel(("VMSVGA3d: failed to load %s: %Rrc\n", s_szLibGL, rc));
+            s_hGL = NULL;
+            return NULL;
+        }
+    }
+
+    typedef void * (* PFNGLXGETPROCADDRESS)(const GLubyte * procName);
     static PFNGLXGETPROCADDRESS s_glXGetProcAddress = NULL;
     if (s_glXGetProcAddress == NULL)
     {
-        if (s_hGL != NULL)
+        rc = RTLdrGetSymbol(s_hGL, "glXGetProcAddress", (void **)&s_glXGetProcAddress);
+        if (RT_FAILURE(rc))
         {
-            rc = RTLdrGetSymbol(s_hGL, "glXGetProcAddress", (void **)&s_glXGetProcAddress);
-            if (RT_FAILURE(rc))
-               s_glXGetProcAddress = NULL;
+            LogRel(("VMSVGA3d: failed to get glXGetProcAddress: %Rrc\n", rc));
+            s_glXGetProcAddress = NULL;
+            return NULL;
         }
     }
 
-    if (s_glXGetProcAddress)
-    {
-        void *p = glXGetProcAddress((const GLubyte *)pszSymbol);
-        if (RT_VALID_PTR(p))
-            return p;
-
-        /* Might be an exported symbol. */
-        rc = RTLdrGetSymbol(s_hGL, pszSymbol, (void **)&p);
-        if (RT_SUCCESS(rc))
-            return p;
-    }
-
-    return 0;
+    void *p = s_glXGetProcAddress((const GLubyte *)pszSymbol);
+    if (RT_VALID_PTR(p))
+        return p;
+
+    /* Might be an exported symbol. */
+    rc = RTLdrGetSymbol(s_hGL, pszSymbol, (void **)&p);
+    if (RT_SUCCESS(rc))
+        return p;
+
+    return NULL;
 }
 #endif
