我正在尝试使用ruby on rails和postgres设置我的VPS(CentOS 6.4).
我安装了ruby(2.1.0p0),rails(4.1.0)和postgresql(9.3.4)没有问题.
当我尝试创建新的rails应用程序(rails new new_app -d postgresql)时,它会在安装pg gem时停止.我查看了有关此错误的所有SO帖子,并尝试了我能找到的所有内容.最建议的是运行"yum install postgresql-devel"并仍然无法正常工作.
您可以在下面找到ssh输出和mkmf.log.如果需要更多信息,请告诉我......
Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension. /home/deploy/.rvm/rubies/ruby-2.1.0/bin/ruby extconf.rb checking for pg_config... yes Using config values from /usr/bin/pg_config 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=/home/deploy/.rvm/rubies/ruby-2.1.0/bin/ruby --with-pg --without-pg --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 /home/deploy/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /home/deploy/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp' from /home/deploy/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:1120:in `block in find_header' from /home/deploy/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for' from /home/deploy/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone' from /home/deploy/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:321:in `open' from /home/deploy/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone' from /home/deploy/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:321:in `open' from /home/deploy/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:347:in `postpone' from /home/deploy/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for' from /home/deploy/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:1119:in `find_header' from extconf.rb:48:in `' extconf failed, exit code 1
"gcc -o conftest -I/home/deploy/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0/x86_64-linux -I/home/deploy/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0/ruby/backward -I/home/deploy/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0 -I. -I/usr/include -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/home/deploy/.rvm/rubies/ruby-2.1.0/lib -Wl,-R/home/deploy/.rvm/rubies/ruby-2.1.0/lib -L/usr/lib64 -Wl,-R/usr/lib64 -L. -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-rpath,'/../lib' -Wl,-R -Wl,'/../lib' -L'/../lib' -lruby -lpthread -lrt -ldl -lcrypt -lm -lc" gcc: error trying to exec 'as': execvp: Permission denied checked program was: /* begin */ 1: #include "ruby.h" 2: 3: int main(int argc, char **argv) 4: { 5: return 0; 6: } /* end */
shilovk.. 9
之前:
对于Centos 6:使用本指南正确安装Postgres 9.*.
后:
yum install postgresql-libs postgresql-devel
有用的指导:
如何使用Postgres设置RoR
之前:
对于Centos 6:使用本指南正确安装Postgres 9.*.
后:
yum install postgresql-libs postgresql-devel
有用的指导:
如何使用Postgres设置RoR
由于您没有使用CentOS 6(PostgreSQL 8.4)附带的过时PostgreSQL版本,因此您需要安装-devel
与您的版本匹配的软件包(PostgreSQL 9.X).
最简单的方法是使用官方的PostgreSQL yum存储库.
由于最新版本是9.5并且它与所有9.X版本兼容,我将编写该版本的说明.将来您可以参考更新命令的官方说明.
yum install http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-redhat95-9.5-2.noarch.rpm yum install postgresql95-devel
然后使用-with-pg-config
选项安装gem :
gem install pg -- --with-pg-config=/usr/pgsql-9.5/bin/pg_config
这对我来说比较容易:
ln -s /usr/pgsql-9.5/bin/pg_config /usr/local/bin/