由于'pg'无法捆绑安装

时间:2014-09-26 14:40:55

标签: ruby-on-rails ruby postgresql pg

我正在学习R o R.然后,我想用postgresql建立一个网站。 但是,这个错误让我发疯。 拜托,帮助我!

$ sudo bundle install

creating Makefile

make "DESTDIR="
compiling gvl_wrappers.c
compiling pg.c
compiling pg_connection.c
pg_connection.c:2323:3: warning: implicit declaration of function 'gettimeofday' is invalid in C99 [-Wimplicit-function-declaration]
                gettimeofday(&currtime, NULL);
                ^
1 warning generated.
compiling pg_errors.c
compiling pg_result.c
linking shared-object pg_ext.bundle
ld: file not found: dynamic_lookup
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [pg_ext.bundle] Error 1

Gem files will remain installed in /Users/Sean/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pg-0.17.1 for inspection.
Results logged to /Users/Sean/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pg-0.17.1/ext/gem_make.out
An error occurred while installing pg (0.17.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.17.1'` succeeds before bundling.

我尽我所能。

例如,我试图改变pg的传递。 但是,我不能。

然后,我试过

$ brew update
$ brew uninstall postgresql
$ brew install postgresql
$ gem install pg
$ bundle install

但是,它没有用。

如何解决此错误!?

2 个答案:

答案 0 :(得分:1)

您可能需要libpq-dev,这是在尝试在新计算机上安装pg gem时总能找到我的库。

答案 1 :(得分:0)

在使用Ruby 2.2.1运行pg gem 0.17时遇到了同样的问题

我刚刚做了一个bundle update pg并升级到0.18并且不再有这个编译问题