Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Main function required when compiling shared library for iOS?
Forum Updated to NodeBB v4.3 + New Features

Main function required when compiling shared library for iOS?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
5 Posts 4 Posters 2.2k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    ebraley
    wrote on last edited by ebraley
    #1

    I have a project made of 3 subdirectories which are built in order as follows

    • Static library (uses QT)
    • Shared library (also uses QT)
    • QML Application

    The static library is used by the shared library which is used by the QML Application

    Everything builds perfectly fine and runs on Android and MacOS. However, when I go to build for iOS I get the following error when compiling the shared library:

    Undefined symbols for architecture armv7:
      "_main", referenced from:
          user_main_trampoline() in libqios_debug.a(qioseventdispatcher.o)
         (maybe you meant: _jinit_d_main_controller, _jinit_c_main_controller , _qt_main_wrapper )
    

    The static library builds fine and if I change the shared library to being static, it also compiles fine, but ends up being far too large for practical use and it is a project constraint that this library remain a shared library.

    All I can really assume is that the shared library is being compiled as if it were an application? I'm under this presumption because changing the library from static to shared causes QT Creator to add a run option for the shared library, i.e "Run [Shared Library] on iOS Simulator." That and the fact that the error above means a main function wasn't found (it's a shared library, duh).

    I am using QT 5.9 and QT Creator 4.3.0, Xcode updated this morning.

    Is this a bug or a limitation of QT?

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by dheerendra
      #2

      iOS uses static library only. So you may need to use static library. You can look at my post on this plugin stuff. I heard u can use shared plugin qt 5.9 and have no used it.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      4
      • A Offline
        A Offline
        ambershark
        wrote on last edited by
        #3

        I came here to say exactly what @dheerendra said, lol.

        It's not a bug or limitation of Qt but more a limitation of iOS which does not allow shared objects or dylibs as apple calls them.

        My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

        1 Reply Last reply
        2
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          To add to my fellow developer (and as it's explained in the thread @dheerendra is referring to). The current build is static as per the old rules of the Apple store, this rule has now been relaxed so one possibility would be to re-build Qt 5.9 dynamically yourself however, as explained in the link I posted in @dheerendra thread, full tooling support is not completely there yet so you might how some more work to do to release your application.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2
          • E Offline
            E Offline
            ebraley
            wrote on last edited by
            #5

            Yeah, I figured that since Apple has permitted shared libraries since iOS 8.0 in late 2014 that QT might support their use.

            Unfortunately for me, after waiting quite a bit for QT to partially compile as a shared library I discovered that this doesn't even work for now. 5.9, as released can't be compiled as a shared library for iOS because of the issues in this report.

            https://bugreports.qt.io/browse/QTBUG-61489

            It looks like this won't officially be working until the release of 5.9.1, which is marked for June, so hopefully we'll see a release in the next week.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved