Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSX: "QWidget: Must construct a QApplication before a QWidget" #379

Closed
ardnaxelarak opened this issue Nov 9, 2020 · 2 comments · Fixed by #427 or #428
Closed

OSX: "QWidget: Must construct a QApplication before a QWidget" #379

ardnaxelarak opened this issue Nov 9, 2020 · 2 comments · Fixed by #427 or #428
Labels
bug Bugs such as crashing, freezing, broken functionality, etc.

Comments

@ardnaxelarak
Copy link

Description

I have encountered this error both in attempting to bundle a built-from-source OBS app with StreamFX included, and after building StreamFX standalone and adding to my regularly-installed OBS (25.0.8).

In both cases, the program crashes without any indication of what is wrong if I launch the app normally. If I run the app from the terminal (via OBS.app/Contents/MacOS/obs), the program crashes, with the last output being:

info: [StreamFX] Loading Version 0.9.0.28-a0ce2960
QApplication::installTranslator: Please instantiate the QApplication object first
QWidget: Must construct a QApplication before a QWidget

I tried mainly with qt version 5.14.1, but also just ran brew upgrade qt to install 5.15.1 and it still failed.

Building OBS from source

To build OBS from source, I followed the directions from Building From Source, adding the submodule and editing CMakeLists.txt in UI/frontend-plugins.
Then, per the directions for building OBS from source, I ran cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 -DDISABLE_PYTHON=ON .. from the build directory. At this point I ran make and encountered #316, so I instead ran cmake -std=c++17 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DDISABLE_PYTHON=ON .. per my own research and the suggestions in that bug. This resulted in a successful make, and at this point I could launch obs from build/rundir/RelWithDebInfo/bin/ and things mostly worked.
(I say mostly--the two minor issues I encountered were that I could not interact with the menu bar as mtrpires mentioned in #323, and that some of the example shaders did not work. I can open separate issues for either or both of those issues if you feel they merit attention.)
So far, so good.
Then, again per the directions for building OBS from source I attempted to bundle OBS by running CI/full-build-macos.sh -s -b. At this point, I encountered ERROR during build step: bundle app. This seemed to be an issue with symlinks with copying Qt5 files in the full build script, so I added the -L flag to the offending cp command. (I assume this is entirely unrelated, but I mention it just in case.) This change made the bundle complete successfully.
At that point I noticed the crash when I tried to launch the newly-bundled OBS file, and running it in a terminal gave me the error above.

Building StreamFX standalone

This part of my attempt was pretty straightforward. I cloned the repo and ran

cmake -H. -B"build/flux" -G"Ninja" -DOBS_DOWNLOAD=ON -DCMAKE_PACKAGE_NAME=StreamFX -DCMAKE_PACKAGE_PREFIX="build/package" -DCMAKE_INSTALL_PREFIX="build/distrib" -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc
cmake --build "build/flux" --config RelWithDebInfo --target install

which both finished successfully. I copied build/distrib/plugins/StreamFX/bin/64bit/StreamFX.so to OBS.app/Contents/PlugIns, opened OBS, saw it crashed, ran from command line, and got the above error.

System Information

  • StreamFX Version: 0.9.0.28-a0ce2960
  • Operating System: macOS 10.15.7
  • Kernel Version: Darwin 19.6.0
  • CPU: Intel i7
  • GPU: Intel UHD Graphics 630
  • RAM: 16 GB
@Xaymar
Copy link
Owner

Xaymar commented Nov 9, 2020

Most likely caused by this line, which as you might see, is ran before OBS gives us the entire loaded event. This behavior seems to be the source of various weird behavior, so I will be changing this in the near future to do things after OBS has successfully loaded.

@Xaymar Xaymar added bug Bugs such as crashing, freezing, broken functionality, etc. os:mac labels Nov 9, 2020
@Xaymar
Copy link
Owner

Xaymar commented Jan 21, 2021

Should be fixed by #428, please report back if it is not fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs such as crashing, freezing, broken functionality, etc.
Projects
None yet
2 participants