Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt54, using QCA for iOS Emulator and Device, cannot link QCA libraries for iOS platforms
Hello forum members,
Having trouble building latest QCA sources with the 5.4 Qt/iOS environment. Spent couple of days browsing the forums, reading and googling to get the package compiled and linked, but no luck. Also not finding much references to this on the web, there are some words of encouragement, but still I doubt if QCA is even supported for the iOS platform?
Running this on OS X 10.9.5, latest XCode, QCA cloned from git://anongit.kde.org/qca.git, Qt 5.4 tried both from standard OSX installers (with iPhone and iPhoneSimulator kits installed) and with compiling 5.4 from sources with only the -sdk iphonesimulator switch. cmake version is 3.1.20141219-g64972.
This is what I'm trying (in the same way I got the OS X Desktop version built using the 5.4/clang_64/ environment):
cd ~/qca ; rm -rf build_ios && mkdir build_ios && cd build_ios
cmake -DCMAKE_INSTALL_PREFIX=~/qt-qca -DBUILD_PLUGINS=ossl -DOPENSSL_ROOT_DIR=/usr/local/Cellar/openssl/1.0.1h -DOPENSSL_LIBRARIES=/usr/local/Cellar/openssl/1.0.1h/lib -DOPENSSL_INCLUDE_DIR=/usr/local/Cellar/openssl/1.0.1h/include ..@
cmake goes ok, it identifies Qt5 environment and founds the compiler environment working. One strange thing is how it reports wrong OpenSSL version after listing the given paths:
-- Found OpenSSL: /usr/local/Cellar/openssl/1.0.1h/lib/libssl.dylib;/usr/local/Cellar/openssl/1.0.1h/lib/libcrypto.dylib (found version "0.9.8za")
Well, make starts compiling and goes nicely all the way up to 48% until it is linking time:
@Linking CXX shared library ../lib/qca.framework/qca
ld: warning: ignoring file /Users/user/Qt54/5.4/ios/lib/libQt5Core.a, missing required architecture x86_64 in file /Users/user/Qt54/5.4/ios/lib/libQt5Core.a (2 slices)@
Looking into it, the cmake/make end up always using the libQt5Core standard static library. I have not been able to figure out how to declare building for the iOS simulator so that libQt5Core_iphonesimulator.a would get used. Or even how to cross-compile the libraries for the arm architecture. Eventually I would need the QCA library and relevant plugins built for both the simulator and real iOS devices. I don't have any prior experience using Qt or cmake, but tried to look up the configuration directives and commands for library loading suffixes and how the package finding works, but it just always sticks with the plain libQt5Core.a library. It's really a double problem, it's trying to build for some OS X platform but defaults to the arm-binaries.
@$ cd ~/Qt54/5.4/ios/lib/ ; ls libQt5Core*.a
libQt5Core.a libQt5Core_debug.a libQt5Core_iphonesimulator.a libQt5Core_iphonesimulator_debug.a
$ lipo -info libQt5Core.a
Architectures in the fat file: libQt5Core.a are: armv7 arm64
$ lipo -info libQt5Core_iphonesimulator.a
Architectures in the fat file: libQt5Core_iphonesimulator.a are: i386 x86_64@
The Qt5 libraries here make perfect sense, but how to build the QCA package appropriately for both architectures and environments, in order to be able to use this in QtCreator projects? I have tried importing the QCA CMakeLists.txt as a project to QtCreator but there is no iOS generator. Also tried the Xcode generator for CMake and opened up the created XCode project file in Xcode but that only had OS X build targets. Also tried creating toolchain files for CMake, attempting to force the compiler to the clang under XCode's iPhoneSimulator directory tree but this didn't get me anywhere as the basic compiler tests already started to fail.
If somebody is actually using QCA in iOS environment, any pointers would be highly appreciated. Thank you!
Doesn't seem to be possible. Made few more attempts with this cmake toolchain file and using the -GXcode generator, then building with xcodebuild instead of make:
Seems the QCA package doesn't handle iOS dependencies, it requires Carbon framework. Even with the -DIOS_PLATFORM=SIMULATOR defined, it always tries to link with the libQt5Core.a device library even if it doesn't exist (for example when Qt5.4 is built from sources only with the simulator sdk).
Happy to be proven wrong, but so far it seems I have to drop QCA and Qt and stick with Objective-C and standard libraries.
Hi and welcome to devnet,
In fact QCA doesn't really depend on Carbon but on CoreFoundation. There's a patch to correct that in review
Hi SGaist and thanks for the reply!
A patch, where would that be? I went through the QCA commit log ( http://quickgit.kde.org/?p=qca.git ) but didn't find any references.
For a Qt newbie it's fairly confusing with all the Xcode/Qt/Cmake kits and toolchains. What mostly troubled me is that why does Cmake generate makefiles that try to link with wrong Qt libraries (I think I recall it being the same with the -GXcode generator and also when using the ios-cmake toolchain). Even when the simulator target was defined, it tries to link with libQt5Core.a (or _debug.a) which only has the arm platform.
Any thoughts on this?
You're welcome !
That's normal, it's currently in review. You can find it in KDE's review board.
Probably because you have a system wide installed Qt. You can add
When calling cmake the first time to tell it where to look for additional cmake find files.