简体   繁体   中英

fatal error: 'openssl/evp.h' file not found cmake + make

Operating system: macOS Catalina
I have a project that has a file called CMakeLists.txt. I ran cmake and then make, but the make command failed:

/Users/blablabla/Downloads/myproject/src/main.cpp:10:10: fatal error: 
'openssl/evp.h' file not found
#include <openssl/evp.h>

I tried reinstalling OpenSSL via homebrew, linking the libraries but it still gave this error.
What am I could be doing wrong?
Any help would be highly appreciated

either openssl's dev library is not installed, or the g++ command that cmake generates probably is missing a -I.

try sudo apt-get install libssl-dev first and if that doesn't work, make sure the openssl include dir is provided to g++.

according to https://cmake.org/cmake/help/v3.6/module/FindOpenSSL.html , it creates an env var of OPENSSL_INCLUDE_DIR

edit: just noticed you're on OSX. you can install the the dev libssl package with brew install openssl

For people like me, that uses windows OS and they accidently came to this page and the above solutions did not solve their problem, can try the following solution:
I downloaded the OpenSSL executable from the official website , and selected the file with the description that contanins the following line ( Recommended for software developers by the creators of OpenSSL ).
At the time of writing this solution, the file version is (Win64 OpenSSL v3.0.0), and it can be directly downloaded from the following link .

Here is an Image for more declaration:
在此处输入图像描述

After that, I did the following steps:

  1. Install the OpenSSL form the.exe file.
  2. Copy the bin folder directory path (in my case it was C:\Program Files\OpenSSL-Win64\bin) and add it to the system enviroment variables.
  3. Copy the include folder directory path (in my case it was C:\Program Files\OpenSSL-Win64\include) and add it to the system enviroment variables.

Then compile the source code that used the openssl library and header files, they should be compiled with no errors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM