Important: Please read the Qt Code of Conduct -

Qt, QGLWidget and Xcode 11 = fail?

  • Hi all. So we have this app. It has a QGLWidget rendering on a separate thread for video. This has been working fine through Mac OS Mojave.
    Here comes Catalina. We take our latest build r2330, it was build in Xcode 10. It still work fine in Catalina. Somewhere along the way Xcode updated to 11 on both my Mojave dev machine and Catalina (bootcamp). I can still compile and run it on Mojave. However, if I compile run it in Catalina, or even export and package it on Mojave, then run in Catalina, I get this GLContext crash (EXC_BAD_INSTRUCTION) when the thread tries to start.
    I realize that OpenGL is now completely removed from Catalina but it's my understanding Qt has taken care of this (app is based on 5.12.0 BTW, I have also tried 5.13.1) and that makes sense since older versions (2330 built on Xcode 10 and even our last major version based on 5.9.6 run just fine on Catalina.
    So, the only factor that has changed here is Xcode (and I assume that means Base SDK!)
    I don't get it. I'm at a loss here. Why?! We even tried opening a technical support ticket with Apple as this still feels like early Catalina problems (we ran through a LOT of them turning out to be Apple) and they seem to want to push this back on Qt, so I'm putting this her pin case anyone has ideas. Still looking for the button to attach my crash report. ;)

  • I have a similar crash with a Qt3DQuickWindow. Before Catalina this was reported as a warning but now it causes a crash:

    Crashed Thread: 44 Qt3DRender::Render::RenderThread

    Exception Note: EXC_CORPSE_NOTIFY

    Application Specific Information:
    -[NSOpenGLContext setView:] must be called from the main thread.

    I'm guessing this is the same problem right?

  • Lifetime Qt Champion


    I would rather bring this to the internet mailing list. You'll find there Qt's developers/maintainers. This forum is more user oriented.

    As for the crash report, you should check the bug report system.

  • Do you have to use XCode? Have you tried other OpenGL libraries and a different C++ compiler?

  • Lifetime Qt Champion

    @CroCo Xcode is the only officially supported compiler on macOS.

  • @SGaist what do you mean? Other C++ compilers can't guarantee same performance, I'm talking about g++.

  • Lifetime Qt Champion

    I mean that Qt is built and tested only with Xcode as it is the only officially supported compiler on macOS.

    Other compilers may work, however, they are not supported.

  • But this is "Qt Development" forum no? I don't know that it's a bug, I think it's Apple and was asking in case there was just a config or some other thing I had to do to get around it.
    I do have an update. The problem is the new SDK. If I go back to a carbon copy backup I have with Xcode 10 (therefore 10.14 SDK) and build, I can run the built package in Catalina too. If I build on Xcode 11 (so SDK 10.15) it builds and runs on Mojave, but has the crash on Catalina. The problem appears to be a bug in SDK 10.15, or a compatibility issue between Qt and SDK 10.15

  • I am facing the same problem right now. We use Qt 5.9.1 on MacOS and just upgraded from Mojave to Catalina (and therefore Xcode 10.3 to Xcode 11.3.1) and now our software doesn't start anymore, crashing at the following call stack:

    1 -[NSOpenGLContext setView:]                      (x86_64) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit                  0x7fff35db5acc 
    2 -[QNSView setQCocoaGLContext:]                   (x86_64) /Users/Shared/Qt5.9.1/5.9.1/clang_64/plugins/platforms/libqcocoa.dylib         0x10fb4ccb7    
    3 QCocoaGLContext::makeCurrent(QPlatformSurface *) (x86_64) /Users/Shared/Qt5.9.1/5.9.1/clang_64/plugins/platforms/libqcocoa.dylib         0x10fb80fdc    
    4 QOpenGLContext::makeCurrent(QSurface *)          (x86_64) /Users/Shared/Qt5.9.1/5.9.1/clang_64/lib/QtGui.framework/Versions/5/QtGui      0x106917b5c    
    5 QSGRenderThread::run()                           (x86_64) /Users/Shared/Qt5.9.1/5.9.1/clang_64/lib/QtQuick.framework/Versions/5/QtQuick  0x1074d006d    
    6 QThreadPrivate::start(void *)                    (x86_64) /Users/Shared/Qt5.9.1/5.9.1/clang_64/lib/QtCore.framework/Versions/5/QtCore    0x10634ae7f    
    7 _pthread_start                                   (x86_64) /usr/lib/system/libsystem_pthread.dylib                                        0x7fff700f5e65 
    8 thread_start                                     (x86_64) /usr/lib/system/libsystem_pthread.dylib                                        0x7fff700f183b 

    This is the main message of the MacOS crash report:

    System Integrity Protection: enabledCrashed Thread:        9  QSGRenderThreadException Type:        EXC_BAD_INSTRUCTION (SIGILL)
    Exception Codes:       0x0000000000000001, 0x0000000000000000
    Exception Note:        EXC_CORPSE_NOTIFYTermination Signal:    Illegal instruction: 4
    Termination Reason:    Namespace SIGNAL, Code 0x4
    Terminating Process:   exc handler [74166]Application Specific Information:
    -[NSOpenGLContext setView:] must be called from the main thread.

    Is there any news about this problem?

    @wesblake @kuroki How did you solve the problem?

  • Lifetime Qt Champion

    @benjaminwelle Did you try with more recent Qt version?

  • I also have this problem. App running fine on Windows, just now got it building on Mac, using Qt 5.12.8, and have the same exception from Qt3DRender::Renderer::doRender() -> [NSOpenGLSetContext setView] -> exception.

  • Lifetime Qt Champion

    Are you sure 5.12 is supported?
    Catalina is 10.15 ?

    alt text

Log in to reply