Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fatal Error: openssl/evp.h No such file or directory

I successfully compiled openssl using android ndk build and .so files are built successfully.

I am trying to 'include' built .so files in an android project.

Getting an error in below line:

#include "openssl/evp.h"

fatal error: openssl/evp.h: No such file or directory compilation terminated. make: * [obj/local/armeabi/objs/iedemo/anotherdemo.o] Error 1

However, I am include stdio.h and string.h files.

I am explore /usr/include/openssl directory, I am able find all openssl related .h files here. And, stdio.h and string.h files are present in /usr/include directory.

I have installed libssl-dev package too. Command (sudo apt-get install libssl-dev)

Please help me!!

like image 655
Charan Avatar asked Oct 23 '12 06:10

Charan


4 Answers

When encountering this problem on Debian or Ubuntu, it can be solved with the following command:

apt-get install libssl-dev

like image 55
Simon Baars Avatar answered Oct 24 '22 03:10

Simon Baars


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:
enter image description here

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.

like image 35
AAEM Avatar answered Oct 24 '22 04:10

AAEM


Your Android.mk should specify the openssl include directory (not /usr/include/openssl, but the one that goes with the files that you built for Android using NDK. Something similar to

LOCAL_C_INCLUDES += /home/Charan/openssl/include

But you will also need to specify the path for .so files that you have built, and make sure they are correctly deployed with your app. The things can go messy, but luckily there is a working example: openSSL using Android's NDK problems.

like image 1
Alex Cohn Avatar answered Oct 24 '22 05:10

Alex Cohn


I ran into this when building a PHP package using PECL and was able to install the header file as part of openssl-devel

On CentOS/RHEL: yum install openssl-devel

On Ubuntu/Debian: apt-get install openssl-devel

like image 1
Eric Kigathi Avatar answered Oct 24 '22 05:10

Eric Kigathi