Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/local/bin/ruby extconf.rb --with-pg-config=/usr/pgsql-9.1/bin/pg_config Using config values from /usr/pgsql-9.1/bin/pg_config sh: /usr/pgsql-9.1/bin/pg_config: No such file or directory sh: /usr/pgsql-9.1/bin/pg_config: No such file or directory checking for libpq-fe.h... *** 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/local/bin/ruby --with-pg --without-pg --with-pg-dir --without-pg-dir --with-pg-include --without-pg-include=${pg-dir}/include --with-pg-lib --without-pg-lib=${pg-dir}/lib --with-pg-config /usr/local/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /usr/local/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp' from /usr/local/lib/ruby/1.9.1/mkmf.rb:970:in `block in find_header' from /usr/local/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for' from /usr/local/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone' from /usr/local/lib/ruby/1.9.1/mkmf.rb:254:in `open' from /usr/local/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone' from /usr/local/lib/ruby/1.9.1/mkmf.rb:254:in `open' from /usr/local/lib/ruby/1.9.1/mkmf.rb:280:in `postpone' from /usr/local/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for' from /usr/local/lib/ruby/1.9.1/mkmf.rb:969:in `find_header' from extconf.rb:41:in `<main>' Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/pg-0.14.1 for inspection. Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/pg-0.14.1/ext/gem_make.out An error occurred while installing pg (0.14.1), and Bundler cannot continue. Make sure that `gem install pg -v '0.14.1'` succeeds before bundling.
大家讲道理2017-05-16 17:31:48
The reason for this error is that there is no dev package for PostgreSql and the PostgreSql client cannot be successfully compiled; there are two solutions:
1) Install dev package
Use package management to install, RedHat system is
yum install postgresql-devel
Debian system is:
apt-get install libpg-dev
2) If you do not plan to use PostgreSql as Redmine’s database, you can use the following command to ignore the corresponding gem:
bundle install --without development test postgresql
You can also ignore sqlite and rmagick (both have dependencies):
bundle install --without development test postgresql sqlite rmagick