[Privoxy-devel] OpenSSL library location
Roland Rosenfeld
roland at spinnaker.de
Sun Dec 4 11:53:29 CET 2022
Hi Ian!
On Sa, 03 Dez 2022, Ian Silvester wrote:
> Somewhat noob questions about how privoxy locate(s) the openssl
> library file at runtime versus the setup on my build machine.
>
> In order to have the headers installed for compilation, I installed
> OpenSSL on the Mac via Homebrew. This installs a hive under
> /usr/local/opt/openssl. The Mac however comes with OpenSSL libraries
> at /usr/lib. If I include the libraries in my install package from
> /usr/local/opt/openssl/lib, will Privoxy find this version of the
> library automatically, or will it rely on the PATH of the target
> machine and hence find the wrong version at /usr/lib? I hardly think
> I can go overwriting the system built-in library files, so what to
> do?
>
> I appreciate this is a very generic "how to package software with
> external library dependencies" question, but I don't want to
> distribute something that kind-of sort-of works but might be using
> down-level libraries.
I'm not familiar how MacOS works, but since it is based on BSD, I
expect it to work similar to Linux, so maybe you can reuse what I tell
you about Linux:
In Linux there is a command ldd, which can be used to check which
shared libraries an excecutable uses:
# ldd /usr/sbin/privoxy
linux-vdso.so.1 (0x00007ffdb978e000)
libbrotlidec.so.1 => /usr/lib/x86_64-linux-gnu/libbrotlidec.so.1 (0x00007f1e10bf2000)
libmbedtls.so.12 => /usr/lib/x86_64-linux-gnu/libmbedtls.so.12 (0x00007f1e10bc2000)
libmbedx509.so.0 => /usr/lib/x86_64-linux-gnu/libmbedx509.so.0 (0x00007f1e10ba1000)
libmbedcrypto.so.3 => /usr/lib/x86_64-linux-gnu/libmbedcrypto.so.3 (0x00007f1e10b3a000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f1e10b1d000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f1e10aaa000)
libpcreposix.so.3 => /usr/lib/x86_64-linux-gnu/libpcreposix.so.3 (0x00007f1e10aa3000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1e10a81000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1e108ac000)
libbrotlicommon.so.1 => /usr/lib/x86_64-linux-gnu/libbrotlicommon.so.1 (0x00007f1e10889000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1e10cb1000)
On the left of every line you see the library name, that is referenced
in the privoxy binary, while at right of the "=>" you see where the
shared library is found on my system. If the library cannot
automatically been found this looks like:
libmbedtls.so.12 => not found
In Linux the location of the shared library paths is listed in
/etc/ld.so.conf (which includes /etc/ld.so.conf.d/*).
The (cached) list of all libraries found in these paths can be shown
with
ldconfig -p
On a user base you can extend the list of library paths using the
environment variable LD_LIBRARY_PATH, but this usually shouldn't be
necessary.
Hope that this can be transferred for MacOS...
Greetings
Roland
More information about the Privoxy-devel
mailing list