Bundler声称它正在安装pg,但后来抱怨它无法安装它(RHEL7)

时间:2016-10-03 21:59:55

标签: ruby-on-rails ruby rubygems rhel7

你知道为什么bundler声称它正在安装pg gem然后抱怨它无法编译它?它表明gems没有并行安装,但后来继续尝试安装pg,没有产生错误,去安装rmagick,然后为pg产生错误。

当我查看Gemfile时,rggick列在pg之前...非常困惑。

Rubygems 2.0.14 is not threadsafe, so your gems will be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation.
Using rake 11.3.0
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.9.1
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using pkg-config 1.1.7
Using rack 1.6.4
Using mime-types-data 3.2016.0521
Using arel 6.0.3
Using addressable 2.4.0
Using bundler 1.13.2
Using coderay 1.1.1
Using concurrent-ruby 1.0.2
Using htmlentities 4.3.1
Using thor 0.19.1
Using mimemagic 0.3.2
Using net-ldap 0.12.1
Installing pg 0.18.4 with native extensions
Using ruby-openid 2.3.0
Using rbpdf-font 1.19.0
Using redcarpet 3.3.4
Using request_store 1.0.5
Installing rmagick 2.16.0 with native extensions
Using tzinfo 1.2.2
Installing nokogiri 1.6.8 with native extensions
Using rack-test 0.6.3
Using mime-types 3.1
Using css_parser 1.3.7
Using sprockets 3.7.0
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /usr/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
*** 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}/lib64
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/ruby
    --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}/
/usr/share/ruby/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/share/ruby/mkmf.rb:519:in `try_link0'
    from /usr/share/ruby/mkmf.rb:534:in `try_link'
    from extconf.rb:36:in `'


Gem files will remain installed in /tmp/.gem/ruby/gems/pg-0.18.4 for inspection.
Results logged to /tmp/.gem/ruby/gems/pg-0.18.4/ext/gem_make.out

An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.

2 个答案:

答案 0 :(得分:0)

您可能没有安装PostgreSQL。它也出现在macOS上。我只是做了brew install postgresql并再次运行bundle。如果你在任何其他操作系统上,你需要相应地安装PostgreSQL 这将做的是安装gem所需的所有缺少的库。

答案 1 :(得分:0)

很可能你没有在你的机器上安装postgresql软件。 这就是为什么当你试图安装gem时,它找不到postgresql软件的executable .Hence bundler无法安装gem。 在您的机器上安装postgresql

sudo apt-get install postgresql postgresql-contrib #If you are on linux(ubuntu).

brew install postgresql #If you are on mac

希望你得到答案。享受

相关问题