If you want to install it anywhere else, run config like this:
On Unix:
$ ./config --prefix=/opt/openssl --openssldir=/usr/local/ss
enable-crypto-mdebug
Build support for debugging memory allocated via
OPENSSL_malloc() or OPENSSL_zalloc().
enable-crypto-mdebug-backtrace
As for crypto-mdebug, but additionally provide backtrace
information for allocated memory.
TO BE USED WITH CARE: this uses GNU C functionality, and
is therefore not usable for non-GNU config targets. If
your build complains about the use of '-rdynamic' or the
lack of header file execinfo.h, this option is not for you.
ALSO NOTE that even though execinfo.h is available on your
system (through Gnulib), the functions might just be stubs
that do nothing.
no-deprecated
Don't build with support for any deprecated APIs. This is the
same as using "--api" and supplying the latest version
no-dso
Don't build support for loading Dynamic Shared Objects.
zlib
Build with support for zlib compression/decompression.
编译openssl时使用:./config --prefix=/usr/local/openssl enable-deprecated zlib-dynamic enable-crypto-mdebug enable-crypto-mdebug-backtrace 加入上面的选项
make install
sudo mv /usr/bin/openssl /usr/bin/openssl.bak
sudo mv /usr/include/openssl /usr/include/openssl.bak
sudo ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
sudo ln -s /usr/local/openssl/include/openssl /usr/include/openssl
实测应用程序需要绝对路径包含
sudo sh -c "echo '/usr/local/openssl/lib ’ >> /etc/ld.so.conf
实测应用程序需要-L 指定路径编译
sudo ldconfig -v
sudo cp /usr/local/openssl/include/openssl/* /usr/include/openssl/
sudo cp -r /usr/local/openssl/lib/* /usr/lib/openssh/
sudo cp /usr/local/openssl/bin/openssl /usr/bin/openssl
验证:
openssl version
OpenSSL 1.1.1g 21 Apr 2020
编译应用程序时指定库
sudo gcc -o lash1 lhash.c -L /usr/lib/openssh/ -lcrypto