如何在Ubuntu14.04 x_86_64上将openssl头文件和库文件添加到系统环境变量中?

时间:2017-01-05 03:31:26

标签: linux ssl openssl openssh

wget http://mirror.internode.on.net/pub/OpenBSD/OpenSSH/portable/openssh-7.4p1.tar.gz  
wget https://www.openssl.org/source/openssl-1.0.2j.tar.gz

我已经尝试过至少三种配置来安装openssl-1.0.2j:

./config

./config --prefix=/usr/local --openssldir=/usr/local/openssl

./config -Wl, -rpath=/usr/local/ssl/lib

制作 make install 之后,看起来安装成功了:
它还显示正确的版本:
Root @ ebd:/usr/local/src/openssh-7.4p1#openssl version -a
OpenSSL 1.0.2j 2016年9月26日
建立在:可重复的构建,未指定的日期
平台:linux-x86_64
...

但是当我安装openssh-7.4p1时,我收到了一个错误:

checking whether snprintf correctly terminates long strings... yes
checking whether vsnprintf returns correct values on overflow... yes
checking whether snprintf can declare const char *fmt... yes
checking whether system supports SO_PEERCRED getsockopt... yes
checking for (overly) strict mkstemp... yes
checking if openpty correctly handles controlling tty... yes
checking whether AI_NUMERICSERV is declared... yes
checking whether getpgrp requires zero arguments... yes
checking OpenSSL header version... 100020af (OpenSSL 1.0.2j  26 Sep 2016)
checking OpenSSL library version... 1000106f (OpenSSL 1.0.1f 6 Jan 2014)
checking whether OpenSSL's headers match the library... no
configure: error: Your OpenSSL headers do not match your
    library. Check config.log for details.
    If you are sure your installation is consistent, you can disable the check
    by running "./configure --without-openssl-header-check".
    Also see contrib/findssl.sh for help identifying header/library mismatches.

我按照以下方法安装openssh-7.4p1:

tar xf openssh-7.4p1.tar.gz
cd openssh-7.4p1/
./configure --prefix=/opt/openssh-7.4p1 --with-md5-passwords
make && make install

我知道可以使用参数: -with-ssl-dir = PATH

但我不想使用它,我想知道如何将openssl头文件和库文件添加到系统环境变量中。

以下是最近更新的消息 我刚刚使用以下内容安装openssh。

cd openssh-7.4p1/
CFLAGS="-I /usr/local/openssl/include -L /usr/local/openssl/lib -Wl,-rpath=/usr/local/openssl/lib" ./configure --prefix=/opt/openssh-7.4p1 --with-md5-passwords
make
make install

我收到了错误。

root@srv13:~/openssh-7.4p1# /opt/openssh-7.4p1/bin/ssh -V
/opt/openssh-7.4p1/bin/ssh: /usr/local/openssl/lib/libcrypto.so.1.0.0: no version information available (required by /opt/openssh-7.4p1/bin/ssh)
/opt/openssh-7.4p1/bin/ssh: /usr/local/openssl/lib/libcrypto.so.1.0.0: no version information available (required by /opt/openssh-7.4p1/bin/ssh)

enter image description here

root@srv13:~/openssl-1.0.2j# which openssl
/usr/bin/openssl
root@srv13:~/openssl-1.0.2j# ls -ld /usr/bin/openssl
lrwxrwxrwx 1 root root 30 Jan  5 21:54 /usr/bin/openssl -> /usr/local/openssl/bin/openssl
root@srv13:~/openssl-1.0.2j# 
root@srv13:~/openssl-1.0.2j# ldd /usr/local/openssl/bin/openssl 
    linux-vdso.so.1 =>  (0x00007ffcf997f000)
    libssl.so.1.0.0 => /usr/local/openssl/lib/libssl.so.1.0.0 (0x00007f1850994000)
    libcrypto.so.1.0.0 => /usr/local/openssl/lib/libcrypto.so.1.0.0 (0x00007f1850544000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f185017f000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f184ff7b000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f1850c04000)
    root@srv13:~/openssl-1.0.2j# ls /usr/local/openssl/lib/libcrypto.so.1.0.0 -ld
    -r-xr-xr-x 1 root root 2690206 Jan  5 21:51 /usr/local/openssl/lib/libcrypto.so.1.0.0

root@srv13:~/openssl-1.0.2j# ldd /opt/openssh-7.4p1/bin/ssh
/opt/openssh-7.4p1/bin/ssh: /usr/local/openssl/lib/libcrypto.so.1.0.0: no version information available (required by /opt/openssh-7.4p1/bin/ssh)
/opt/openssh-7.4p1/bin/ssh: /usr/local/openssl/lib/libcrypto.so.1.0.0: no version information available (required by /opt/openssh-7.4p1/bin/ssh)
    linux-vdso.so.1 =>  (0x00007fff0dbf2000)
    libcrypto.so.1.0.0 => /usr/local/openssl/lib/libcrypto.so.1.0.0 (0x00007f57ba287000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f57ba083000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f57b9e6a000)
    libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f57b9c4f000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f57b988a000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f57ba993000)

0 个答案:

没有答案