spacecash21
spacecash21

Reputation: 1331

Xcode 8 and "ld: library not found for -lcrypto"

When I try to build my project, I get the following issue.

ld: library not found for -lcrypto
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Before the latest Xcode update, I was using OpenSSL via CocoaPods just fine. After the latest OS and Xcode update, I can't seem to be able to build OpenSSL.

Any ideas how to solve this? On Xcode 7 everything was working ok.

Upvotes: 7

Views: 5897

Answers (3)

I solved the error "library not found for -lcrypto" adding LIBRARY_PATH variable with the path to the library.

export LIBRARY_PATH=$(brew --prefix openssl@3)/lib:/usr/local/lib:/usr/lib:$LIBRARY_PATH

I included it on .gitlab-ci.yml, but I guess adding it elsewhere will work.

Upvotes: 0

spacecash21
spacecash21

Reputation: 1331

Found a solution, turns out, I needed to update the CocoaPods as well as my Pods.

For Mac OS X: pod 'OpenSSL-OSX'

Other versions of OpenSSL do not work.

Upvotes: 8

user2002649
user2002649

Reputation: 730

I struggled with this for a long time. I finally fixed it by adding the following path to Build Settings: Library Search Paths

$(SRCROOT)/../../openssl-1.0.1s-MacOSX/lib

Your folder path is probably different. I pressed the plus button and dragged the lib folder from the OpenSSL folder to it.

I am sure I had tried this multiple times without success, but it seems to fix it now.

Upvotes: 1

Related Questions