Error Compiling Postgres pg gem on Ubuntu 12.04 [duplicate] - ruby

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Unable to install pg gem on ubuntu - Can’t find the 'libpq-fe.h header
Here is the error while trying to do bundle install
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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=/usr/bin/ruby1.8
--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
Gem files will remain installed in /var/lib/gems/1.8/gems/pg-0.14.1 for inspection.
Results logged to /var/lib/gems/1.8/gems/pg-0.14.1/ext/gem_make.out
i'm using ubuntu 12.04.Can any one point what may be wrong

Looks like you need to install the dev libraries for postgres:
sudo apt-get install libpq-dev

Related

Unable to install pg gem on Windows

I'm trying to install the pg gem in my project but I get the following error when I run gem install pg, or if I run bundle install:
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/pg-1.1.4/ext
/home/ec2-user/.rvm/rubies/ruby-2.6.3/bin/ruby -I /home/ec2-
user/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0 -r
./siteconf20191103-5491-ro2ye0.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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/ec2-user/.rvm/rubies/ruby-2.6.3/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
To see why this extension failed to compile, please check the mkmf.log
which can be found here:
/home/ec2-user/.rvm/gems/ruby-2.6.3/extensions/x86_64-linux/2.6.0/pg-
1.1.4/mkmf.log
extconf failed, exit code 1
As you can see, I'm using Ruby version 2.6.3 and I'm on a Windows.
I'm trying to install the pg gem so that I can connect to the database.
I'm very new to all of this, so any help would be greatly appreciated
You are missing pg_config, which means most likely the pg development package has not been installed.
apt install libpq-dev
Go to https://rubygems.org/gems/pg ruby gems site and copy the latest gem into your gemfile. For me that was something like gem 'pg', '~> 1.3.0.rc1'.

Failed to install charlock_holmes on Windows 8 due to missing zlib

I'm trying to install charlock_holmes on Windows 8, but I can't point it to a valid zlib binary. I tried vaiours dll's from Cygwin and from zlib.net, with no luck. The question is, how to link to zlib properly?
gem install charlock_holmes -- --with-icu-dir=D:\download\icu4c-4_0_1-Win64-msvc8\usr\local --with-icui18nlib=icuin --with-icudatalib=icudt --with-zlib=WHATHEVER_WONT_WORK
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing charlock_holmes:
ERROR: Failed to build gem native extension.
d:/bin/Ruby193/bin/ruby.exe extconf.rb --with-icu-dir=D:\download\icu4c-4_0_1-Win64-msvc8\usr\local --with-icui18nlib=icuin --with-icudatalib=icudt --with- zlib=WHATHEVER_WONT_WORK
checking for main() in -licuin... yes
checking for main() in -licuin... yes
checking for unicode/ucnv.h... yes
checking for main() in -lWHATHEVER_WONT_WORK... no
libz missing
*** 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=d:/bin/Ruby193/bin/ruby
--with-icu-dir
--with-icu-include
--without-icu-include=${icu-dir}/include
--with-icu-lib
--without-icu-lib=${icu-dir}/lib
--with-icui18nlib
--with-icui18nlib
--with-zlib
Gem files will remain installed in d:/bin/Ruby193/lib/ruby/gems/1.9.1/gems/charlock_holmes-0.7.3 for inspection.
Results logged to d:/bin/Ruby193/lib/ruby/gems/1.9.1/gems/charlock_holmes-0.7.3/ext/charlock_holmes/gem_make.out
libz.a goes to [devkit-dir]/mingw/lib, not [devkit-dir]/lib. Problem solved.

Ruby missing taglib error

On my Ubuntu 14.04 I installed Ruby 2.2.0 using RVM.
I have installed the "taglib" using following command sudo apt-get install libtag1-dev.
However when I try to install a gem I get the following error:
> gem install stream2tracks
Building native extensions. This could take a while...
ERROR: Error installing stream2tracks:
ERROR: Failed to build gem native extension.
/home/dash/.rvm/rubies/ruby-2.2.0-dev/bin/ruby -r ./siteconf20150207-2313-h67sa7.rb extconf.rb
checking for ruby.h... yes
checking for taglib/tag_c.h... no
*** 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/dash/.rvm/rubies/ruby-2.2.0-dev/bin/$(RUBY_BASE_NAME)
extconf failed, exit code 1
Gem files will remain installed in /home/dash/.rvm/gems/ruby-2.2.0-dev/gems/taglib2-0.1.5 for inspection.
You need to install libtagc0-dev to get TagLib's C header (the one the gem is checking for).

Not able to install hbase-stargate gem

I am trying to install hbase-stargate gem on my hadoop machine having centos-5.8 OS. Hbase is already installed. I am getting below errors.
gem install hbase-stargate
Building native extensions. This could take a while...
ERROR: Error installing hbase-stargate:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking for curl-config... no
checking for main() in -lcurl... no
* 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=/usr/bin/ruby
--with-curl-dir
--without-curl-dir
--with-curl-include
--without-curl-include=${curl-dir}/include
--with-curl-lib
--without-curl-lib=${curl-dir}/lib
--with-curllib
--without-curllib
extconf.rb:34: Can't find libcurl or curl/curl.h (RuntimeError)
Try passing --with-curl-dir or --with-curl-lib and --with-curl-include
options to extconf.
Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/patron-0.4.18 for inspection.
Results logged to /usr/lib64/ruby/gems/1.8/gems/patron-0.4.18/ext/patron/gem_make.out
Its giving errors about libcurl however libcurl and libcurl-devel package is also there...
I also got this error while installing 'patron' gem on Ubuntu 12.04 with Rails 3.2.12.
I fixed this issue using:
sudo apt-get install libcurl3-dev
and then:
bundle
I hope it will be helpfull

Unable to install sqlite3-ruby gem

I've xcode 3.0 installed. And I need to install sqlite3-ruby gem (for rhosync).
When I run:
sudo gem install -l sqlite3-ruby
I get following error:
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for #include <sqlite3.h>
... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... no
checking for sqlite3_initialize()... no
sqlite3-ruby only supports sqlite3 versions 3.6.16+, please upgrade!
*** 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-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
--with-sqlite3lib
--without-sqlite3lib
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/sqlite3-ruby-1.3.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/sqlite3-ruby-1.3.1/ext/sqlite3/gem_make.out
I've checked many links (on Stack Overflow and other sites) but nothing seems to work.
Some people suggest that install Ruby Headers from Mac OS X Disk 2. But I don't have that disc. I've instead installed XCode 3.0 SDK.
What should I do?
I installed MacPorts from http://macports.org and then ran
sudo port install sqlite3
after that sqlite3-ruby installed successfully.

Resources