I'm using XAMPP as my installation folder for PostgreSQL 9.3.
C:\xampp\pgsql\9.3
And now I'm trying to install PostgreSQL gem using that directory as a reference:
gem install pg -- --with-pg-include="C:\xampp\pgsql\9.3\include" --with-pg-lib="C:\xampp\pgsql\9.3\lib" --with-pg-config="C:\xampp\pgsql\9.3\bin\pg_config"
But this command failed with errors listed below:
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
C:/Ruby/Ruby200/bin/ruby.exe extconf.rb --with-pg-include=C:\xampp\pgsql\9.3
\include --with-pg-lib=C:\xampp\pgsql\9.3\lib --with-pg-config=C:\xampp\pgsql\9.
3\bin\pg_config
Using config values from C:\xampp\pgsql\9.3\bin\pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Cant find the PostgreSQL client library (libpq)
*** 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=C:/Ruby/Ruby200/bin/ruby
--with-pg
--without-pg
--with-pg-config
--with-pg-dir
--without-pg-dir
--with-pg-include=${pg-dir}/include
--with-pg-lib=${pg-dir}/
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby/Ruby200/lib/ruby/gems/2.0.0/gems/pg-0
.17.1 for inspection.
Results logged to C:/Ruby/Ruby200/lib/ruby/gems/2.0.0/extensions/x86-mingw32/2.0
.0/pg-0.17.1/gem_make.out
When I checked inside pgsql, there was actually a file named libpq.dll inside of
C:\xampp\pgsql\9.3\lib
So why did the error say it couldn't find the PostgreSQL client library (libpq)??
Is there any solutions for this error?
FYI, I'm using:
Windows 8.1 64-bit
Ruby 2.0.0 64-bit
Rails 4.1.1
Devkit 4.7.2 64-bit
PostgreSQL 9.3.4 64-bit
And I'm trying to install PG Gem version 0.17.1
As a follow-up to the comments, it looks like you've got to use 32-bit Postgres on Windows.
This is most likely to do with the idea that the pg gem works with mingw32, although I'm not totally sure
Related
I'm having trouble installing gem pg on my m1 mac mini. Im trying to host onto Heroku and netlify. Wondering if anyone has found a workaround for this. I have tried several solutions on stack overflow but nothing works.
please help, I consider myself a noob with this kinda stuff.
below is the error im getting.
`
jonathanbleibdrey#Little-Mac listen_to_the_humans % gem install pg
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /Users/jonathanbleibdrey/.rvm/gems/ruby-2.6.1/gems/pg-1.2.3/ext
/Users/jonathanbleibdrey/.rvm/rubies/ruby-2.6.1/bin/ruby -I /Users/jonathanbleibdrey/.rvm/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0 -r ./siteconf20210323-28582-1dv0k5o.rb extconf.rb
checking for pg_config... yes
Using config values from /opt/homebrew/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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
--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=/Users/jonathanbleibdrey/.rvm/rubies/ruby-2.6.1/bin/$(RUBY_BASE_NAME)
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--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
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/jonathanbleibdrey/.rvm/gems/ruby-2.6.1/extensions/x86_64-darwin-19/2.6.0/pg-1.2.3/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/jonathanbleibdrey/.rvm/gems/ruby-2.6.1/gems/pg-1.2.3 for inspection.
Results logged to /Users/jonathanbleibdrey/.rvm/gems/ruby-2.6.1/extensions/x86_64-darwin-19/2.6.0/pg-1.2.3/gem_make.out
`
let me know what I can do or resources I can find, or even if we can zoom to fix it wanted to launch it by need of week.
The key to my initial problem getting pg gem to install on my m1 was that installing postgresql via brew did not install a library that the pg gem needs to run. This fixed it:
brew install libpq
export PATH="/opt/homebrew/opt/libpq/bin:$PATH"
gem install pg
Figured it out: I had some dependency's in my homebrew that was out of date. all I had to do is
homebrew upgrade
I think.
Ive been trying out Rubymine for a small rails project and would really like the debugging to work.
The project is a rails API and uses Postgres running on my Mac with El Capitan.
The problem i have is Rubymine is complaining of 'No Rails found in SDK'
I thought the solution to this was to run bundle install from the Rubymine menu.
However that consistently fails at installing pg:
....
Using hashie 3.4.3
Using multi_json 1.11.2
Using multi_xml 0.5.5
Using newrelic_rpm 3.14.2.312
Installing pg 0.18.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20160617-92261-aw26bh.rb extconf.rb
checking for pg_config... yes
Using config values from /usr/local/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--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}/
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib
extconf failed, exit code 1
...
Using faraday 0.9.2
Using hashie-forbidden_attributes 0.1.1
Using httparty 0.13.7
An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.
I have tried numerous of the other solutions on stack overflow including:
Bundler::GemNotFound: Could not find rake-10.3.2 in any of the sources
An error occurred while installing pg (0.17.1), and Bundler cannot continue
and have installed postgres on my machine (i think) using the app and brew.
Any ideas for making this work would be greatly appreciated!
I don't think the error is RubyMine-related; I think it's system-related.
That is, if you do gem install pg on the command line, I suspect you'll get the same error.
I use rvm and it just works. It installs the necessary system libraries. (That said, others have had difficulties from time to time.)
If you're interested in using rvm, google "install rvm" to get the link for the installation instructions.
That said, you should make sure RubyMine is configured for your project to use the same Ruby you are using on the command line. That way, you will get consistent results in both environments.
Also. just FYI, you can email support#jetbrains.com for RubyMine questions.
I have a rails app that I want to start working on, but I just can't get past this one error. I cannot install the pg -v -0.10.1 gem I have tried reinstalling Postgressql from my entire system and that didn't work. I have tried to run the command below and it works successfully but I still can't run bundle install successfully.
env ARCHFLAGS="-arch x86_64" gem install pg
I followed the instructions of this thread step by step but no cigar.
I just keep getting the error message below.
`Building native extensions with: '--with-pg-config= /usr/local/bin/pg_config'
This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --with-pg-config= /usr/local/bin/pg_config
Using config values from
sh: : command not found
sh: : command not found
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--with-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}/
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib
enter code here
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/pg-0.18.2 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/pg-0.18.2/ext/gem_make.out`
This question already has answers here:
Can't find the PostgreSQL client library (libpq)
(23 answers)
Closed 8 years ago.
I am having trouble install postgres on OSX mavericks. I have tried to follow the numerous guides on Stackoverflow with no luck. I installed the postgres.app and also postgres. I have found my pg_config file and tried this command:
gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
But I am still getting this error
Building native extensions with: '--with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config .'
This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config .
Using config values from /Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--with-pg
--without-pg
--with-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}/
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/pg-0.17.1 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/pg-0.17.1/gem_make.out
This also seems to be working:
Can't find the PostgreSQL client library (libpq)
$ sudo su
$ env ARCHFLAGS="-arch x86_64" gem install pg
I had the same problem a couple days ago and this worked for me:
brew install libpqxx
Rails 3 - can't install pg gem
I can't install the pg gem when I run bundle, or when I try to install it separately. The error I get is: "could not create Makefile." I'm running Mountain Lion, have Xcode installed, and have command line tools installed. I also have Postregsql installed via homebrew.
I believe the error is because I can't create the makefile, which has surfaced as the error preventing me from doing other things.
The full error I get is below.
This error happens during the bundle. The other gems are installed fine, or are marked as using, then this error terminates the bundle while installing pg (0.14.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/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
--without-pg-config
--with-pg_config
--without-pg_config
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib
Gem files will remain installed in /Users/ericavirtue/.bundler/tmp/75812/gems/pg-0.14.1 for inspection.
Results logged to /Users/ericavirtue/.bundler/tmp/75812/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.
I'm really at a loss for what to do here. I've been working on this for two days.
EDIT:
So when trying to find the path to implement the solution Christian Rapp suggested I found this recommendation: sudo env ARCHFLAGS="-arch x86_64" gem install pg which worked to install pg. Unfortunately I'm getting errors when I try to run rails s, rake db:create:all, or rake db:migrate. I'll create a separate question to trace those problems down ...
I am not using homebrew on MacOS but where does it install libpq? MacPorts is using /opt and your configure script does not know anything about this. The error messages is quite informative just provide the path with something like
gem install pg -- --with-libpqlib=/opt/...
May be you have to use another flag to provide the necessary Informations
The error is this:
Can't find the PostgreSQL client library (libpq)
You'll need to install PostreSQL (I recommend using Homebrew, but there are probably other downloads available) and try to install the gem again.
"Can't find the PostgreSQL client library (libpq)"
This is the reason your makefile can't be created. Your Postgres libraries, specifically libpq can't be found on your path. I see you installed with Homebrew. I don't use homebrew so I don't know if it sets the path for you.