undefined symbols _main when building a shared lib on iOS with Qt::StateMachine
-
I'm migrating our project from Qt5.15.0 to Qt 6.3.0 on iOS. This is the linked issue I've got:
Undefined symbols for architecture arm64: "_main", referenced from: user_main_trampoline() in libqios.a(qioseventdispatcher.mm.o)
After a while, I realized that the root cause is I'm building a shared lib which links to
Qt::StateMachine
whileQt::StateMachine
depends onQt::Gui
andQt::Gui
requires a definemain()
method. I tried to remove this dependency in some cmake files inside<qt_install_path>/6.3.0/ios/lib/cmake/Qt6StateMachine/
folder, my build succeeds now.
I found out this is an external featureqeventtransition
ofQt::StateMachine
https://code.qt.io/cgit/qt/qtscxml.git/tree/src/statemachine/CMakeLists.txt?h=6.3.0#n34 then I hope that there is an official way to disable this feature then the dependency betweenStateMachine
andGui
is no longer required.
Any help to bypass this problem? Thanks!