Problem adding openssl to iOS project

I am having difficulty adding openssl to an iOS project for receipt validation. XCode 7.2.1, Swift.


For convenience, I am using the latest build of openssl posted on the Receigen site, openssl-1.0.2f-iOS. I have set the user search paths to the include folder pathway, and have added the libcrypto.a library to "Linked Frameworks and Libraries" in the project settings. When I do this, I get the following error during build:


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


I have followed the exact same procedure for adding openssl to OSX projects without encountering this error.


I have spent a few hours searching the web for a solution. I have tried several without success, including:

  1. Disabling bitcode.
  2. Altering the "Build Active Architecture Only" setting.
  3. Deleting the files in the DerivedData folder.
  4. Cleaning the project.
  5. Rebooting.


What am I overlooking? Any help would be most appreciated.

Accepted Reply

Here are two comments for your consideration. There is a setting called 'always search users search paths' that is a few lines above where you set users search path and it must be 'yes'. Also it is unusual that the error refers to 'lcrypto' not 'libcrypto'' - perhaps your OpenSSL was compiled against a different library and you need to obtain that library or rename yours. There is also a second library you need to link.

Replies

Here are two comments for your consideration. There is a setting called 'always search users search paths' that is a few lines above where you set users search path and it must be 'yes'. Also it is unusual that the error refers to 'lcrypto' not 'libcrypto'' - perhaps your OpenSSL was compiled against a different library and you need to obtain that library or rename yours. There is also a second library you need to link.

Thanks for the quick reply.


The setting for searching user paths is set to yes.


In terms of the "lcrypto" part of the message, I was suspecting that could be a problem. I will to try to build the openssl library myself.


When you refer to an additional second library to link, what do you mean?

Libssl

It has not been necessary to link in libssl on OS X to access the functions necessary to decrypt the receipt.


I am marking your answer correct for the lcrypto observation. I renamed the libcrytpo.a file to lcrytpo.a, and linked that into my project, and it now builds without error. I have not yet added the receipt validation code to test if the library is functional, but I am optimistic it will work.