Can't find openssl

I'm trying to work with Boost:asio to establish a SSL connection.

Now, my compiler says, it can't find openssl/conf.h

I'd like to know where this path is and how to fix this problem.

Thanks in advance.


Solution 1:

In my path, it is /usr/include/openssl/conf.h, and we can query dpkg to find the package that it comes from with:

dpkg -S /usr/include/openssl/conf.h

which gives the result:

libssl-dev: /usr/include/openssl/conf.h

Therefore you must run

sudo apt-get install libssl-dev

in order to get the development files for the program.

If you already have it installed in a non-standard location, you can export that into the build environment with

export LD_LIBRARY_PATH=/location/of/lib

You can also use the build-dep command to install all the necessary files for a particular program, e.g.

sudo apt-get build-dep openssl

Solution 2:

Header files are usually shipped in separate packages with -dev suffix. In this case the file you need is in libssl-dev.

You can use the Ubuntu Package Contents Search pages to locate the correct dev package for missing headers.

Any headers installed by the dev packages should be found automatically under the default search path, so it will usually suffice to install the required package to fix the problem.