I am trying to compile a small .c file that has the following includes:
#include <openssl/ssl.h> #include <openssl/rsa.h> #include <openssl/x509.h> #include <openssl/evp.h>
In the same folder where I have the .c file I have a /openssl with all those files (and more), also in synaptic package manager I see OpenSSL installed, I am trying to compile with this:
gcc -o Opentest Opentest.c -lcrypto
but I always get the errors:
error: openssl/ssl.h: No such file or directory error: openssl/rsa.h: No such file or directory error: openssl/x509.h: No such file or directory error: openssl/evp.h: No such file or directory
The file I want to compile is only a .c file, doesn't have Makefile or ./configure.
I already tried:
env CFLAGS=-I/path/to/openssl/
and tried to compile again but I get the same errors.
What should I do in order to compile with OpenSSL includes?
Compiling OpenSSL for Linux on Ubuntu 20.04 In addition to the more advanced . configure script provided with the source, OpenSSL's source directory includes a friendlier . config script with common defaults. Make this script executable and run it.
The standard location of the development libs is /usr/include/openssl . The only shared objects for openssl are in /usr/lib/i386-linux-gnu/openssl-1.0. 0/engines/ .
Configuration files used by OpenSSL will be in DIR/ssl or the directory specified by --openssldir. --openssldir=DIR Directory for OpenSSL files. If no prefix is specified, the library files and binaries are also installed there.
Your include paths indicate that you should be compiling against the system's OpenSSL installation. You shouldn't have the .h
files in your package directory - it should be picking them up from /usr/include/openssl
.
The plain OpenSSL package (libssl
) doesn't include the .h
files - you need to install the development package as well. This is named libssl-dev
on Debian, Ubuntu and similar distributions, and libssl-devel
on CentOS, Fedora, Red Hat and similar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With