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

Investigate and add main entry point for iOS when linking applications

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 6.0
    • Build System: CMake

    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

              alexandru.croitor Alexandru Croitor
              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