library not found for lcrypto

8.1k views Asked by At

I'm trying to build the iOS AllJoyn project, but I'm having trouble with the OpenSSL integration.

I've been looking at these directions: https://allseenalliance.org/docs-and-downloads/documentation/configuring-build-environment-ios-and-osx#unique_16

I've followed the directions all the way up to Xcode IDE Build, but now I'm getting an error that says: "library not found for lcrypto".

Looking online it looks like there might be something to do with the Makefile, but I'm not really sure what lcrypto is and what library I'm supposed to be referencing.

EDIT I noticed that it says it is a Shell Script Invocation Error

Also here is the trace:

ld: warning: directory not found for option '-L/PATH/alljoyn/alljoyn/common/crypto/openssl/build/Debug-iphoneos'
ld: library not found for -lcrypto
clang: error: linker command failed with exit code 1 (use -v to see invocation)
scons: *** [build/darwin/arm/iphoneos/debug/obj/test/bbcclient] Error 1
scons: building terminated because of errors.
Command /usr/local/bin/scons failed with exit code 2
2

There are 2 answers

0
carnun On

In order to successfully use the AllJoyn SDK you need to have a compiled version of the openssl library available (i.e. libcrypto.a).

The details to build the openssl library can be found in the README-INSTALLING.txt file under /alljoyn_objc in the SDK, I have copied the relevant instructions below. Once you have created the openssl library you need to place it in a directory accessible to your project (in your case "/PATH/alljoyn/alljoyn/common/crypto/openssl/build/Debug-iphoneos").

Most of this information is contained in the AllJoyn Programming Guide for Objective-C

Relevant text from the README-INSTALLING.txt file:

  1. OpenSSL is required for iOS development and is available at the following web address: www.openssl.org AllJoyn has been tested with version 1.0.1 of OpenSSL.
  2. Download the Xcode project that can be used to build OpenSSL for iOS from GitHub, at the following web address: https://github.com/sqlcipher/openssl-xcode/

Installation

  1. Copy the OpenSSL source into a separate folder on your development system, not under the AllJoyn SDK.

  2. Navigate to the OpenSSL source top folder in Finder, and copy the openssl.xcodeproj folder you downloaded from GitHub into this folder.

  3. Open the openssl.xcodeproj in Xcode.

  4. In Xcode, build the crypto target (libssl.a and libcrypto.a) for each combination of configuration (debug|release) and platform (iphoneos|iphonesimulator) that you need for your iOS project by selecting Product->Build For->(your desired configuration).

0
RUBEN IÑIGO TEJEDOR On

I solved 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

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