skip to Main Content

I have a react-native app that consumes OpenSSL-Universal as dependency.

OpenSSL is being called from CPP Code which is bridged via an react-native swift library. In the Simulator the whole code runs fine. But when I build the App for production, Archive it in X-Code and install it on a real i-Phone, I get following error:

DYLD error: Library not loaded: @rpath/OpenSSL.framework/OpenSSL

I have added the OpenSSL.framework to Targets -> Build Phases -> Link Binary with Libraries and to

General -> Frameworks, Libraries, and Embedded Content

What am I missing here? Its really confusing to me that it runs fine on the Simulator, but not on a real device

2

Answers


  1. Chosen as BEST ANSWER

    I found a solution that feels like a workaround:

    1. Clone and build the openssl for iPhone repository
    2. copy the arm64 (iPhone) build into the project (lib and include folder)
    3. Register the library via "Other Linker Flags" in XCode, so a -I[PATH TO "include" FOLDER] and a -L[PATH TO "lib" FOLDER]

    Although this works, it would be nice to find an option that just works out of the box without any additional configuration. Now I have to revert those changes if I want to run on a simulator because the simulator will of course crash with the linked iPhone OpenSSL build


  2. It is due to not OpenSSL library integrated properly

    Solution 1:

    • Project settings

    • Select Target

    • Select the General tab

    • Under Frameworks, Libraries and Embedded Content, click on the plus button.

    • Find the OpenSSL.xcframework from the list and hit Add.

    • select Embed and sign from OpenSSL.xcframework

    • run xcode build again

    Solution 2:

    1. add this line into Podfile
    pod 'OpenSSL-Universal', :modular_headers => true, :configurations => ['Release']
    
    1. just run pod install in the ios root directory
    2. run the build

    Solution 3:

    For whatever reason in Project settings > Select Target > Build Settings > Framework Search Paths this:

    Screenshot 2023-04-07 at 9 45 48 PM

    but the Release ones were missing a bunch of those so I added these 2:

    "${PODS_ROOT}/OpenSSL-Universal/Frameworks"
    "${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL-Universal"
    

    Then both debug and release builds worked for me. 👍🏼

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search