Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS error: Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib #699

Open
marcuswestin opened this issue Nov 26, 2019 · 2 comments

Comments

@marcuswestin
Copy link

Hi, I would love help getting ObjectiveGit running on macOS.

I'm on Catalina 10.15.1 and Xcode Version 11.1.

I'm building using Carthage, following all the steps.
iOS seems to work fine.
MacOS does not:

dyld: Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
  Referenced from: /Users/.../Build/Products/Debug/.../Contents/Frameworks/ObjectiveGit.framework/Versions/A/ObjectiveGit
  Reason: image not found

Looking in /usr/local/opt/openssl/lib/ I see libcrypto.1.1.dylib, but not libcrypto.1.0.0.dylib.

(If relevant at all, I was able to get https://www.github.com/SwiftGit2/SwiftGit2 to run on macOS)

Any pointers would be super, super appreciated!

Thanks

@marcuswestin
Copy link
Author

marcuswestin commented Dec 6, 2019

I finally got ObjectiveGit working on macOS 10.15.1 Catalina and Xcode 11! Here's a quick recap of the problems I ran into and the eventual solution - hopefully useful for anyone running into similar issues dow: the road.

Problem & Solution:

First I tried installing the latest release (0.14.2) with carthage, using Cartfile entry:

github "libgit2/objective-git"

But then macOS fails with error:

dyld:
  Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
  Referenced from: ...
  Reason: image not found

After many different attempts, I finally managed to get everything working by forking the repository, creating a branch off of the latest release, and using that as my Cartfile dependency:

github.com "marcuswestin/objective-git" "0.14.2-fork-for-catalina-xcode11"

I had to jump through a few additional hoops to get everything finally working, not necessarily related to this library, but worth noting:

  • ObjectiveGit.framework could not be found
    • Drag framework to the {Project file} > {Target} > Build Phases -> Embedded Binaries
    • Create an Objective-C bridging header with File > New File... > macOS: Objective-C File> {Any name, Empty File}
      • When prompted to configure an Objective-C bridging header: Create Bridging Header
    • Import framework:
      • import ObjectiveGit in any swift file you want to use it in, or
      • #import <ObjectiveGit/ObjectiveGit.h> in your ...-Bridging-Header.h file for access from any swift file in your project.
  • Fix Curl: could not resolve <domain> error
    • In {Project file} > {Target} > Signing & Capabilities > App Sandbox > Network >
    • Check: Outgoing Connections (Client)
  • Fix framework CodeSign errors
    • Clean Project (Product > Clean Build Folder, or Shift+Cmd+K)
    • In {Project file} > {Target} > Signing & Capabilities > Hardened Runtime >
    • Check: Disable Library Validation

This makes it work! Why? I'm not certain, but my guess is that because the latest libgit2/objective-git release has binary builds, Carthage downloads and uses those, but they don't work with Catalina. However, when using the branch build, Carthage has to build from source - and then it works!

@noahlt
Copy link

noahlt commented Feb 12, 2020

I faced the exact same problem (Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib) and solved it by building Objective Git like so:

carthage update --platform macOS --no-use-binaries

This was just using @marcuswestin's intuition that the solution was to force Carthage to build from source, and finding the --no-use-binaries flag to do that explicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants