在AIX上编译OpenSSH(PKIXSSH)时无法链接到OpenSSL加密库
我试图在AIX上使用同样是OpenSSL的编译版本编译(OpenSSH的分支),但没有成功 配置阶段中显示的错误如下:在AIX上编译OpenSSH(PKIXSSH)时无法链接到OpenSSL加密库,openssl,aix,openssh,Openssl,Aix,Openssh,我试图在AIX上使用同样是OpenSSL的编译版本编译(OpenSSH的分支),但没有成功 配置阶段中显示的错误如下: checking how to link programs using OpenSSL functions... fail configure: error: cannot link with OpenSSL crypto library ./configure --prefix=/soft/openssh-8.1/
checking how to link programs using OpenSSL functions... fail
configure: error: cannot link with OpenSSL crypto library
./configure --prefix=/soft/openssh-8.1/ \
--sbindir=/soft/openssh-8.1/bin \
--sysconfdir=/soft/openssh-8.1/data \
--datadir=/soft/openssh-8.1/data \
--with-pid-dir=/soft/openssh-8.1/data \
--without-stackprotect \
--with-pam \
--with-md5-passwords \
--with-ssl-dir=/soft/openssh-8.1 \
--with-privsep-path=/var/empty/sshd
OpenSSH 1.1.1d已在/soft/OpenSSH-8.1下成功编译,因此库位于/soft/OpenSSH-8.1/lib下
$ ls /soft/openssh-8.1/lib
engines-1.1 libcrypto.so libcrypto64.so.1.1 libssl.a libssl.so.1 libssl_a.a
libcrypto.a libcrypto.so.1 libcrypto_a.a libssl.so libssl64.so.1.1 pkgconfig
通过示例,可以正确找到openssl二进制文件的和:
$ ldd /soft/openssh-8.1/bin/openssl
/soft/openssh-8.1/bin/openssl needs:
/soft/openssh-8.1/lib/libssl.a(libssl64.so.1.1)
/soft/openssh-8.1/lib/libcrypto.a(libcrypto64.so.1.1)
/opt/freeware/lib/libz.so
/usr/ccs/lib/libpthreads.a(shr_xpg5_64.o)
/usr/ccs/lib/libc.a(shr_64.o)
/unix
/soft/openssh-8.1/lib/libcrypt.a(shr_64.o)
我用不同的LDFLAGS组合进行了测试,但没有成功
powerpc上的AIX版本是7.1
GCC版本为4.6.1
运行configure命令来配置OpenSSH的编译如下:
checking how to link programs using OpenSSL functions... fail
configure: error: cannot link with OpenSSL crypto library
./configure --prefix=/soft/openssh-8.1/ \
--sbindir=/soft/openssh-8.1/bin \
--sysconfdir=/soft/openssh-8.1/data \
--datadir=/soft/openssh-8.1/data \
--with-pid-dir=/soft/openssh-8.1/data \
--without-stackprotect \
--with-pam \
--with-md5-passwords \
--with-ssl-dir=/soft/openssh-8.1 \
--with-privsep-path=/var/empty/sshd
有什么想法吗?在AIX上编译的关键是使用变量LIBPATH,相当于Linux上的LD_LIBRARY_PATH 特别是在这种情况下,还设置了变量blibpath,这在配置脚本中用于将自定义库路径作为选项传递给编译器,并将此路径设置为二进制文件中的库搜索路径 为确保编译中使用64位二进制文件,请在configure命令之前设置以下变量:
OPENSSH_PATH="/soft/openssh-8.1"
export PATH="/soft/perl-5.16.3/bin:$OPENSSH_PATH/bin:$PATH"
# Library path in linking time
export blibpath="$OPENSSH_PATH/lib:/opt/freeware/lib64:/usr/lib:/lib"
# Library path in run time
export LIBPATH="$OPENSSH_PATH/lib:/opt/freeware/lib64:/opt/freeware/lib:/opt/lib64:/opt/64/lib:/opt/lib:/usr/lib64:/usr/lib:/lib:/usr/ccs/lib/"
export CFLAGS="-g -O2"
export CC="gcc -maix64"
export OBJECT_MODE=64
export NM="nm -X64"
export AR="ar -X64"
如上所述,要设置的两个主要变量是编译阶段使用的blibpath,以及运行二进制文件时使用的LIBPATH
结果二进制文件已正确设置库:-)
ldd
命令告诉您使用了哪些库,而dump-X64-Hv
告诉您将在哪些路径中使用这些库。现在您尝试编译的是openssh-8.1还是pkixssh-12.3?如果是后者,您是否使用了configure选项--with ssl dir=/soft/openssh-8.1/
?您好!是pkixssh-12.3。我们已经在使用这个选项。我们几乎已经完成了编译。简而言之,我将回答我自己的问题:-)一篇关于AIX编译说明的好文章在