Fix fatal error openssl err.h – No such file or directory [OpenCA]

Updated on December 18, 2017

I have been installing OpenCA version 1.5.1 on CentOS 7 machine. According to the documentation, I need to install OpenCA tools package before installing OpenCA Base package. However, I get “fatal error openssl err.h – No such file or directory” while compiling OpenCA tools package as shown below.

[root@ra openca-tools-1.3.1]# make
Making all in src/sv
make[1]: Entering directory `/root/downloads/openca-tools-1.3.1/src/sv'
gcc -DHAVE_CONFIG_H -I. -I../../include/openca -I../../include -g -O2 -fstack-check -maccumulate-outgoing-args -MT apps.o -MD -MP -MF .deps/apps.Tpo -c -o apps.o apps.c
apps.c:119:25: fatal error: openssl/err.h: No such file or directory
 #include <openssl/err.h>
 ^
compilation terminated.
make[1]: *** [apps.o] Error 1

How to fix this error?

Solution: Fix fatal error openssl err.h

You might be aware that OpenSSL should be installed before installing OpenCA. In case, if you don’t have OpenSSL installed, then jump to this tutorial and install it first.

Coming back to the error ‘fatal error: openssl/err.h: No such file or directory‘, it seems like the compilation script is not able to find one of the OpenSSL header file. In our case, it’s err.h file.

To find which package provides a particular file or header file, use the below command:

On CentOS, use yum whatprovides as shown below:

[root@ra ]# yum whatprovides '*/openssl/err.h'
1:openssl-devel-1.0.2k-8.el7.i686 : Files for development of applications which will use  OpenSSL
Repo : base
Matched from:
Filename : /usr/include/openssl/err.h

1:openssl-devel-1.0.2k-8.el7.x86_64 : Files for development of applications
 : which will use OpenSSL
Repo : base
Matched from:
Filename : /usr/include/openssl/err.h

1:openssl-devel-1.0.2k-8.el7.x86_64 : Files for development of applications
 : which will use OpenSSL
Repo : @base
Matched from:
Filename : /usr/include/openssl/err.h

Note: You can replace '*/openssl/err.h' with the file you would like to search. For example, you can also simply search for a particular file as '*/err.h'.

On Ubuntu machines, use dpkg command as shown below:

# dpkg -S openssl/err.h
libssl-dev:amd64: /usr/include/openssl/err.h

Alternatively, you can use apt-file find <filename> command as well.

# apt-file find openssl/err.h
libssl-dev: /usr/include/openssl/err.h
libwolfssl-dev: /usr/include/cyassl/openssl/err.h
libwolfssl-dev: /usr/include/wolfssl/openssl/err.h

Well, the above output says that err.h file is shipped with OpenSSL development package. So installing openssl-devel should fix the error.

# yum install openssl-devel

On Ubuntu variants:

# sudo apt-get install libssl-dev

Now, OpenCA tools package should compile without an error. Hope it helps someone out there.

Was this article helpful?

Related Articles

Leave a Comment