qtruntime-errorwebassemblyemscripten

Assertion Failed: Compiler flags to be set for a linker in qmake file of qt, so that we won't get Uncaught Runtime error , after main() function exits


I am trying to expose a UI (built using qt) on the browser, using Emscripten. Compiled dependencies, and could able to link those to the UI, it got compiled successfully without any errors, but while executing I am getting the error

Uncaught RuntimeError: abort(Assertion failed: the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)) at Error

So I have explicitly provided NO_EXIT_RUNTIME =1 to the linker flag, but still the error persists, How to resolve this? There is no issue with the UI that I built, as I was getting the same error for inbuilt bar chart example provided by qt. In my case, nothing is shown on the browser, but this error is present in the console. I am using threads in my UI, I handled them properly using web workers.

The error, is it due to the emrun which qt was using to server the page, is it overriding the EXIT_RUNTIME? If yes, how can we resolve that? The moment my main function initialization is done getting this error, at the step return app.exec(), where app is an abject of QApplication.

Qt version - Qt5.15, Emscripten version 1.39.8 (compatible with Qt version), using Chrome as the Browser.

  1. What flags do I need to set, in order to resolve this? (I have played with Assertion,asyncify, EXIT_RUNTIME, but could not able to resolve the error.
  2. I have executed the makefile using terminal, still I am getting the same error.

Why the error is occurring and how to resolve that error?


Solution

  • I have resolved this. The error was in my qt code , so it was showing error related to "QApplication" module, so it is unable to start Qt eventloop, just after the moment main function exits, when return is hit. We are getting that error showing, uncaught runtime.