1. Michael Granger
  2. ruby-pg
  3. Issues

Issues

Issue #97 resolved

pg 0.12.1 fails to install with ruby 1.8.7 in Ubuntu 11.10

Phong Nguyen
created an issue

No description provided.

Comments (5)

  1. Anonymous

    +1, we are experiencing this issue too. Travis CI tests are failing because of this.

    Error: pg currently requires the ruby/st.h header

    Here is the trace from 'bundle install':

    Installing pg (0.12.1) with native extensions Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks!
    /home/ndbroadbent/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/installer.rb:552:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
    
            /home/ndbroadbent/.rvm/rubies/ruby-1.8.7-p352/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 PQconnectdb() in -lpq... yes
    checking for PQconnectionUsedPassword()... yes
    checking for PQisthreadsafe()... yes
    checking for PQprepare()... yes
    checking for PQexecParams()... yes
    checking for PQescapeString()... yes
    checking for PQescapeStringConn()... yes
    checking for PQgetCancel()... yes
    checking for lo_create()... yes
    checking for pg_encoding_to_char()... yes
    checking for PQsetClientEncoding()... yes
    checking for rb_encdb_alias()... no
    checking for rb_enc_alias()... no
    checking for struct pgNotify.extra in libpq-fe.h... yes
    checking for unistd.h... yes
    checking for ruby/st.h... no
    pg currently requires the ruby/st.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/ndbroadbent/.rvm/rubies/ruby-1.8.7-p352/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
    	--enable-static-build
    	--disable-static-build
    
    
    Gem files will remain installed in /home/ndbroadbent/.rvm/gems/ruby-1.8.7-p352/gems/pg-0.12.1 for inspection.
    Results logged to /home/ndbroadbent/.rvm/gems/ruby-1.8.7-p352/gems/pg-0.12.1/ext/gem_make.out
    	from /home/ndbroadbent/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/installer.rb:505:in `each'
    	from /home/ndbroadbent/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/installer.rb:505:in `build_extensions'
    	from /home/ndbroadbent/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/installer.rb:180:in `install'
    	from /home/ndbroadbent/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.1.rc.7/lib/bundler/source.rb:90:in `install'
    	from /home/ndbroadbent/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.1.rc.7/lib/bundler/rubygems_integration.rb:82:in `preserve_paths'
    	from /home/ndbroadbent/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.1.rc.7/lib/bundler/source.rb:89:in `install'
    	from /home/ndbroadbent/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.1.rc.7/lib/bundler/installer.rb:73:in `install_gem_from_spec'
    	from /home/ndbroadbent/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.1.rc.7/lib/bundler/rubygems_integration.rb:97:in `with_build_args'
    	from /home/ndbroadbent/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.1.rc.7/lib/bundler/installer.rb:72:in `install_gem_from_spec'
    	from /home/ndbroadbent/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.1.rc.7/lib/bundler/installer.rb:56:in `run'
    	from /home/ndbroadbent/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.1.rc.7/lib/bundler/installer.rb:55:in `run'
    	from /home/ndbroadbent/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.1.rc.7/lib/bundler/installer.rb:12:in `install'
    	from /home/ndbroadbent/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.1.rc.7/lib/bundler/cli.rb:220:in `install'
    	from /home/ndbroadbent/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.1.rc.7/lib/bundler/vendor/thor/task.rb:22:in `send'
    	from /home/ndbroadbent/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.1.rc.7/lib/bundler/vendor/thor/task.rb:22:in `run'
    	from /home/ndbroadbent/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.1.rc.7/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
    	from /home/ndbroadbent/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.1.rc.7/lib/bundler/vendor/thor.rb:263:in `dispatch'
    	from /home/ndbroadbent/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.1.rc.7/lib/bundler/vendor/thor/base.rb:386:in `start'
    	from /home/ndbroadbent/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.1.rc.7/bin/bundle:13
    	from /home/ndbroadbent/.rvm/gems/ruby-1.8.7-p352/bin/bundle:19:in `load'
    	from /home/ndbroadbent/.rvm/gems/ruby-1.8.7-p352/bin/bundle:19
    
  2. Anonymous

    I had the same problem. The extconf.rb file in line 64 requires st.h in /ruby:

    have_header 'ruby/st.h' or abort "pg currently requires the ruby/st.h header"

    However, I think that it must be replaced by,

    have_header 'st.h' or abort "pg currently requires the ruby/st.h header"//

    I have made a ruby directory in mkdir /usr/lib/ruby/1.8/x86_64-linux mkdir /usr/lib/ruby/1.8/x86_64-linux/ruby and I have copied the st.h file to the new directory /usr/lib/ruby/1.8/x86_64-linux/ruby/ then I run sudo gem install pg and pg was successful installed.

    Building native extensions. This could take a while...

    Successfully installed pg-0.12.1

    1 gem installed

    Installing ri documentation for pg-0.12.1...

    Installing RDoc documentation for pg-0.12.1...

  3. Log in to comment