This forum is no longer active. Please post your questions to our new community site

problem with postgresql

Subscribe to problem with postgresql 3 post(s), 2 voice(s)

 
Avatar tuope 2 post(s)

This is what I done:

$ ./rubyconsole
bash-4.0$ cd projects/rails_project
bash-4.0$ ruby script/server
=> Booting Mongrel
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
/Tuope/Software/RoR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in `establish_connection’: Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (no such file to load — pg) (RuntimeError)
from /Tuope/Software/RoR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:60:in `establish_connection’
from /Tuope/Software/RoR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in `establish_connection’
from /Tuope/Software/RoR/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:417:in `initialize_database’
from /Tuope/Software/RoR/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:141:in `process’
from /Tuope/Software/RoR/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in `send’
from /Tuope/Software/RoR/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in `run’
from /Tuope/Software/RoR/projects/Majava/config/environment.rb:9
from /Tuope/Software/RoR/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require’
from /Tuope/Software/RoR/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’
from /Tuope/Software/RoR/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require’
from /Tuope/Software/RoR/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in’
from /Tuope/Software/RoR/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require’
from /Tuope/Software/RoR/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/commands/server.rb:84
from /Tuope/Software/RoR/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require’
from /Tuope/Software/RoR/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’
from script/server:3
bash-4.0$

After that I try to install postgres gem
bash-4.0$ gem install postgres
Building native extensions. This could take a while…
ERROR: Error installing postgres:
ERROR: Failed to build gem native extension.

/Tuope/Software/RoR/ruby/bin/ruby extconf.rb
checking for main() in -lpq… 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=/Tuope/Software/RoR/ruby/bin/ruby
—with-pgsql-dir
—without-pgsql-dir
—with-pgsql-include
—without-pgsql-include=${pgsql-dir}/include
—with-pgsql-lib
—without-pgsql-lib=${pgsql-dir}/lib
—with-pqlib
—without-pqlib
Could not find PostgreSQL build environment (libraries & headers): Makefile not created

Gem files will remain installed in /Tuope/Software/RoR/ruby/lib/ruby/gems/1.8/gems/postgres-0.7.9.2008.01.28 for inspection.
Results logged to /Tuope/Software/RoR/ruby/lib/ruby/gems/1.8/gems/postgres-0.7.9.2008.01.28/ext/gem_make.out

I cannot figure out how to give these configuration options to gem. I would imagine I need to tell it that the postgresql directory is in
/Tuope/Software/RoR/postgresql . But gem keeps complaining about invalid options. Like

bash-4.0$ gem install postgres —with-pgsql-dir=/Tuope/Software/RoR/postgresql
ERROR: While executing gem … (OptionParser::InvalidOption)
invalid option: —with-pgsql-dir=/Tuope/Software/RoR/postgresql

 
Avatar tuope 2 post(s)

I tried this one too (but without luck):

bash-4.0$ gem install postgres — —with-pgsql-dir=/Tuope/Software/RoR/postgresql —with-pgsql-include=/Tuope/Software/RoR/postgresql/include —with-pgsql-lib=/Tuope/Software/RoR/postgresql/lib/

Building native extensions. This could take a while…
ERROR: Error installing postgres:
ERROR: Failed to build gem native extension.

/Tuope/Software/RoR/ruby/bin/ruby extconf.rb —with-pgsql-dir=/Tuope/Software/RoR/postgresql —with-pgsql-include=/Tuope/Software/RoR/postgresql/include —with-pgsql-lib=/Tuope/Software/RoR/postgresql/lib/ -E
checking for main() in -lpq… 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=/Tuope/Software/RoR/ruby/bin/ruby
—with-pgsql-dir
—with-pgsql-include=${pgsql-dir}/include
—with-pgsql-lib=${pgsql-dir}/lib
—with-pqlib
—without-pqlib
Could not find PostgreSQL build environment (libraries & headers): Makefile not created

Gem files will remain installed in /Tuope/Software/RoR/ruby/lib/ruby/gems/1.8/gems/postgres-0.7.9.2008.01.28 for inspection.
Results logged to /Tuope/Software/RoR/ruby/lib/ruby/gems/1.8/gems/postgres-0.7.9.2008.01.28/ext/gem_make.out

Does anyone have an idea what is the issue here? :-/

Tuope

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Hi,

It seems that it does not find the postgreSQL library. Check if the LD_LIBRARY_PATH environment variable contains the postgresql/lib folder. Try the following:

1. Load the Stack enviroment variables:

$ cd
$ . scripts/setenv.sh

2. Check that the LD_LIBRARY_PATH environment variable contains the postgresql/lib folder:

$ echo $LD_LIBRARY_PATH

3. Compile and isntall the gem:


$ gem install postgres -- --with-pgsql-dir=/Tuope/Software/RoR/postgresql --with-pgsql-include=/Tuope/Software/RoR/postgresql/include --with-pgsql-lib=/Tuope/Software/RoR/postgresql/lib/

I hope it helps.