Important: Please read the Qt Code of Conduct -

Sigh, okay, I suck, I need help with Qt for iOS and packaging my framework

  • This is on macOS High Sierra, latest XCode, ios 12, Qt 5.11.1

    I have seen bits and pieces of info about using a 3rd party (mine) framework with a Qt ios app all over the place and I'm just lost at this point.

    I have successfully built a Qt framework library that builds for macOS and iOS.

    I have a test app that runs unit tests against this framework.

    I am using Qt Creator to build both the framework, and the client test application.

    On macOS, everything works fine - I build my framework, I package my framework and stick in a directory for use by client applications. My client application builds against the framework that was copied to the new location. The client application runs well and all tests pass.

    Qt Creator does not appear to be bundling the framework with the mac app, but I never bothered to check at this point because I wasn't running into problems. This means I don't know if macdeployqt would package the framework or not (that's a problem for another day.)

    On iOS, I can build and link against the framework just fine, but - of course - because I don't know how to package my framework to be carried along/embedded in the test client's app bundle - I get a crash with "image not found:" as the dynamic loader tries to find it.

    From what I've been able to read/find, I'm supposed to - at some point - copy my framework into the app bundle - and probably modify the rpath on the test client so that it looks inside the bundle for the framework - but, I have no idea where the app bundle is...

    Is this something that does't actually exist when using Qt Creator and it does some behind the scenes voodoo? That seems odd as example iOS apps from Qt (like 'clocks') run fine on my iOS device, but I can 't find the actual app bundle for that example anywhere either - I presume some temp location is getting it, then it's being pushed onto the device and the temp location gets wiped...?

    Anyhow, clearly Qt is embedding its components into the app bundle - otherwise it wouldn't find the Qt components at runtime.

    So, presuming I am supposed to copy my framework into my iOS app bundle - where is that app bundle?

    Am I making the mistake of relying on Qt Creator when I should be using qmake and make directly and THEN calling macdeployqt (I presume this is for iOS as well?) and THEN copying my framework into the resulting bundle, then modifying pathing?

    LOL - sorry, I know this is a lot, but this is really kicking my rear - I don't know what Qt Creator is doing behind the scenes (maybe nothing) - but I'm a relative noobie to iOS development in general, although I've got lots of Qt application development experience - and I absolutely LOVE Qt, and want to use it for this project, but if I can't get this running in a few days I'll have to move to an XCode based approach (ugh...)

    Thanks for reading :)

  • Lifetime Qt Champion


    Due to historical Apple platform constraints, Qt for iOS is a static build. The original rule has been since relaxed but IIRC, the build stayed the same as the tooling was not yet ready to help people deploy frameworks easily. As for your current issue, you should maybe consider building your library statically on iOS so you don't have to worry for bundle deployment.

    You should also take a look on these platform notes especially the Creating Frameworks part talking about QMAKE_BUNDLE_DATA.

  • The good thing is that Qt for iOS is still static, so I don't have to worry about the Qt dependencies, and for the test client - I've simply replaced it with an XCode based test client (I have to wrap the classes I'm exposing in the framework with Objective-C and Objective-C++ anyhow) and doing my unit tests at that level.

    I suspect that, as you allude to above, the Qt team moves towards the issues of greatest needs first, and I suspect supporting "embedding custom frameworks into iOS apps" via qmake and Qt Creator is possibly on the list - but not at the top ;).

    I may tinker with qmake later and try to figure out when/where/how I could accomplish this with scripting during the build lifecycle - if I figure it out I'll update here. Marking solved.

    Thanks :)

Log in to reply