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.
我正在编译一个包,它链接到OpenSSL静态库libssl。一个和libcrypto。在Debian/Ubuntu中包含了libssl-dev。然而,这些文件的实际位置取决于当前的体系结构和分布。
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:
在Makefile中,我是否可以使用某种方法或环境变量来为链接器提供带有静态库的系统目录的正确路径?目前我用:
-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.
然而,如果这些dirs不存在,并且通常仍然不能工作,那么这将给出大量的警告。
1 个解决方案
#1
3
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.
如果您确信,您的用户正在使用aptitude作为包管理,这是Debian/Ubuntu的默认,而您无法使用apt文件来定位库。
$ 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.
我不知道还有别的办法,我怀疑是否存在。
#1
3
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.
如果您确信,您的用户正在使用aptitude作为包管理,这是Debian/Ubuntu的默认,而您无法使用apt文件来定位库。
$ 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.
我不知道还有别的办法,我怀疑是否存在。