Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-87060

Investigate and add main entry point for iOS when linking applications

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 6.0
    • Fix Version/s: None
    • Component/s: Build System: CMake
    • Labels:

      Description

      In qmake in features/uikit/qt.prf there are these 2 pieces of code

      !bitcode {
              # By marking qt_registerPlatformPlugin as undefined, we ensure that
              # the plugin.o translation unit is considered for inclusion in
              # the final binary, which in turn ensures that the plugin's
              # static initializer is included and run.
              QMAKE_LFLAGS += -u _qt_registerPlatformPlugin
          }
      
          !no_main_wrapper {
              # The LC_MAIN load command available in iOS 6.0 and above allows dyld to
              # directly call the entrypoint instead of going through _start in crt.o.
              # Passing -e to the linker changes the entrypoint from _main to our custom
              # wrapper that calls UIApplicationMain and dispatches back to main() once
              # the application has started up and is ready to initialize QApplication.
              QMAKE_LFLAGS += -Wl,-e,_qt_main_wrapper
          }
      

      These ensure that a built iOS application loads a different entry point than main (_qt_main_wrapper). Otherwise launching the application will crash.

      We should investigate how we can achieve the same for a CMake-based iOS application.

      One thing to consider is to either rename or hijack the Qt6::WinMain target.

        Attachments

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              alexandru.croitor Alexandru Croitor
              Reporter:
              alexandru.croitor Alexandru Croitor
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes