rubygems / bundler

Manage your Ruby application's gem dependencies
https://bundler.io
MIT License
4.88k stars 2k forks source link

Unexpected error #5269

Closed bkhor closed 7 years ago

bkhor commented 7 years ago

Hey guys . I tried to install metasploit-framework , and to install all dependencies from Gemfile , and I've got unexpected error. Details : `Error details

Errno::EACCES: Permission denied @ rb_sysopen - /home/bkhor/.bundle/cache/compact_index/rubygems.org.443.29b0360b937aa4d161703e6160654e47/versions
  /usr/lib/ruby/2.3.0/fileutils.rb:1393:in `initialize'
  /usr/lib/ruby/2.3.0/fileutils.rb:1393:in `open'
  /usr/lib/ruby/2.3.0/fileutils.rb:1393:in `block in copy_file'
  /usr/lib/ruby/2.3.0/fileutils.rb:1392:in `open'
  /usr/lib/ruby/2.3.0/fileutils.rb:1392:in `copy_file'
  /usr/lib/ruby/2.3.0/fileutils.rb:1360:in `copy'
  /usr/lib/ruby/2.3.0/fileutils.rb:472:in `block in copy_entry'
  /usr/lib/ruby/2.3.0/fileutils.rb:1498:in `wrap_traverse'
  /usr/lib/ruby/2.3.0/fileutils.rb:469:in `copy_entry'
  /usr/lib/ruby/2.3.0/fileutils.rb:530:in `rescue in block in mv'
  /usr/lib/ruby/2.3.0/fileutils.rb:527:in `block in mv'
  /usr/lib/ruby/2.3.0/fileutils.rb:1571:in `block in fu_each_src_dest'
  /usr/lib/ruby/2.3.0/fileutils.rb:1587:in `fu_each_src_dest0'
  /usr/lib/ruby/2.3.0/fileutils.rb:1569:in `fu_each_src_dest'
  /usr/lib/ruby/2.3.0/fileutils.rb:517:in `mv'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb:55:in `block in update'
  /usr/lib/ruby/2.3.0/tmpdir.rb:89:in `mktmpdir'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb:29:in `update'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb:65:in `update'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb:56:in `update_and_parse_checksums!'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/fetcher/compact_index.rb:67:in `available?'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/fetcher/compact_index.rb:15:in `call'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/fetcher/compact_index.rb:15:in `block in compact_index_request'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/fetcher.rb:157:in `use_api'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/source/rubygems.rb:332:in `block in api_fetchers'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/source/rubygems.rb:332:in `select'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/source/rubygems.rb:332:in `api_fetchers'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/source/rubygems.rb:337:in `block in remote_specs'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/index.rb:10:in `build'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/source/rubygems.rb:336:in `remote_specs'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/source/rubygems.rb:83:in `specs'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/definition.rb:261:in `block (2 levels) in index'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/definition.rb:259:in `each'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/definition.rb:259:in `block in index'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/index.rb:10:in `build'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/definition.rb:256:in `index'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/definition.rb:250:in `resolve'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/definition.rb:174:in `specs'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/definition.rb:162:in `resolve_remotely!'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/installer.rb:225:in `resolve_if_need'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/installer.rb:78:in `run'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/installer.rb:24:in `install'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli/install.rb:71:in `run'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli.rb:189:in `install'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli.rb:20:in `dispatch'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli.rb:11:in `start'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/exe/bundle:34:in `block in <top (required)>'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/friendly_errors.rb:100:in `with_friendly_errors'
  /var/lib/gems/2.3.0/gems/bundler-1.13.6/exe/bundle:26:in `<top (required)>'
  /usr/local/bin/bundle:23:in `load'
  /usr/local/bin/bundle:23:in `<main>'

Environment

Bundler 1.13.6 Rubygems 2.6.8 Ruby 2.3.1p112 (2016-04-26 revision 0) [x86_64-linux-gnu] GEM_HOME /var/lib/gems/2.3.0 GEM_PATH /var/lib/gems/2.3.0:/home/bkhor/.gem/ruby/2.3.0:/usr/lib/x86_64-linux-gnu/rubygems-integration/2.3.0:/usr/share/rubygems-integration/2.3.0:/usr/share/rubygems-integration/all Git 2.7.4 --- TEMPLATE END ---------------------------------------------------------------- `

Please help . :)

colby-swandale commented 7 years ago

Please check to make sure Bundler has the appropriate permissions to read & write to /home/bkhor/.bundle and any sub files & folders.

bkhor commented 7 years ago

Ok , thanks , that was silly , because I forgot to use sudo before bundle install . But my next problem was when I executedbundle install as root , I've got that bundler have got an error during installing pg (0.19.0) , and after this I've tried to do sudo gem install pg -v '0.19.0' , and I've unsuccessful install , because I've got extconf failed , exit code 1. What can I do ?

colby-swandale commented 7 years ago

Can you please share the error message you're experiencing and also share the output of bundle env

bkhor commented 7 years ago

Here is error message : `Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension.

current directory: /var/lib/gems/2.3.0/gems/pg-0.19.0/ext

/usr/bin/ruby2.3 -r ./siteconf20161222-2154-16mq75a.rb extconf.rb checking for pg_config... yes Using config values from /usr/bin/pg_config You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application. You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application. checking for libpq-fe.h... no Can't find the 'libpq-fe.h header 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 --without-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/bin/$(RUBY_BASE_NAME)2.3 --with-pg --without-pg --enable-windows-cross --disable-windows-cross --with-pg-config --without-pg-config --with-pg_config --without-pg_config --with-pg-dir --without-pg-dir --with-pg-include --without-pg-include=${pg-dir}/include --with-pg-lib --without-pg-lib=${pg-dir}/lib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/pg-0.19.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.3.0/gems/pg-0.19.0 for inspection. Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/pg-0.19.0/gem_make.out And here isbundle envoutput : Environment

Bundler   1.13.6
Rubygems  2.6.8
Ruby      2.3.1p112 (2016-04-26 revision 0) [x86_64-linux-gnu]
Git       2.7.4

Gemfile

source 'https://rubygems.org'
# Add default group gems to `metasploit-framework.gemspec`:
#   spec.add_runtime_dependency '<name>', [<version requirements>]
gemspec name: 'metasploit-framework'

# separate from test as simplecov is not run on travis-ci
group :coverage do
  # code coverage for tests
  # any version newer than 0.5.4 gives an Encoding error when trying to read the source files.
  # see: https://github.com/colszowka/simplecov/issues/127 (hopefully fixed in 0.8.0)
  gem 'simplecov'
end

group :development do
  # Markdown formatting for yard
  gem 'redcarpet'
  # generating documentation
  gem 'yard'
  # for development and testing purposes
  gem 'pry'
  # module documentation
  gem 'octokit', '~> 4.0'
  # rails-upgrade staging gems
end

group :development, :test do
  # automatically include factories from spec/factories
  gem 'factory_girl_rails'
  # Make rspec output shorter and more useful
  gem 'fivemat'
  # running documentation generation tasks and rspec tasks
  gem 'rake'
  # Define `rake spec`.  Must be in development AND test so that its available by default as a rake test when the
  # environment is development
  gem 'rspec-rails'
end

group :test do
  # cucumber extension for testing command line applications, like msfconsole
  gem 'aruba'
  # cucumber + automatic database cleaning with database_cleaner
  gem 'cucumber-rails', :require => false
  gem 'shoulda-matchers'
  # Manipulate Time.now in specs
  gem 'timecop'
end

Gemfile.lock

PATH
  remote: .
  specs:
    metasploit-framework (4.13.9)
      actionpack (~> 4.2.6)
      activerecord (~> 4.2.6)
      activesupport (~> 4.2.6)
      bcrypt
      bit-struct
      filesize
      jsobfu
      json
      metasm
      metasploit-concern
      metasploit-credential
      metasploit-model
      metasploit-payloads (= 1.2.4)
      metasploit_data_models
      metasploit_payloads-mettle (= 0.1.4)
      msgpack
      nessus_rest
      net-ssh
      network_interface
      nokogiri
      octokit
      openssl-ccm
      openvas-omp
      packetfu
      patch_finder
      pcaprub
      pg
      railties
      rb-readline-r7
      recog
      redcarpet
      rex-arch (= 0.1.4)
      rex-bin_tools
      rex-core
      rex-encoder
      rex-exploitation
      rex-java
      rex-mime
      rex-nop
      rex-ole
      rex-powershell
      rex-random_identifier
      rex-registry
      rex-rop_builder
      rex-socket
      rex-sslscan
      rex-struct2
      rex-text
      rex-zip
      robots
      rubyntlm
      rubyzip
      sqlite3
      sshkey
      tzinfo
      tzinfo-data
      windows_error

GEM
  remote: https://rubygems.org/
  specs:
    actionpack (4.2.7.1)
      actionview (= 4.2.7.1)
      activesupport (= 4.2.7.1)
      rack (~> 1.6)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (4.2.7.1)
      activesupport (= 4.2.7.1)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    activemodel (4.2.7.1)
      activesupport (= 4.2.7.1)
      builder (~> 3.1)
    activerecord (4.2.7.1)
      activemodel (= 4.2.7.1)
      activesupport (= 4.2.7.1)
      arel (~> 6.0)
    activesupport (4.2.7.1)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    addressable (2.5.0)
      public_suffix (~> 2.0, >= 2.0.2)
    arel (6.0.3)
    arel-helpers (2.3.0)
      activerecord (>= 3.1.0, < 6)
    aruba (0.14.2)
      childprocess (~> 0.5.6)
      contracts (~> 0.9)
      cucumber (>= 1.3.19)
      ffi (~> 1.9.10)
      rspec-expectations (>= 2.99)
      thor (~> 0.19)
    bcrypt (3.1.11)
    bit-struct (0.15.0)
    builder (3.2.2)
    capybara (2.11.0)
      addressable
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      xpath (~> 2.0)
    childprocess (0.5.9)
      ffi (~> 1.0, >= 1.0.11)
    coderay (1.1.1)
    contracts (0.14.0)
    cucumber (2.4.0)
      builder (>= 2.1.2)
      cucumber-core (~> 1.5.0)
      cucumber-wire (~> 0.0.1)
      diff-lcs (>= 1.1.3)
      gherkin (~> 4.0)
      multi_json (>= 1.7.5, < 2.0)
      multi_test (>= 0.1.2)
    cucumber-core (1.5.0)
      gherkin (~> 4.0)
    cucumber-rails (1.4.5)
      capybara (>= 1.1.2, < 3)
      cucumber (>= 1.3.8, < 4)
      mime-types (>= 1.16, < 4)
      nokogiri (~> 1.5)
      railties (>= 3, < 5.1)
    cucumber-wire (0.0.1)
    diff-lcs (1.2.5)
    docile (1.1.5)
    erubis (2.7.0)
    factory_girl (4.8.0)
      activesupport (>= 3.0.0)
    factory_girl_rails (4.8.0)
      factory_girl (~> 4.8.0)
      railties (>= 3.0.0)
    faraday (0.10.0)
      multipart-post (>= 1.2, < 3)
    ffi (1.9.14)
    filesize (0.1.1)
    fivemat (1.3.2)
    gherkin (4.0.0)
    i18n (0.7.0)
    jsobfu (0.4.1)
      rkelly-remix (= 0.0.6)
    json (1.8.3)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    metasm (1.0.2)
    metasploit-concern (2.0.3)
      activemodel (~> 4.2.6)
      activesupport (~> 4.2.6)
      railties (~> 4.2.6)
    metasploit-credential (2.0.8)
      metasploit-concern
      metasploit-model
      metasploit_data_models
      pg
      railties
      rubyntlm
      rubyzip
    metasploit-model (2.0.3)
      activemodel (~> 4.2.6)
      activesupport (~> 4.2.6)
      railties (~> 4.2.6)
    metasploit-payloads (1.2.4)
    metasploit_data_models (2.0.10)
      activerecord (~> 4.2.6)
      activesupport (~> 4.2.6)
      arel-helpers
      metasploit-concern
      metasploit-model
      pg
      postgres_ext
      railties (~> 4.2.6)
      recog (~> 2.0)
    metasploit_payloads-mettle (0.1.4)
    method_source (0.8.2)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mini_portile2 (2.1.0)
    minitest (5.10.1)
    msgpack (1.0.2)
    multi_json (1.12.1)
    multi_test (0.1.2)
    multipart-post (2.0.0)
    nessus_rest (0.1.6)
    net-ssh (3.2.0)
    network_interface (0.0.1)
    nokogiri (1.6.8.1)
      mini_portile2 (~> 2.1.0)
    octokit (4.6.2)
      sawyer (~> 0.8.0, >= 0.5.3)
    openssl-ccm (1.2.1)
    openvas-omp (0.0.4)
    packetfu (1.1.11)
      network_interface (~> 0.0)
      pcaprub (~> 0.12)
    patch_finder (1.0.2)
    pcaprub (0.12.4)
    pg (0.19.0)
    pg_array_parser (0.0.9)
    postgres_ext (3.0.0)
      activerecord (>= 4.0.0)
      arel (>= 4.0.1)
      pg_array_parser (~> 0.0.9)
    pry (0.10.4)
      coderay (~> 1.1.0)
      method_source (~> 0.8.1)
      slop (~> 3.4)
    public_suffix (2.0.4)
    rack (1.6.5)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.7)
      activesupport (>= 4.2.0.beta, < 5.0)
      nokogiri (~> 1.6.0)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    railties (4.2.7.1)
      actionpack (= 4.2.7.1)
      activesupport (= 4.2.7.1)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (12.0.0)
    rb-readline-r7 (0.5.2.0)
    recog (2.1.2)
      nokogiri
    redcarpet (3.3.4)
    rex-arch (0.1.4)
      rex-text
    rex-bin_tools (0.1.1)
      metasm
      rex-arch
      rex-core
      rex-struct2
      rex-text
    rex-core (0.1.3)
    rex-encoder (0.1.1)
      metasm
      rex-arch
      rex-text
    rex-exploitation (0.1.4)
      jsobfu
      metasm
      rex-arch
      rex-encoder
      rex-text
    rex-java (0.1.3)
    rex-mime (0.1.1)
      rex-text
    rex-nop (0.1.0)
      rex-arch
    rex-ole (0.1.3)
      rex-text
    rex-powershell (0.1.68)
      rex-random_identifier
      rex-text
    rex-random_identifier (0.1.1)
      rex-text
    rex-registry (0.1.1)
    rex-rop_builder (0.1.1)
      metasm
      rex-core
      rex-text
    rex-socket (0.1.2)
      rex-core
    rex-sslscan (0.1.1)
      rex-socket
      rex-text
    rex-struct2 (0.1.0)
    rex-text (0.2.9)
    rex-zip (0.1.1)
      rex-text
    rkelly-remix (0.0.6)
    robots (0.10.1)
    rspec-core (3.5.4)
      rspec-support (~> 3.5.0)
    rspec-expectations (3.5.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.5.0)
    rspec-mocks (3.5.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.5.0)
    rspec-rails (3.5.2)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec-core (~> 3.5.0)
      rspec-expectations (~> 3.5.0)
      rspec-mocks (~> 3.5.0)
      rspec-support (~> 3.5.0)
    rspec-support (3.5.0)
    rubyntlm (0.6.1)
    rubyzip (1.2.0)
    sawyer (0.8.1)
      addressable (>= 2.3.5, < 2.6)
      faraday (~> 0.8, < 1.0)
    shoulda-matchers (3.1.1)
      activesupport (>= 4.0.0)
    simplecov (0.12.0)
      docile (~> 1.1.0)
      json (>= 1.8, < 3)
      simplecov-html (~> 0.10.0)
    simplecov-html (0.10.0)
    slop (3.6.0)
    sqlite3 (1.3.12)
    sshkey (1.8.0)
    thor (0.19.4)
    thread_safe (0.3.5)
    timecop (0.8.1)
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    tzinfo-data (1.2016.10)
      tzinfo (>= 1.0.0)
    windows_error (0.0.2)
    xpath (2.0.0)
      nokogiri (~> 1.3)
    yard (0.9.5)

PLATFORMS
  ruby

DEPENDENCIES
  aruba
  cucumber-rails
  factory_girl_rails
  fivemat
  metasploit-framework!
  octokit (~> 4.0)
  pry
  rake
  redcarpet
  rspec-rails
  shoulda-matchers
  simplecov
  timecop
  yard

BUNDLED WITH
   1.13.6

metasploit-framework.gemspec

# coding: utf-8

# During build, the Gemfile is temporarily moved and
# we must manually define the project root
if ENV['MSF_ROOT']
  lib = File.realpath(File.expand_path('lib', ENV['MSF_ROOT']))
else
  # have to use realpath as metasploit-framework is often loaded through a symlink and tools like Coverage and debuggers
  # require realpaths.
  lib = File.realpath(File.expand_path('../lib', __FILE__))
end

$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'metasploit/framework/version'
require 'metasploit/framework/rails_version_constraint'

Gem::Specification.new do |spec|
  spec.name          = 'metasploit-framework'
  spec.version       = Metasploit::Framework::GEM_VERSION
  spec.authors       = ['Metasploit Hackers']
  spec.email         = ['metasploit-hackers@lists.sourceforge.net']
  spec.summary       = 'metasploit-framework'
  spec.description   = 'metasploit-framework'
  spec.homepage      = 'https://www.metasploit.com'
  spec.license       = 'BSD-3-clause'

  spec.files         = `git ls-files`.split($/).reject { |file|
    file =~ /^documentation|^data\/gui|^external/
  }
  spec.bindir = '.'
  if ENV['CREATE_BINSTUBS']
    spec.executables   = [
      'msfconsole',
      'msfd',
      'msfrpc',
      'msfrpcd',
      'msfupdate',
      'msfvenom'
    ]
  end
  spec.test_files    = spec.files.grep(%r{^spec/})
  spec.require_paths = ["lib"]

  # Database support
  spec.add_runtime_dependency 'activerecord', *Metasploit::Framework::RailsVersionConstraint::RAILS_VERSION
  # Need 3+ for ActiveSupport::Concern
  spec.add_runtime_dependency 'activesupport', *Metasploit::Framework::RailsVersionConstraint::RAILS_VERSION
  # Needed for config.action_view for view plugin compatibility for Pro
  spec.add_runtime_dependency 'actionpack', *Metasploit::Framework::RailsVersionConstraint::RAILS_VERSION
  # Needed for some admin modules (cfme_manageiq_evm_pass_reset.rb)
  spec.add_runtime_dependency 'bcrypt'
  # Needed for Javascript obfuscation
  spec.add_runtime_dependency 'jsobfu'
  # Needed for some admin modules (scrutinizer_add_user.rb)
  spec.add_runtime_dependency 'json'
  # Metasm compiler/decompiler/assembler
  spec.add_runtime_dependency 'metasm'
  # Metasploit::Concern hooks
  spec.add_runtime_dependency 'metasploit-concern'
  # Metasploit::Credential database models
  spec.add_runtime_dependency 'metasploit-credential'
  # Database models shared between framework and Pro.
  spec.add_runtime_dependency 'metasploit_data_models'
  # Things that would normally be part of the database model, but which
  # are needed when there's no database
  spec.add_runtime_dependency 'metasploit-model'
  # Needed for Meterpreter
  spec.add_runtime_dependency 'metasploit-payloads', '1.2.4'
  # Needed for the next-generation POSIX Meterpreter
  spec.add_runtime_dependency 'metasploit_payloads-mettle', '0.1.4'
  # Needed by msfgui and other rpc components
  spec.add_runtime_dependency 'msgpack'
  # get list of network interfaces, like eth* from OS.
  spec.add_runtime_dependency 'network_interface'
  # NTLM authentication
  spec.add_runtime_dependency 'rubyntlm'
  # Needed by anemone crawler
  spec.add_runtime_dependency 'nokogiri'
  # Needed by db.rb and Msf::Exploit::Capture
  spec.add_runtime_dependency 'packetfu'
  # For sniffer and raw socket modules
  spec.add_runtime_dependency 'pcaprub'
  # Needed for module caching in Mdm::ModuleDetails
  spec.add_runtime_dependency 'pg'
  # Run initializers for metasploit-concern, metasploit-credential, metasploit_data_models Rails::Engines
  spec.add_runtime_dependency 'railties'
  # required for OS fingerprinting
  spec.add_runtime_dependency 'recog'
  # required for bitlocker fvek extraction
  spec.add_runtime_dependency 'openssl-ccm'
  # Needed for documentation generation
  spec.add_runtime_dependency 'octokit'
  spec.add_runtime_dependency 'redcarpet'
  # Needed for Microsoft patch finding tool (msu_finder)
  spec.add_runtime_dependency 'patch_finder'
  # TimeZone info
  spec.add_runtime_dependency 'tzinfo-data'
  # Gem for dealing with SSHKeys
  spec.add_runtime_dependency 'sshkey'
  # BitStruct Library used for handling certain Protocol Header/Packet construction
  spec.add_runtime_dependency 'bit-struct'
  # Library for interpreting Windows error codes and strings
  spec.add_runtime_dependency 'windows_error'

  #
  # Protocol Libraries
  #
  spec.add_runtime_dependency 'net-ssh'

  #
  # REX Libraries
  #
  # Core of the Ruby Exploitation Library
  spec.add_runtime_dependency 'rex-core'
  # Text manipulation library for things like generating random string
  spec.add_runtime_dependency 'rex-text'
  # Library for Generating Randomized strings valid as Identifiers such as variable names
  spec.add_runtime_dependency 'rex-random_identifier'
  # library for creating Powershell scripts for exploitation purposes
  spec.add_runtime_dependency 'rex-powershell'
  # Library for processing and creating Zip compatbile archives
  spec.add_runtime_dependency 'rex-zip'
  # Library for parsing offline Windows Registry files
  spec.add_runtime_dependency 'rex-registry'
  # Library for parsing Java serialized streams
  spec.add_runtime_dependency 'rex-java'
  # Library for C-style structs
  spec.add_runtime_dependency 'rex-struct2'
  # Library which contains architecture specific information such as registers, opcodes,
  # and stack manipulation routines.
  spec.add_runtime_dependency 'rex-arch', '0.1.4'
  # Library for working with OLE.
  spec.add_runtime_dependency 'rex-ole'
  # Library for creating and/or parsing MIME messages.
  spec.add_runtime_dependency 'rex-mime'
  # Library for Dynamic Multi-byte x86 NOP generation
  spec.add_runtime_dependency 'rex-nop'
  # Library for parsing and manipulating executable binaries
  spec.add_runtime_dependency 'rex-bin_tools'
  # Rex Socket Abstraction Layer
  spec.add_runtime_dependency 'rex-socket'
  # Library for scanning a server's SSL/TLS capabilities
  spec.add_runtime_dependency 'rex-sslscan'
  # Library and tool for finding ROP gadgets in a supplied binary
  spec.add_runtime_dependency 'rex-rop_builder'
  # Library for polymorphic encoders; used for payload encoding
  spec.add_runtime_dependency 'rex-encoder'
  # Library for exploit development helpers
  spec.add_runtime_dependency 'rex-exploitation'

  # rb-readline doesn't work with Ruby Installer due to error with Fiddle:
  #   NoMethodError undefined method `dlopen' for Fiddle:Module
  unless Gem.win_platform?
    # Command line editing, history, and tab completion in msfconsole
    # Use the Rapid7 fork until the official gem catches up
    spec.add_runtime_dependency 'rb-readline-r7'
  end

  # Needed by anemone crawler
  spec.add_runtime_dependency 'robots'
  # Needed by some modules
  spec.add_runtime_dependency 'rubyzip'
  # Needed for some post modules
  spec.add_runtime_dependency 'sqlite3'
  # required for Time::TZInfo in ActiveSupport
  spec.add_runtime_dependency 'tzinfo'
  # Needed so that disk size output isn't horrible
  spec.add_runtime_dependency 'filesize'
  # Needed for openvas plugin
  spec.add_runtime_dependency 'openvas-omp'
  # Needed by metasploit nessus bridge
  spec.add_runtime_dependency 'nessus_rest'
