makefileopenssl

Building openssl


I am trying to build an openssl of specific version on rocky linux. I need a specific version for some tests. It seems to be straightforward however the newly build openssl keeps pointing to system openssl config file, here is the setup

(cd ~/openssl-3.0.9 && ./config enable-fips --prefix=/home/${USER}/v/openssl-3.0.9)
(cd ~/openssl-3.0.9 && make)
(cd ~/openssl-3.0.9 && make install)
(cd ~/openssl-3.0.9 && make install_fips) #probably redundant

I get

~/v/openssl-3.0.9/bin/openssl version -d

OPENSSLDIR: "/etc/pki/tls"

I have then tried setting the ./config as

(cd ~/openssl-3.0.9 && ./config enable-fips --prefix=/home/${USER}/v/openssl-3.0.9 --openssldir=/home/${USER}/v/openssl-3.0.9/ssl)

with the same result

Also just running

~/v/openssl-3.0.9/bin/openssl version
OpenSSL 3.0.9 30 May 2023 (Library: OpenSSL 3.2.2 4 Jun 2024)

So it seems that the openssl program of the newly built version points to the system library rather than to what is under ~/v/openssl-3.0.9/lib64, I tried setting env variables but nothing seems to work.

There must be something rather simple I am missing?

Thank you for any help!


Solution

  • The simplest solution is to set your LD_LIBRARY_PATH environment variable to point to the directory containing your libraries. e.g.

    export LD_LIBRARY_PATH=~/v/openssl-3.0.9/lib64
    

    Alternatively follow the instructions here to build OpenSSL so that it already knows how to find its libraries:

    https://github.com/openssl/openssl/blob/master/NOTES-UNIX.md