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. Dynamically linked openssl not supported on iphonesimulator?
Forum Updated to NodeBB v4.3 + New Features

Dynamically linked openssl not supported on iphonesimulator?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
7 Posts 2 Posters 1.1k Views 1 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.
  • M Offline
    M Offline
    Martin Burchell
    wrote on last edited by
    #1

    Hi

    I've successfully built an app on iphonesimulator but openssl isn't supported, despite being linked dynamically.
    QSslSocket::supportsSsl() returns false
    QSslSocket::sslLibraryBuildVersionString() returns "OpenSSL 1.1.1c 28 May 2019"
    QSslSocket::sslLibraryVersionString() returns empty string

    output from .pro file:
    LIBS=-L/Users/martin/workspace/qt_local_build/openssl_ios_x86_64_build/openssl-1.1.1c -lcrypto -lssl /Users/martin/workspace/qt_local_build/sqlcipher_ios_x86_64/sqlcipher/sqlite3.o

    output from otool -L:
    /Users/martin/workspace/qt_local_build/openssl_ios_x86_64_build/openssl-1.1.1c/lib/libcrypto.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
    /Users/martin/workspace/qt_local_build/openssl_ios_x86_64_build/openssl-1.1.1c/lib/libssl.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)

    The same version of OpenSSL is working on other platforms albeit linked statically rather than dynamically.

    macOS Catalina 10.15.7
    iOS 14.2
    darwin 19.6.0
    Qt 5.12.11
    Xcode 12.2
    Qt Creator 4.13.3

    Am I doing something fundamentally wrong?
    Any clues as to how to investigate this further?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Martin Burchell
      wrote on last edited by
      #2

      Fixed:

      install_name_tool -id "@rpath/libssl.dylib" libssl.1.1.dylib
      install_name_tool -id "@rpath/libcrypto.dylib" libcrypto.1.1.dylib
      install_name_tool -change /Users/martin/workspace/qt_local_build/openssl_ios_x86_64_build/openssl-1.1.1c/lib/libcrypto.1.1.dylib "@rpath/libcrypto.dylib" libssl.1.1.dylib
      

      and then these lines in the .pro file:

      QMAKE_RPATHDIR = @executable_path/Frameworks
      crypto.files = "$${OPENSSL_DIR}/libcrypto$${DYNAMIC_LIB_EXT}"
      crypto.path = Frameworks
      QMAKE_BUNDLE_DATA += crypto
      
      ssl.files = "$${OPENSSL_DIR}/libssl$${DYNAMIC_LIB_EXT}"
      ssl.path = Frameworks
      QMAKE_BUNDLE_DATA += ssl
      

      I had to apply a similar fix for the device. Here the app was crashing on startup because the libraries couldn't be loaded.

      The next step will be to automate this in my build script.

      1 Reply Last reply
      2
      • M Offline
        M Offline
        Martin Burchell
        wrote on last edited by
        #3

        As a postscript, it's worth noting that whilst this is fine for running an app in the simulator or on a development device, the Apple Store won't accept random libraries in the Frameworks folder, with the unhelpful message:

        ITMS-90426: Invalid Swift Support* - The SwiftSupport folder is missing. Rebuild your app using the current public (GM) version of Xcode and resubmit it.

        So you need either to link openssl statically or embed it in a Framework. I'm doing the former.

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

          Hi and thanks for the feedback !

          Out of curiosity, why not use the default backend for iOS that uses the native framework ?

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

          M 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi and thanks for the feedback !

            Out of curiosity, why not use the default backend for iOS that uses the native framework ?

            M Offline
            M Offline
            Martin Burchell
            wrote on last edited by
            #5

            @SGaist Probably ignorance on my side. Could you give me some pointers as to how I would set that up?

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

              There's nothing to setup, that's the default build.

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

              M 1 Reply Last reply
              0
              • SGaistS SGaist

                There's nothing to setup, that's the default build.

                M Offline
                M Offline
                Martin Burchell
                wrote on last edited by
                #7

                @SGaist OK thanks. I'll try that when I have a moment. For now static OpenSSL is working but would be good not to have the additional overhead of building with that.

                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