Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Jan 2020 15:16:35 +0100
From:      Alexander Koeppe <format_c@online.de>
To:        freebsd-stable@freebsd.org
Subject:   FreeBSD SSL libraries and OpenSSL libraries - how to compile own source code
Message-ID:  <qunic4$3ntq$1@blaine.gmane.org>

next in thread | raw e-mail | index | archive | help
Hello list,

Since I've upgraded to FreeBSD 12, I've linker issues when I try to 
build my own source code which is depending on OpenSSL library.

It's claiming that there are undefined references to SSL_library_init or 
SSLv23_server_method for instance.

I detected the OpenSSL libraries using the FindOpenSSL.cmake file in 
/usr/local/share/cmake/Modules. It returned /usr/lib32/libssl.so and 
/usr/lib32/libcrypto.so.

Cmake is for some reason translating the found libraries to the `-lssl` 
and `-lcrypto` linker flags. This seem to default back to
/usr/lib/libssl.so and /usr/lib/libcrypto.so.

These files point by default to:

     /usr/lib/libssl.so -> libssl.so.111
     /usr/lib/libcrypto.so -> /lib/libcrypto.so.111


But when I check which libraries have been provided by OpenSSL package, 
I get a different outcome:

     $ pkg list openssl | egrep 'lib(ssl|crypto).so'
     /usr/local/lib/libcrypto.so
     /usr/local/lib/libcrypto.so.9
     /usr/local/lib/libssl.so
     /usr/local/lib/libssl.so.9
     $

These files are different to what openssl package provided.
When I replace these symlinks to point to the .so files provided by the 
openssl package, building and running the application works as expected. So:

     /usr/lib/libssl.so -> /usr/local/lib/libssl.so
     /usr/lib/libcrypto.so -> /usr/local/lib/libcrypto.so

I've read that FreeBSD 12 provides it's own SSL libraries and there is 
the possibility to edit the /etc/make.conf to make the ports building 
against the "real" OpenSSL library.

However I often need to build the latest source code from GitHub, so 
that I cannot make use of the ports approach (I tend to use the pkg 
management).

What is the best way to use the "real" OpenSSL libraries when building 
custom source code on FreeBSD?

Thanks in advance for any advice.

     - Alex




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?qunic4$3ntq$1>