別人都安新版本,我tm可好,安老的
在編譯bcclient時,make失敗
root@z-E7:*******/bcclient/libbitcoin# make
Making all in include/bitcoin
make[1]: 進入目錄“/root/src/bcclient/libbitcoin/include/bitcoin”
make[1]: 對“all”無需做任何事。
make[1]: 離開目錄“/root/src/bcclient/libbitcoin/include/bitcoin”
Making all in src
make[1]: 進入目錄“/root/src/bcclient/libbitcoin/src”
CXX satoshi_serialize.lo
In file included from ./../include/bitcoin/constants.hpp:25:0,
from ./../include/bitcoin/satoshi_serialize.hpp:23,
from satoshi_serialize.cpp:20:
./../include/bitcoin/utility/big_number.hpp:91:12: error: field ‘bignum_’ has incomplete type ‘BIGNUM {aka bignum_st}’
BIGNUM bignum_;
^~~~~~~
In file included from /usr/include/openssl/bn.h:19:0,
from ./../include/bitcoin/utility/big_number.hpp:23,
from ./../include/bitcoin/constants.hpp:25,
from ./../include/bitcoin/satoshi_serialize.hpp:23,
from satoshi_serialize.cpp:20:
/usr/include/openssl/ossl_typ.h:80:16: note: forward declaration of ‘BIGNUM {aka struct bignum_st}’
typedef struct bignum_st BIGNUM;
^~~~~~~~~
Makefile:603: recipe for target 'satoshi_serialize.lo' failed
make[1]: *** [satoshi_serialize.lo] Error 1
make[1]: 離開目錄“/root/src/bcclient/libbitcoin/src”
Makefile:511: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
擁嗚啥呢,我也不知道
在看源碼big_number.hpp:91行的BIGNUM bignum_;提示這個BIGNUM有問題,而最開頭倒入了#include<openssl/bn.h>
反正就是openssl升級了,API改了
結果呢,還是不好使。。。白忙
還是下面的簡易方法好使了。。。上哪說理去。。
最開始找到方法比較簡易
wget http://www.openssl.org/source/openssl-1.0.2a.tar.gz
tar -xvzf openssl-1.0.2a.tar.gz
cd openssl-1.0.2a
./config --prefix=/usr/
make && make install
主要是看着他的輸出目錄就沒敢用 (不然用個粑粑,最后還是用的上賣弄這4 5步)
----------------------------------下面的就當表演賣萌了----------------------------------------
1.下載
這里我看一般教程都放在了/usr/local/src下面,我嫌麻煩。。。
wget http://www.openssl.org/source/openssl-1.0.2g.tar.gz
tar -xvzf openssl-1.0.2g.tar.gz
cd openssl-1.0.2g
2.配置編譯
./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib
make depend
make
make test
make depend是配置后的提示:building前需要,我不懂啥意思就照做了
--prefix和--openssldir =設置OpenSSL的輸出路徑。
shared = force來創建一個共享庫。
zlib =使用zlib庫啟用壓縮。
3.安裝
make install
過程:
點擊查看代碼
make[2]: 離開目錄“/usr/local/ssl/lib”
make[1]: 離開目錄“/usr/local/ssl/lib”
OpenSSL shared libraries have been installed in:
/usr/local/ssl
If this directory is not in a standard system path for dynamic/shared
libraries, then you will have problems linking and executing
applications that use OpenSSL libraries UNLESS:
* you link with static (archive) libraries. If you are truly
paranoid about security, you should use static libraries.
* you use the GNU libtool code during linking
(http://www.gnu.org/software/libtool/libtool.html)
* you use pkg-config during linking (this requires that
PKG_CONFIG_PATH includes the path to the OpenSSL shared
library directory), and make use of -R or -rpath.
(http://www.freedesktop.org/software/pkgconfig/)
* you specify the system-wide link path via a command such
as crle(1) on Solaris systems.
* you add the OpenSSL shared library directory to /etc/ld.so.conf
and run ldconfig(8) on Linux systems.
* you define the LD_LIBRARY_PATH, LIBPATH, SHLIB_PATH (HP),
DYLD_LIBRARY_PATH (MacOS X) or PATH (Cygwin and DJGPP)
environment variable and add the OpenSSL shared library
directory to it.
One common tool to check the dynamic dependencies of an executable
or dynamic library is ldd(1) on most UNIX systems.
See any operating system documentation and manpages about shared
libraries for your version of UNIX. The following manpages may be
helpful: ld(1), ld.so(1), ld.so.1(1) [Solaris], dld.sl(1) [HP],
ldd(1), crle(1) [Solaris], pldd(1) [Solaris], ldconfig(8) [Linux],
chatr(1) [HP].
cp libcrypto.pc /usr/local/ssl/lib/pkgconfig
chmod 644 /usr/local/ssl/lib/pkgconfig/libcrypto.pc
cp libssl.pc /usr/local/ssl/lib/pkgconfig
chmod 644 /usr/local/ssl/lib/pkgconfig/libssl.pc
cp openssl.pc /usr/local/ssl/lib/pkgconfig
chmod 644 /usr/local/ssl/lib/pkgconfig/openssl.pc
4 配置鏈接庫
cd /etc/ld.so.conf.d/
vim openssl-1.0.2g.conf
# 文件中添加庫路徑
/usr/local/ssl/lib
# 保存退出
重新加載動態鏈接
ldconfig -v
結果輸出
/sbin/ldconfig.real: 無法對 /usr/local/lib/x86_64-linux-gnu 進行 stat 操作: 沒有那個文件或目錄
/sbin/ldconfig.real: 多次給出路徑“/lib/x86_64-linux-gnu”
/sbin/ldconfig.real: 多次給出路徑“/usr/lib/x86_64-linux-gnu”
/usr/lib/x86_64-linux-gnu/libfakeroot:
libfakeroot-0.so -> libfakeroot-tcp.so
/usr/local/lib:
libbitcoinconsensus.so.0 -> libbitcoinconsensus.so.0.0.0
/usr/local/ssl/lib:
libcrypto.so.1.0.0 -> libcrypto.so.1.0.0
libssl.so.1.0.0 -> libssl.so.1.0.0
/lib/x86_64-linux-gnu:
libdbus-1.so.3 -> libdbus-1.so.3.19.4
libgcc_s.so.1 -> libgcc_s.so.1
/sbin/ldconfig.real: /lib/x86_64-linux-gnu/ld-2.27.so is the dynamic linker, ignoring
ld-linux-x86-64.so.2 -> ld-2.27.so
.......
libshotwell-authenticator.so.0 -> libshotwell-authenticator.so.0.28.4
/lib:
/usr/lib:
libnetpbm.so.10 -> libnetpbm.so.10.0
libnatpmp.so.1 -> libnatpmp.so.1
libgjs.so.0 -> libgjs.so.0.0.0
5 配置二進制文件
備份:
mv /usr/bin/c_rehash /usr/bin/c_rehash.BEKUP
mv /usr/bin/openssl /usr/bin/openssl.BEKUP
vim /etc/environment
#看看之前有沒有舊的ssl路徑,刪掉
#添加:
/usr/local/ssl/bin
6 更新環境
source /etc/environment
7 測試
which openssl
# /usr/local/ssl/bin/openssl
openssl version -v
# OpenSSL 1.0.2g 1 Mar 2016
測試代碼自己寫吧
參考:
https://blog.csdn.net/weixin_44302212/article/details/113488894
https://www.jianshu.com/p/b7e392b1b90c
https://blog.csdn.net/weixin_30299539/article/details/98981318
https://www.cnblogs.com/thechosenone95/p/10603110.html