krzyzanowskim / OpenSSL

OpenSSL package for SwiftPM, CocoaPod, and Carthage, multiplatform
https://swift.best
Other
907 stars 334 forks source link

OpenSSL not found in the linked frameworks #162

Closed paulosilva8 closed 1 year ago

paulosilva8 commented 1 year ago

I used to have a private repo with openSSL and distribute it using cocoapods. We are moving to SPM, so I found your repo and integrated it successfully thus far. However, one embedded library in our app is also requesting openSSL to build and I am getting the following error:

dyld: Library not loaded: @rpath/openssl.framework/openssl Referenced from: .../Build/Products/Debug-iphonesimulator/ffmpeg.framework/ffmpeg Reason: image not found dyld: launch, loading dependent libraries

It seems the SPM integration provided with openSSL is a library (not dynamic?) and the framework is either placed in a different folder with SPM or has a different name?

nagarro-mohitpadalia commented 1 year ago

Looks like issue happens because of an older version of ruby gem used by cocoapods, updating the cocoapods does not update some dependencies. So the steps I performed to resolve this are :

  1. Uninstall ruby gems sudo gem uninstall --all
  2. Remove workspace project, delete Podfile.lock
  3. Deleted the pods directory
  4. Install cocoapods sudo gem install cocoapods
  5. Run pod install
paulosilva8 commented 1 year ago

It must be some other problem as this didn't help to fix the issue. Thanks

Looks like issue happens because of an older version of ruby gem used by cocoapods, updating the cocoapods does not update some dependencies. So the steps I performed to resolve this are :

  1. Uninstall ruby gems sudo gem uninstall --all
  2. Remove workspace project, delete Podfile.lock
  3. Deleted the pods directory
  4. Install cocoapods sudo gem install cocoapods
  5. Run pod install
ferencIOS commented 1 year ago

I had also this issue on another project with SPM. I guess you, @paulosilva8, have a structure like this:

App
---> Embed Custom Framework
--------> Custom Framework embed OpenSSL via SPM

If the assumption is right what I did is:

App
---> Embed Custom Framework **+ OpenSSL via SPM** (*)
--------> Custom Framework embed OpenSSL via SPM (*)

(*)using the same version for the App and the Custom Framework

Why?

Maybe @krzyzanowskim an attempt could be

targets: [
        .binaryTarget(
            name: "OpenSSL",
            url: "<OpenSSL-URL>",
            checksum: "<OpenSSL-Checksum>"
        )
    ]

instead of

targets: [
        .binaryTarget(
            name: "OpenSSL",
            path: "Frameworks/OpenSSL.xcframework"
        )
    ]

Have a nice evening!

paulosilva8 commented 1 year ago

Problem with this approach is only that the embed framework is managed by another company. I have requested a new binary to point to the correct framework and yes, it should fix the issue

krzyzanowskim commented 1 year ago
        url: "<OpenSSL-URL>",
       checksum: "<OpenSSL-Checksum>"

Xcode is (was) quite broken when it comes to downloadable SPM artifacts last time I checked