Question

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

/usr/local/lib/ruby/1.9.1/net/http.rb:762:in "initialize": Connection refused - connect(2) (Errno::ECONNREFUSED)

...

Requesting http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz

Full message:

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

It seems like compilation from sources requires ruby sources and it tries to download it from ruby site directly. How can I install perftools.rb via http proxy?

Was it helpful?

Solution

It turned out that ruby_core_source gem doesn't read properly http_proxy variable on my ubuntu box. I've downloaded tar.gz file from ruby site and change a bit 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:}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top