在ubuntu 18.04中安装ruby 1.8时出错

时间:2018-05-02 03:29:22

标签: ruby

我删除了已安装的ruby:sudo apt-get purge ruby 我下载并编译ruby:

wget http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p374.tar.gz
tar -xzvf ruby-1.8.7-p374.tar.gz
cd ruby-1.8.7-p374
./configure

使用特定的编译器构建MakeFile。

make CC=gcc-4.4

编译时发生错误。

编译openssl时出错

编译openssl

make[1]: 디렉터리 '/ruby-1.8.7-p374/ext/openssl' 들어감
gcc-4.4 -I. -I../.. -I../../. -I../.././ext/openssl - 
DRUBY_EXTCONF_H=\"extconf.h\"    -fPIC -g -O2    -c ossl_hmac.c
In file included from ossl.h:57,
             from ossl_hmac.c:13:
/usr/include/openssl/asn1_mac.h:10: error: #error "This file is obsolete; 
please update your software."
In file included from ossl.h:205,
             from ossl_hmac.c:13:
openssl_missing.h:79: error: macro "EVP_MD_CTX_create" passed 1 arguments, but takes just 0
openssl_missing.h:83: error: expected declaration specifiers or ‘...’ before ‘(’ token
openssl_missing.h:83: error: conflicting types for ‘EVP_MD_CTX_reset’
/usr/include/openssl/evp.h:498: note: previous declaration of 
‘EVP_MD_CTX_reset’ was here
openssl_missing.h:91: error: expected declaration specifiers or ‘...’ before ‘(’ token
ossl_hmac.c: In function ‘ossl_hmac_alloc’:
ossl_hmac.c:54: error: invalid application of ‘sizeof’ to incomplete type ‘HMAC_CTX’ 
ossl_hmac.c:54: error: invalid application of ‘sizeof’ to incomplete type ‘HMAC_CTX’ `enter code here`
ossl_hmac.c: In function ‘ossl_hmac_initialize’:
ossl_hmac.c:73: warning: ‘HMAC_Init’ is deprecated (declared at /usr/include/openssl/hmac.h:28)
ossl_hmac.c: In function ‘hmac_final’:
ossl_hmac.c:114: error: storage size of ‘final’ isn’t known
ossl_hmac.c: In function ‘ossl_hmac_reset’:
ossl_hmac.c:182: warning: ‘HMAC_Init’ is deprecated (declared at /usr/include/openssl/hmac.h:28)
Makefile:197: recipe for target 'ossl_hmac.o' failed
make[1]: *** [ossl_hmac.o] Error 1
make[1]: DIR '/ruby-1.8.7-p374/ext/openssl' 나감
Makefile:293: recipe for target 'all' failed
make: *** [all] Error 1`

如何解决此错误..

1 个答案:

答案 0 :(得分:0)

我在Ubuntu 18.04上安装1.9.3时遇到了非常类似的错误。我做了以下事情来解决它-

sudo apt install libssl1.0-dev

,然后重建Ruby。