概要
openssl のバージョンを1.1.1から1.0.2に落とそうとした時にはまり、
1.0.2を用いてライブラリの関数の一部を構築しようとした時にはまったので備忘録。
出たエラー
bn.hh:47:9: note: suggested alternative: 'BN_print'
BN_init(&b);
^~~~~~~
BN_print
このようなエラーはopensslのバージョンの違いからくる。
参考 https://github.com/vertcoin-project/vertcoin-core/issues/43
この場合このライブラリは1.0系を使っている。
このため、1.0系へとダウングレードしてみて走るかどうかを検証したかった。
したがって以下のコマンドを実行。
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
sudo make install
これで
openssl version
をすると1.0.2系に落とせていることがわかったものの、ライブラリをビルドする時に
/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o): relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1
このようなエラーに散々悩まされたが、
openssl 1.0.2系のビルドの際に、
make clean
export CFLAGS=-fPIC
./config shared --prefix=/usr
とすることで解決した。
終わり。