0

I want to get openssl running with CLion (CMake) on my Mac.

Installed openssl with homebrew

brew install openssl

But still CLion is unable to find openssl. In the past it was possible to use

brew link openssl

but it seems that today this is refused by homebrew.

Warning: Refusing to link: openssl
Linking keg-only openssl means you may end up linking against the insecure, 
deprecated system OpenSSL while using the headers from Homebrew's openssl.
Instead, pass the full include/library paths to your compiler e.g.:
   -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib

Then I used following cmake options in CLion (CMakeLists.txt)

set(I "/usr/local/opt/openssl/include")
set(L "/usr/local/opt/openssl/lib")
include_directories(${I})

But still I get:

Undefined symbols for architecture x86_64:
  "_EVP_DigestSignFinal", referenced from:
Undefined symbols for architecture x86_64:
  "_EVP_DigestSignFinal", referenced from:
      OpenSSL::signMsg(Buffer, Buffer, SignOptions) in libMyLib.a(ssl_state.cpp.o)
      OpenSSL::signMsg(Buffer, Buffer, SignOptions) in libMyLib.a(ssl_state.cpp.o)

Nearly everything I could find to this thematic was about older versions of macOS, but Apple has removed development-headers from openssl 0.9.8, so many guides does not work anymore.

TheOkeland
  • 37
  • 8
  • 1
    Also see [Homebrew refusing to link OpenSSL](http://stackoverflow.com/q/38670295), [Update OpenSSL on OS X with Homebrew](http://stackoverflow.com/q/15185661), [How to install latest version of openssl Mac OS X El Capitan](http://stackoverflow.com/q/35129977), [How to upgrade OpenSSL in OS X?](http://apple.stackexchange.com/q/126830), [Openssl installation using HomeBrew fails](http://superuser.com/q/486389), etc. – jww Jul 21 '17 at 20:04

1 Answers1

0

This seems to be an issue with linking. I'm using Macports instead of Homebrew, but also on MacOS Sierra.

Since I can't see your code and you didn't provide a minimum working example, I used: https://github.com/Andersbakken/openssl-examples.git

Similar to you, I added the following lines to CMakeLists.txt

set(I "/opt/local/include")
set(L "/opt/local/lib")
include_directories(${I})

and it works just fine for me:

cmake .
make

Have you verified, that the necessary files are actually available under the paths, you put in your CMakeLists.txt?

Have you tried:

brew info openssl
agi
  • 506
  • 5
  • 5