From 9287447a67e8381e6cfd4bb2b143f522bb7969b1 Mon Sep 17 00:00:00 2001 From: Lucas Wang Date: Sun, 1 Mar 2020 10:55:32 +0800 Subject: macOS: Ensure GL symbols are resolved from the OpenGL framework MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The app or its dependencies may link against X11's libGL.1.dylib from XQuarz, to support GLX on macOS. Doing so may place libGL earlier in the load order than Apple's OpenGL framework, which results in dlsym picking symbols from libGL when using the RTLD_DEFAULT lookup strategy, breaking Qt's OpenGL support in various ways: QOpenGLShaderProgram: could not create shader program Warning: "" failed to compile! To fix this we use RTLD_NEXT, which looks up the symbol in dependency order of the image that called dlsym, rather than the global load order. Change-Id: I1ec3055a4ab0bb96566c7e196d301b30785f2dc0 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qcocoaglcontext.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index 6db4bdb9fd..ccb6e20071 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -554,7 +554,7 @@ NSOpenGLContext *QCocoaGLContext::nativeContext() const QFunctionPointer QCocoaGLContext::getProcAddress(const char *procName) { - return (QFunctionPointer)dlsym(RTLD_DEFAULT, procName); + return (QFunctionPointer)dlsym(RTLD_NEXT, procName); } #ifndef QT_NO_DEBUG_STREAM -- cgit v1.2.3