c++cmakeopenssllibcrypto

Issue: No package 'libcrypto' found


I saw this issue "No package 'libcrypto' found". The same error I fixed multiple months ago was to follow this solution: https://github.com/scipr-lab/libsnark/issues/99 I tried this solution today however it doesn't work anymore. (I also tried"brew install openssl, brew info openssl") No luck. Have you seen this before? Would you help take a look?

-- Checking for module 'libcrypto'
--   No package 'libcrypto' found
CMake Error at /usr/local/Cellar/cmake/3.15.4/share/cmake/Modules/FindPkgConfig.cmake:458 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.15.4/share/cmake/Modules/FindPkgConfig.cmake:637 (_pkg_check_modules_internal)
  PlaylistParser/src/CMakeLists.txt:2 (pkg_check_modules)


-- Configuring incomplete, errors occurred!

Solution

  • brew info openssl says the following: (for me, might be different for you if your version is different)

    openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
    because openssl/libressl is provided by macOS so don't link an incompatible version.
    
    If you need to have openssl@1.1 first in your PATH run:
      echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
    
    For compilers to find openssl@1.1 you may need to set:
      export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
      export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
    
    For pkg-config to find openssl@1.1 you may need to set:
      export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
    

    Since your CMake script seems to use pkg-config, you only need to execute the last statement before you run cmake.