Important: Please read the Qt Code of Conduct -

Compiling Qt lib for iOS - 5.2.0

  • Hello all !

    I'm working on "QCA": (Qt Cryptographic Architecture) and we're working on updating it for Qt5 while keeping Qt4 compatibility. I'm trying to compile an app which uses QCA lib for iOS using Qt 5.2.0 (compiled from sources).

    QCA uses cmake, I'm experiencing some issues when compiling with cmake, here are my command lines
    @$ QTDIR=~/Qt5.2.0/5.2.0/ios PATH=~/Qt5.2.0/5.2.0/ios/bin:$PATH cmake -D CMAKE_BUILD_TYPE=Debug . // No problem
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /Users/Max13/Developpement/QCA
    $ QTDIR=~/Qt5.2.0/5.2.0/ios PATH=~/Qt5.2.0/5.2.0/ios/bin:$PATH make
    [ 1%] Building CXX object src/CMakeFiles/qca.dir/qca_cert.cpp.o
    [... some warnings ...]
    [ 31%] Building CXX object src/CMakeFiles/qca.dir/moc_qca_safeobj.cpp.o
    Linking CXX shared library ../lib/libqca_debug.dylib
    ld: warning: ignoring file /Users/Max13/Qt5.2.0/5.2.0/ios/lib/libQt5Core_debug.a, file was built for archive which is not the architecture being linked (x86_64): /Users/Max13/Qt5.2.0/5.2.0/ios/lib/libQt5Core_debug.a
    Undefined symbols for architecture x86_64:
    "qt_assert_x(char const*, char const*, char const*, int)", referenced from:
    QListQCA::CertificateInfoPair::operator const in qca_cert.cpp.o
    QList<QString>::operator in qca_cert.cpp.o
    QList<int>::operator const in qca_cert.cpp.o
    QListQCA::Certificate::operator in qca_cert.cpp.o
    QListQCA::CRL::operator in qca_cert.cpp.o
    QListQCA::Certificate::takeAt(int) in qca_cert.cpp.o
    QListQCA::CertContext*::operator in qca_cert.cpp.o

    Here is the "./configure" command line for Qt 5.2.0, which I've make'd today without issue:
    @./configure -prefix /Users/Max13/Qt5.2.0/5.2.0-iOS -debug-and-release -opensource -confirm-license -nomake examples -silent -xplatform macx-ios-clang@

    Do you guys have an idea on why this issue and how to fix it please? Thanks.

  • Lifetime Qt Champion


    Are you sure the paths are correct ? It looks like the prefix of your configure line doesn't match with what you give to cmake

  • The path is correct, but I think the problem is this: "/Users/Max13/Qt5.2.0/5.2.0/ios/lib/libQt5Core_debug.a, file was built for archive which is not the architecture being linked (x86_64)"

    I think I understand what it means, but not how to make it work :/

  • Lifetime Qt Champion

    What does

    @lipo -info libQt5Core_debug.a@

    return ?

  • @MacBook-Pro-de-Adnan:build Max13$ lipo -info /Users/Max13/Qt5.2.0/5.2.0/ios/lib/libQt5Core_debug.a
    input file /Users/Max13/Qt5.2.0/5.2.0/ios/lib/libQt5Core_debug.a is not a fat file
    Non-fat file: /Users/Max13/Qt5.2.0/5.2.0/ios/lib/libQt5Core_debug.a is architecture: armv7@

    I think I'm getting it. I was building for iPhone-Simulator, I think it's trying to link with the wrong library (as I've noticed that I have some *_iphonesimulator.a"

  • Lifetime Qt Champion

    Looks like it indeed. Both don't use the same architecture. To avoid this, you could try to do a simulator only build so you'll ensure that you only have one set of libraries to link to (at least to start your tests)

  • I'll try to force linking with the correct file, thx.

    Will tell you when I have news.

  • Do you have any updates on linking with the right library ? I'm also facing this issue ( using the Digia provided installer for Qt 5.2.0 on iOS )

Log in to reply