Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cmake Openssl not found

Want to cross-compile a C application that uses Azure IoT SDK, which unfortunately requires Cmake. Cmake refuses to build my toolchain because it claims that it cannot find Openssl that I've compiled for my target architecture.

I've tried adding OPENSSL_ROOT_DIR to the folder it's in.

SET(OPENSSL_ROOT_DIR /path/to/openssl)

I continually get the error:

  Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
  system variable OPENSSL_ROOT_DIR (missing: OPENSSL_LIBRARIES) (found
  version "1.0.2g")

I also tried setting system variables to these folder as the error suggests, but it seemingly ignores them and prompts the same error. I've tried adding it to the same folder as my C compiler also to no avail.

I've run out of things to try and this point and I do not understand why it doesn't work. Any suggestions?

like image 839
Kagemand Andersen Avatar asked May 14 '18 07:05

Kagemand Andersen


2 Answers

In Linux, I didn't have any problem setting OpenSSL.

In Windows, I solved as explained below.

Try removing CMakeCache.txt file and then do again. The cache Cmake is the main problem.

For instance, I did cmake . -DOPENSSL_ROOT_DIR=C:\openssl-1.0.2 -DOPENSSL_INCLUDE_DIR=C:\openssl-1.0.2\include -DOPENSSL_CRYPTO_LIBRARY=C:\openssl-1.0.2\crypto and everything got solved. The logic is same.

enter image description here

like image 89
Uddhav P. Gautam Avatar answered Oct 22 '22 20:10

Uddhav P. Gautam


For MacOs I encounter the same error while installing ton'slite client (cmake ~/lite-client)

Solved as follows: I have open the "CMakeCache.txt" file in "liteclient-build" directory, find the line

OPENSSL_INCLUDE_DIR:PATH=OPENSSL_INCLUDE_DIR-NOTFOUND

and change it to with my openssl location

OPENSSL_INCLUDE_DIR:PATH=/usr/local/opt/openssl/include
like image 25
Vladimir Romanov Avatar answered Oct 22 '22 20:10

Vladimir Romanov