end

`

Here is the /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/pg-0.19.0/mkmf.log results :

`find_executable: checking for pg_config... -------------------- yes


"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -W format -Werror=format-security -fPIC conftest.c -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -lruby-2.3
-lpthread -lgmp -ldl -lcrypt -lm -lc" checked program was: / begin / 1: #include "ruby.h" 2: 3: int main(int argc, char *argv) 4: { 5: return 0; 6: } / end */

"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -W format -Werror=format-security -fPIC conftest.c -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -lruby-2.3
-Wl,-rpath, -lpthread -lgmp -ldl -lcrypt -lm -lc" checked program was: / begin / 1: #include "ruby.h" 2: 3: int main() {return 0;} / end /

find_header: checking for libpq-fe.h... -------------------- no

"gcc -E -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -W error=format-security -fPIC conftest.c -o conftest.i" conftest.c:3:22: fatal error: libpq-fe.h: No such file or directory compilation terminated. checked program was: / begin / 1: #include "ruby.h" 2: 3: #include / end /


`

colby-swandale commented 7 years ago

You're either missing or Bundler cannot find the PostgreSQL libraries that the pg gem requires. This is not an error with Bundler itself. Make sure that the required libraries are installed or use bundle config if necessary

bkhor commented 7 years ago

But ,why it returns extconf failed , error code 1` ?

colby-swandale commented 7 years ago
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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.

because the pg requires libraries that it's unable to find on your system. Bundler will return an error if a gem was unable to be installed successfully.

coilysiren commented 7 years ago

The original issue was resolved, and colby-swandale gave a solution to the followup postgres issue, so I'm closing