红联Linux门户
Linux帮助

deepin使用rvm安装ruby出现make: *** [build-ext] Error 2错误

发布时间:2016-10-25 10:09:54来源:linux网站作者:KevinWave
ruby是很怪的东西,我之前也成功安装了几次,重新安装的deepin又无法安装,出现错误了。
root@kelly-pc:~# rvm install 2.1.4
Searching for binary rubies, this might take some time.
No binary rubies available for: debian/8/x86_64/ruby-2.1.4.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for debian.
Requirements installation successful.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.1.4, this may take a while depending on your cpu(s)...
ruby-2.1.4 - #downloading ruby-2.1.4, this may take a while depending on your connection...
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404 Not Found
The requested url does not exist(22): 'http://ruby.taobao.org/mirrors/ruby/2.1/ruby-2.1.4.tar.bz2'
Checking fallback: http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.4.tar.bz2
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100 11.4M  100 11.4M    0     0   231k      0  0:00:50  0:00:50 --:--:-- 86209
ruby-2.1.4 - #extracting ruby-2.1.4 to /usr/local/rvm/src/ruby-2.1.4....
ruby-2.1.4 - #configuring..........................................
ruby-2.1.4 - #post-configuration..
ruby-2.1.4 - #compiling.................................
Error running '__rvm_make -j1',
showing last 15 lines of /usr/local/rvm/log/1453860140_ruby-2.1.4/make.log
ossl_ssl.c:139:27: error: ‘SSLv3_client_method’ undeclared here (not in a function)
OSSL_SSL_METHOD_ENTRY(SSLv3_client),
^
ossl_ssl.c:115:69: note: in definition of macro ‘OSSL_SSL_METHOD_ENTRY’
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
^
Makefile:280: recipe for target 'ossl_ssl.o' failed
make[2]: *** [ossl_ssl.o] Error 1
make[2]: Leaving directory '/usr/local/rvm/src/ruby-2.1.4/ext/openssl'
exts.mk:192: recipe for target 'ext/openssl/all' failed
make[1]: *** [ext/openssl/all] Error 2
make[1]: Leaving directory '/usr/local/rvm/src/ruby-2.1.4'
uncommon.mk:180: recipe for target 'build-ext' failed
make: *** [build-ext] Error 2
++ return 2
There has been an error while running make. Halting the installation.
 
于是去看/usr/local/rvm/log/1453860140_ruby-2.1.4/make.log最后的15行:
ossl_ssl.c:115:69: note: in definition of macro ‘OSSL_SSL_METHOD_ENTRY’
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
^
ossl_ssl.c:139:27: error: ‘SSLv3_client_method’ undeclared here (not in a function)
OSSL_SSL_METHOD_ENTRY(SSLv3_client),
^
ossl_ssl.c:115:69: note: in definition of macro ‘OSSL_SSL_METHOD_ENTRY’
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
^
Makefile:280: recipe for target 'ossl_ssl.o' failed
make[2]: *** [ossl_ssl.o] Error 1
make[2]: Leaving directory '/usr/local/rvm/src/ruby-2.1.4/ext/openssl'
exts.mk:192: recipe for target 'ext/openssl/all' failed
make[1]: *** [ext/openssl/all] Error 2
make[1]: Leaving directory '/usr/local/rvm/src/ruby-2.1.4'
uncommon.mk:180: recipe for target 'build-ext' failed
make: *** [build-ext] Error 2
++ return 2
 
看这样应该是openssl的问题,于是我用uncommon.mk:180: recipe for target ‘build-ext’ fail 去搜,在SO找到了解决方法,应该能解决大部分的问题,但是我的不行:
rvm pkg install openssl
rvm install 2.2.1 --with-openssl-dir=$HOME/.rvm/usr
 
我重启之后再安装就变这样:
root@kelly-pc:~# rvm install 2.2.1
Searching for binary rubies, this might take some time.
Found remote file https://rvm_io.global.ssl.fastly.net/binaries/debian/8/x86_64/ruby-2.2.1.tar.bz2
Checking requirements for debian.
Requirements installation successful.
ruby-2.2.1 - #configure
ruby-2.2.1 - #download
** Resuming transfer from byte position 14925824
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100 9240k  100 9240k    0     0  85841      0  0:01:50  0:01:50 --:--:--  525k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.2.1 - #validate archive
ruby-2.2.1 - #extract
ruby-2.2.1 - #validate binary
ruby-2.2.1 - #setup
ruby-2.2.1 - #gemset created /usr/local/rvm/gems/ruby-2.2.1@global
ruby-2.2.1 - #importing gemset /usr/local/rvm/gemsets/global.gems....................
ruby-2.2.1 - #generating global wrappers........
ruby-2.2.1 - #gemset created /usr/local/rvm/gems/ruby-2.2.1
ruby-2.2.1 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.2.1 - #generating default wrappers........
 
于是搜No checksum for downloaded archive, recording checksum in user configuration. 用下面代码安装:
rvm reinstall ruby --disable-binary
 
还是一样,想哭。看来还是ssl的补丁问题,搜索recipe for target ‘ossl_ssl.o’ failed
终于github上有一老兄帮解决了,如下:
wget https://github.com/ruby/ruby/commit/801e1fe46d83c856844ba18ae4751478c59af0d1.diff -O openssl.patch
rvm install --patch ./openssl.patch 2.2.1
 
终于,看我的!
root@kelly-pc:~# rvm install --patch ./openssl.patch 2.2.1
ruby-2.2.1 - #removing src/ruby-2.2.1..
Checking requirements for debian.
Requirements installation successful.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.2.1, this may take a while depending on your cpu(s)...
ruby-2.2.1 - #downloading ruby-2.2.1, this may take a while depending on your connection...
ruby-2.2.1 - #extracting ruby-2.2.1 to /usr/local/rvm/src/ruby-2.2.1....
ruby-2.2.1 - #applying patch /root/./openssl.patch.
ruby-2.2.1 - #applying patch /usr/local/rvm/patches/ruby/2.2.1/fix_installing_bundled_gems.patch.
ruby-2.2.1 - #configuring.................................
ruby-2.2.1 - #post-configuration..
ruby-2.2.1 - #compiling.................................
ruby-2.2.1 - #installing................
ruby-2.2.1 - #making binaries executable..
ruby-2.2.1 - #downloading rubygems-2.4.8
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  437k  100  437k    0     0  28378      0  0:00:15  0:00:15 --:--:-- 98160
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.2.1 - #extracting rubygems-2.4.8....
ruby-2.2.1 - #removing old rubygems.........
ruby-2.2.1 - #installing rubygems-2.4.8......................
ruby-2.2.1 - #gemset created /usr/local/rvm/gems/ruby-2.2.1@global
ruby-2.2.1 - #importing gemset /usr/local/rvm/gemsets/global.gems...........................
ruby-2.2.1 - #generating global wrappers........
ruby-2.2.1 - #gemset created /usr/local/rvm/gems/ruby-2.2.1
ruby-2.2.1 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.2.1 - #generating default wrappers........
ruby-2.2.1 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.2.1 - #complete 
Ruby was built without documentation, to build it run: rvm docs generate-ri
 
本文永久更新地址:http://www.linuxdiyf.com/linux/25373.html