Установка perftools.rb через прокси - PullRequest
1 голос
/ 03 апреля 2012

sudo gem install perftools.rb -p http://10.10.10.10:3128 ...

/ usr / local / lib / ruby ​​/ 1.9.1 / net / http.rb: 762: in "инициализировать": Отказ в соединении - соединение (2) (Errno :: ECONNREFUSED)

...

Запрос http://ftp.ruby -lang.org / pub / ruby ​​/ 1.9 / ruby-1.9.3-p0.tar.gz

Полное сообщение:

sudo gem install perftools.rb -p http://10.249.134.143:3128
Building native extensions.  This could take a while...
ERROR:  Error installing perftools.rb:
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb
(I'm about to compile google-perftools.. this will definitely take a while)
-- tar zpxvf gperftools-2.0.tar.gz
-- patch -p1 < ../../../patches/perftools.patch
-- patch -p1 < ../../../patches/perftools-notests.patch
-- patch -p1 < ../../../patches/perftools-pprof.patch
-- patch -p1 < ../../../patches/perftools-gc.patch
-- patch -p1 < ../../../patches/perftools-debug.patch
-- patch -p1 < ../../../patches/perftools-objects.patch
-- patch -p1 < ../../../patches/perftools-frames.patch
-- patch -p1 < ../../../patches/perftools-realtime.patch
-- sed -i -e 's,SpinLock,ISpinLock,g' src/*.cc src/*.h src/base/*.cc src/base/*.h
-- ./configure --disable-heap-profiler --disable-heap-checker --disable-debugalloc --      disable-shared
-- make
checking for method.h... no
checking for vm_core.h... no
/usr/local/lib/ruby/gems/1.9.1/gems/ruby_core_source-0.1.5/lib/ruby_core_source.rb:39:      Use RbConfig instead of obsolete and deprecated Config.
checking for method.h... no
checking for vm_core.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby
/usr/local/lib/ruby/1.9.1/net/http.rb:762:in `initialize': Connection refused -     connect(2) (Errno::ECONNREFUSED)
from /usr/local/lib/ruby/1.9.1/net/http.rb:762:in `open'
from /usr/local/lib/ruby/1.9.1/net/http.rb:762:in `block in connect'
from /usr/local/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
from /usr/local/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
from /usr/local/lib/ruby/1.9.1/net/http.rb:762:in `connect'
from /usr/local/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
from /usr/local/lib/ruby/1.9.1/net/http.rb:744:in `start'
from /usr/local/lib/ruby/1.9.1/net/http.rb:1284:in `request'
from /usr/local/lib/ruby/gems/1.9.1/gems/ruby_core_source-  0.1.5/lib/contrib/uri_ext.rb:239:in `block in read'
from /usr/local/lib/ruby/gems/1.9.1/gems/ruby_core_source-0.1.5/lib/contrib/uri_ext.rb:286:in `connect'
from /usr/local/lib/ruby/gems/1.9.1/gems/ruby_core_source-0.1.5/lib/contrib/uri_ext.rb:234:in `read'
from /usr/local/lib/ruby/gems/1.9.1/gems/ruby_core_source-0.1.5/lib/contrib/uri_ext.rb:128:in `download'
from /usr/local/lib/ruby/gems/1.9.1/gems/ruby_core_source-0.1.5/lib/ruby_core_source.rb:55:in `block in create_makefile_with_core'
from /usr/local/lib/ruby/1.9.1/tempfile.rb:316:in `open'
from /usr/local/lib/ruby/gems/1.9.1/gems/ruby_core_source-0.1.5/lib/ruby_core_source.rb:51:in `create_makefile_with_core'
from extconf.rb:104:in `<main>'
Requesting http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz


Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/perftools.rb-2.0.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/perftools.rb-2.0.0/ext/gem_make.out

Похоже, что для компиляции из источников требуются источники ruby, и она пытается загрузить ее непосредственно с сайта ruby.Как я могу установить perftools.rb через http прокси?

1 Ответ

0 голосов
/ 09 апреля 2012

Оказалось, что гем ruby_core_source неправильно читает переменную http_proxy в моем Ubuntu box.Я скачал файл tar.gz с сайта ruby ​​и изменил бит 1.9.1 / gems / ruby_core_source-0.1.5 / lib / ruby_core_source.rb:

53: temp.binmode
54:  uri = URI.parse(uri_path)
55: #uri.download(temp)
57:
58:  tgz = Zlib::GzipReader.new(File.open("/home/dir/ruby-1.9.3-p125.tar.gz",     "rb"))
59:
60:  FileUtils.mkdir_p(dest_dir)
61:  Dir.mktmpdir { |dir|
62:   inc_dir = dir + "/" + ruby_dir + "/*.inc"
63:   hdr_dir = dir + "/" + ruby_dir + "/*.h"
64:   Archive::Tar::Minitar.unpack(tgz, dir)
65:   FileUtils.cp(Dir.glob([ inc_dir, hdr_dir ]), dest_dir)
66: }
67:}
...