RHELでrubyをソースからインストール
RHELでrubyをソースからインストール
昨日yumからインストールしたrubyがちょっと古かった件。こんどはソースからインストールする。
tarを展開してconfigure
$ tar -zxvf /tmp/ruby-2.6.3.tar.gz $ cd ruby-2.6.3 $ ./configure $ make (中略) make[2]: ディレクトリ `/home/hoge/ruby/ruby-2.6.3/ext/openssl' に入ります compiling openssl_missing.c In file included from openssl_missing.c:21:0: openssl_missing.h:75:0: 警告: "X509_STORE_get_ex_new_index" が再定義されました [デフォルトで有効] # define X509_STORE_get_ex_new_index(l, p, newf, dupf, freef) \ ^ In file included from /usr/local/include/openssl/x509.h:320:0, from /usr/local/include/openssl/pem.h:17, from /usr/local/include/openssl/ui.h:19, from /usr/local/include/openssl/engine.h:24, from openssl_missing.c:14: /usr/local/include/openssl/x509_vfy.h:326:0: 備考: ここが以前の宣言がある位置です #define X509_STORE_get_ex_new_index(l, p, newf, dupf, freef) \ ^ In file included from /usr/local/include/openssl/bn.h:20:0, from /usr/local/include/openssl/engine.h:18, from openssl_missing.c:14: openssl_missing.c: 関数 ‘ossl_HMAC_CTX_new’ 内: openssl_missing.c:65:43: エラー: invalid application of ‘sizeof’ to incomplete type ‘HMAC_CTX’ HMAC_CTX *ctx = OPENSSL_malloc(sizeof(HMAC_CTX)); ^ openssl_missing.c:68:5: 警告: 関数 ‘HMAC_CTX_init’ の暗黙的な宣言です [-Wimplicit-function-declaration] HMAC_CTX_init(ctx); ^ openssl_missing.c: 関数 ‘ossl_HMAC_CTX_free’ 内: openssl_missing.c:78:2: 警告: 関数 ‘HMAC_CTX_cleanup’ の暗黙的な宣言です [-Wimplicit-function-declaration] HMAC_CTX_cleanup(ctx); ^ openssl_missing.c: 関数 ‘ossl_X509_CRL_get0_signature’ 内: openssl_missing.c:90:13: エラー: 不完全型のポインタへの間接参照 *psig = crl->signature; ^ openssl_missing.c:92:13: エラー: 不完全型のポインタへの間接参照 *palg = crl->sig_alg; ^ openssl_missing.c: 関数 ‘ossl_X509_REQ_get0_signature’ 内: openssl_missing.c:102:13: エラー: 不完全型のポインタへの間接参照 *psig = req->signature; ^ openssl_missing.c:104:13: エラー: 不完全型のポインタへの間接参照 *palg = req->sig_alg; ^ openssl_missing.c: トップレベル: cc1: 警告: 認識できないコマンドラインオプション "-Wno-tautological-compare" です [デフォルトで有効] cc1: 警告: 認識できないコマンドラインオプション "-Wno-self-assign" です [デフォルトで有効] cc1: 警告: 認識できないコマンドラインオプション "-Wno-parentheses-equality" です [デフォルトで有効] cc1: 警告: 認識できないコマンドラインオプション "-Wno-constant-logical-operand" です [デフォルトで有効] cc1: 警告: 認識できないコマンドラインオプション "-Wno-cast-function-type" です [デフォルトで有効] make[2]: *** [openssl_missing.o] エラー 1 make[2]: ディレクトリ `/home/hoge/ruby/ruby-2.6.3/ext/openssl' から出ます make[1]: *** [ext/openssl/all] エラー 2 make[1]: ディレクトリ `/home/hoge/ruby/ruby-2.6.3' から出ます make: *** [build-ext] エラー 2
なにやらエラーになった。コンパイルしようとしているソースからみるとopensslのライブラリとincludeファイルが一致していないのが原因っぽい。
このマシン、yumではいっているopensslとソースでいれているopensslが両方はいっているんです。
最新であるソースからインストールした方を参照するにする。
$ export CFLAGS=-I/usr/local/include $ export LDFLAGS=-L/usr/local/lib64 $ ./configure $ make
エラーなく終了。ようやくインストールできました。