I am compiling a package that links against the OpenSSL static libraries libssl.a
and libcrypto.a
which are included with libssl-dev
in Debian/Ubuntu. However the actual location of these files depends on the architecture and distribution at hand.
Is there some sort of method or environment variable that I can use in the Makefile to give the linker the correct path to the system directory with static libraries? Currently I am using:
-L/usr/lib/x86_64-linux-gnu/ -L/usr/lib/i686-linux-gnu/ -lssl -lcrypto
However this gives a bunch of warnings if these dirs do not exist, and might still not generally work.
If you are sure, that your users are using aptitude as package manager, that is default for Debian/Ubuntu, than you can use apt-file to locate libraries.
$ apt-file update
$ LIBSSL_PATH=`apt-file list libssl-dev | grep libssl.a | awk '{ print $2 }'`
$ LIBCRYPTO_PATH=`apt-file list libssl-dev | grep libcrypto.a | awk '{ print $2 }'`
Next you may use them. Say on my machine:
$ echo $LIBSSL_PATH
/usr/lib/libssl.a
I known no other way and doubt if any exists.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With