Shion  Yamaguchi
Shion Yamaguchi

Reputation: 601

Could not bundle install because of 'pg'

I'm learning R o R. Then, I want to make a website by using postgresql. But, this error makes me crazy. Please, help me !

$ 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.

I tried all ways I could.

For example, I tried to change pass of pg. But, I couldn't.

Then, I tried

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

But, it didn't work.

How can I do for this error !?

Upvotes: 1

Views: 1610

Answers (2)

NikoRoberts
NikoRoberts

Reputation: 789

I struck the same problem when running the pg gem 0.17 with Ruby 2.2.1

I just did a bundle update pg and it upgraded to 0.18 and it no longer had this compile issue

Upvotes: 0

Johnson
Johnson

Reputation: 1490

You might require libpq-dev, which is the library that always gets me when trying to install the pg gem on a new machine.

Upvotes: 1

Related Questions