linux 安装库 编译提示-lcrypto 无法链接,缺少 crypto 库


编译提示-lcrypto 无法链接,缺少 crypto 库

方法一
-------------------------------------
crypto 基于openssl,决定安装openssl-devel
#yum install openssl openssl-devel

方法二
-------------------------------------
手动安装
下载源码,例如
#wget http://www.openssl.org/source/openssl-0.9.6c.tar.gz
#gzip -cd openssl-0.9.6c.tar.gz | tar xvf -
#cd openssl-0.9.6c
#./config
 -------------------------------------
 Operating system: i686-whatever-linux2
 Configuring for linux-elf
 -------------------------------------
 说明只要是i386指令集的系统即可,默认的是linux-elf,就采用默认的了
#./Configure --prefix=/usr/local --openssldir=/usr/local/ssl  linux-elf

此处只生成静态库,如果需要生成动态库,则指定./config shared ...

prefix 是安装目录,openssldir 是配置文件目录,shared 作用是生成动态连接库。
#make clean
#make
#make install

编译安装openssl报错:POD document had syntax errors at /usr/bin/pod2man line 69. make: *** [install_docs]

错误如下:

1
2
3
4
5
6
7
cms.pod around line 457: Expected text after =item, not a number
cms.pod around line 461: Expected text after =item, not a number
cms.pod around line 465: Expected text after =item, not a number
cms.pod around line 470: Expected text after =item, not a number
cms.pod around line 474: Expected text after =item, not a number
POD document had syntax errors at /usr/bin/pod2man line 69.
make: *** [install_docs] Error 1

解决方法: 

执行:

rm -f /usr/bin/pod2man 

#strip /usr/local/bin/openssl

#make do_linux-shared
#cp libcrypto.so.0.9.6 /usr/local/lib
#cp libssl.so.0.9.6 /usr/local/lib
#cd /usr/local/lib
#ln -sf libcrypto.so.0.9.6 libcrypto.so.0
#ln -sf libcrypto.so.0.9.6 libcrypto.so
#ln -sf libssl.so.0.9.6 libssl.so.0
#ln -sf libssl.so.0.9.6 libssl.so

方法三
-------------------------------------
如果已经有库了,例如
/usr/lib里面有了libcrypto.so.2
加个符号链接到libcrypto.so

一定要保证libcrypto.so在 LD_LIBRARY_PATH下

你可能感兴趣的:(linux)