krzyzanowskim / OpenSSL

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

[CocoaPods] Library not loaded #159

Closed ferencIOS closed 1 year ago

ferencIOS commented 1 year ago

Hi all,

Error: dyld[18405]: Library not loaded: @rpath/OpenSSL.framework/OpenSSL Referenced from: /private/var/containers/Bundle/Application/85285A84-FB19-4C54-8DFF-3F990572BF3F/[app].app/IG YOU Reason: tried: '/usr/lib/swift/OpenSSL.framework/OpenSSL' (no such file), '/private/var/containers/Bundle/Application/85285A84-FB19-4C54-8DFF-3F990572BF3F/[app].app/Frameworks/OpenSSL.framework/OpenSSL' (no such file), '/private/var/containers/Bundle/Application/85285A84-FB19-4C54-8DFF-3F990572BF3F/[app].app/Frameworks/OpenSSL.framework/OpenSSL' (no such file), '/private/var/containers/Bundle/Application/85285A84-FB19-4C54-8DFF-3F990572BF3F/[app].app/Frameworks/OpenSSL.framework/OpenSSL' (no such file), '/usr/lib/swift/OpenSSL.framework/OpenSSL' (no such file), '/private/var/containers/Bundle/Application/85285A84-FB19-4C54-8DFF-3F990572BF3F/[app].app/Frameworks/OpenSSL.framework/OpenSSL' (no such file), '/private/var/containers/Bundle/Application/85285A84-FB19-4C54-8DFF-3F990572BF3F/[app].app/Frameworks/OpenSSL.framework/OpenSSL' (no such file), '/private/var/containers/Bundle/Application/85285A84-FB19-4C54-8DFF-3F990572BF3F/[app].app/Frameworks/OpenSSL.framework/OpenSSL' (no such file), '/System/Library/Frameworks/OpenSSL.framework/OpenSSL' (no such file)

OpenSSL Version 1.1.1700

Mac macOS Monterey 12.5.1, chip Apple M1

Devices iPhone 12 (but also Simulator throws the same error)

Dependency Manager CocoaPods

def shared_pods
  platform :ios, "10.0"
  inhibit_all_warnings!
  use_frameworks!

 [..]
  pod "OpenSSL-Universal", "1.1.1700"
end
jorge3pp commented 1 year ago

Hello @ferencIOS,

I've also found the same problem.

It's solved by adding the OpenSSL.xcframework to Embed Frameworks and then select Embed & Sign.

I wanted to track the issue and seems like this is something that has been introduced in the last version (1.1.1700). If you choose "1.1.1501" instead, it works like before. So another workaround would be to downgrade your version.

erdincmaden commented 1 year ago

I have the same problem.

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

I opened this issue, possibly related though I am using SPM: https://github.com/krzyzanowskim/OpenSSL/issues/162

ferencIOS commented 1 year ago

I switched to 1.1.1900 adding these lines on Podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
[...]
      config.build_settings["CODE_SIGNING_ALLOWED"] = "NO"
    end
  end
end
krzyzanowskim commented 1 year ago

it looks like not something I suppose to change. Xcode default value changed between versions

Xcode 13 used to automatically set CODE_SIGNING_ALLOWED to NO by default for resource bundles. But that’s no longer the case in Xcode 14.

from https://blog.codemagic.io/code-signing-issues-in-xcode-14-and-how-to-fix-them/