「RSA_SSLV23_PADDING」は宣言されていません(この関数で最初に使用)。 「RSA_NO_PADDING」のことですか? asdfを使用してruby-2.7.1をコンパイルするとき
概要
asdf または RVM を使用して Ruby-2.7.1 をコンパイル中にこの問題が発生します。
erlang のインストールでも問題が発生します。
エラーの可能性があります
generating x86_64-linux-fake.rb
x86_64-linux-fake.rb updated
./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems -r./x86_64-linux-fake ./tool/rbinstall.rb --make="make" --dest-dir="" --extout=".ext" --mflags="" --make-flags="" --data-mode=0644 --prog-mode=0755 --installed-list .installed.list --mantype="doc" --rdoc-output=".ext/rdoc" --html-output=".ext/html"
/tmp/ruby-build.20220515222647.5893.R2e2fF/ruby-2.7.1/lib/rubygems/core_ext/kernel_require.rb:92:in `require': libssl.so.1.1: cannot open shared object file: No such file or directory - /tmp/ruby-build.20220515222647.5893.R2e2fF/ruby-2.7.1/.ext/x86_64-linux/openssl.so (LoadError)
from /tmp/ruby-build.20220515222647.5893.R2e2fF/ruby-2.7.1/lib/rubygems/core_ext/kernel_require.rb:92:in `require'
from /tmp/ruby-build.20220515222647.5893.R2e2fF/ruby-2.7.1/.ext/common/openssl.rb:13:in `<top (required)>'
from /tmp/ruby-build.20220515222647.5893.R2e2fF/ruby-2.7.1/lib/rubygems/core_ext/kernel_require.rb:92:in `require'
from /tmp/ruby-build.20220515222647.5893.R2e2fF/ruby-2.7.1/lib/rubygems/core_ext/kernel_require.rb:92:in `require'
from /tmp/ruby-build.20220515222647.5893.R2e2fF/ruby-2.7.1/lib/rubygems/security.rb:12:in `<top (required)>'
from /tmp/ruby-build.20220515222647.5893.R2e2fF/ruby-2.7.1/lib/rubygems/core_ext/kernel_require.rb:92:in `require'
from /tmp/ruby-build.20220515222647.5893.R2e2fF/ruby-2.7.1/lib/rubygems/core_ext/kernel_require.rb:92:in `require'
from /tmp/ruby-build.20220515222647.5893.R2e2fF/ruby-2.7.1/lib/rubygems/package.rb:44:in `<top (required)>'
from /tmp/ruby-build.20220515222647.5893.R2e2fF/ruby-2.7.1/lib/rubygems/core_ext/kernel_require.rb:92:in `require'
from /tmp/ruby-build.20220515222647.5893.R2e2fF/ruby-2.7.1/lib/rubygems/core_ext/kernel_require.rb:92:in `require'
from /tmp/ruby-build.20220515222647.5893.R2e2fF/ruby-2.7.1/lib/rubygems/installer.rb:11:in `<top (required)>'
from /tmp/ruby-build.20220515222647.5893.R2e2fF/ruby-2.7.1/lib/rubygems/core_ext/kernel_require.rb:92:in `require'
from /tmp/ruby-build.20220515222647.5893.R2e2fF/ruby-2.7.1/lib/rubygems/core_ext/kernel_require.rb:92:in `require'
from ./tool/rbinstall.rb:713:in `<module:RbInstall>'
from ./tool/rbinstall.rb:649:in `<main>'
make: *** [uncommon.mk:373: do-install-all] Error 1
または
ossl_pkey_rsa.c:877:58: error: ‘RSA_SSLV23_PADDING’ undeclared (first use in this function); did you mean ‘RSA_NO_PADDING’?
877 | #define DefRSAConst(x) rb_define_const(cRSA, #x, INT2NUM(RSA_##x))
| ^~~~
../.././include/ruby/ruby.h:262:33: note: in definition of macro ‘RB_INT2FIX’
262 | #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
| ^
../.././include/ruby/ruby.h:1609:20: note: in expansion of macro ‘RB_INT2NUM’
1609 | #define INT2NUM(x) RB_INT2NUM(x)
| ^~~~~~~~~~
ossl_pkey_rsa.c:877:50: note: in expansion of macro ‘INT2NUM’
877 | #define DefRSAConst(x) rb_define_const(cRSA, #x, INT2NUM(RSA_##x))
| ^~~~~~~
ossl_pkey_rsa.c:942:5: note: in expansion of macro ‘DefRSAConst’
942 | DefRSAConst(SSLV23_PADDING);
| ^~~~~~~~~~~
ossl_pkey_rsa.c:877:58: note: each undeclared identifier is reported only once for each function it appears in
877 | #define DefRSAConst(x) rb_define_const(cRSA, #x, INT2NUM(RSA_##x))
| ^~~~
../.././include/ruby/ruby.h:262:33: note: in definition of macro ‘RB_INT2FIX’
262 | #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
| ^
../.././include/ruby/ruby.h:1609:20: note: in expansion of macro ‘RB_INT2NUM’
1609 | #define INT2NUM(x) RB_INT2NUM(x)
| ^~~~~~~~~~
ossl_pkey_rsa.c:877:50: note: in expansion of macro ‘INT2NUM’
877 | #define DefRSAConst(x) rb_define_const(cRSA, #x, INT2NUM(RSA_##x))
| ^~~~~~~
ossl_pkey_rsa.c:942:5: note: in expansion of macro ‘DefRSAConst’
942 | DefRSAConst(SSLV23_PADDING);
| ^~~~~~~~~~~
ossl_pkey.c: At top level
apt-get を使用して openssl バージョン 1.1 をインストールしようとしましたが、機能しません。
解決策
Ruby のコンパイル中に openssl の問題が発生した場合、私は通常、このような解決策を使用します。私はできることなら、インストールされている OS のバージョンをいじりたくないので、RVM などは使用しません。
wget https://www.openssl.org/source/openssl-1.1.1q.tar.gz
tar xvzf openssl-1.1.1q.tar.gz
cd openssl-1.1.1q
mkdir -p $HOME/lib/openssl
./config --prefix=$HOME/lib/openssl
make
make install
cp /etc/ssl/certs/* $HOME/lib/openssl/ssl/certs
tar xvzf ruby-2.7.1.tar.gz
cd ruby-2.7.1
./configure --prefix=$HOME/.rubies/ruby-2.7.1 --with-openssl-dir=$HOME/lib/openssl
make
make install