centos6.3 nginx 配置redmine 的过程中 使用 bundle install --without development test 报错

【字号: 日期:2022-06-28浏览:34作者:雯心

问题描述

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_configUsing config values from /usr/pgsql-9.1/bin/pg_configsh: /usr/pgsql-9.1/bin/pg_config: No such file or directorysh: /usr/pgsql-9.1/bin/pg_config: No such file or directorychecking for libpq-fe.h... *** extconf.rb failed ***Could not create Makefile due to some reason, probably lack ofnecessary libraries and/or headers. Check the mkmf.log file for moredetails. 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.outAn 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.

问题解答

回答1:

这个错误的原因是没有PostgreSql的dev包,不能成功编译PostgreSql的客户端;解决办法有两个:

1)安装dev包

用包管理来安装,RedHat系是

yum install postgresql-devel

Debian系是:

apt-get install libpg-dev

2)如果你不打算用PostgreSql来作为Redmine的数据库,可以用下面的命令来忽略相应的gem:

bundle install --without development test postgresql

你还可以忽略sqlite和rmagick(都有依赖的):

bundle install --without development test postgresql sqlite rmagick

相关文章: