LINUX.ORG.RU

gem pg on rails

 , , ,


0

2

помогите пожалуйста решить проблему

не получается установить gem pg в ruby on rails 4. вот содержание Gemfile:

source 'https://rubygems.org'
gem 'rails', '4.2.1'
group	:development	do
	gem	'sqlite3'
end
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc

group :development, :test do
  gem 'debugger'
  gem 'web-console', '~> 2.0'
  gem 'spring'
end


group :production do
  gem 'pg'
  gem 'rails_12factor'
end

полсе попытки установки получаю следующее сообщение об ошибке:

sergey@sergey-H61M-D2-B3 ~/rails/sample_app $ sudo bundle update
Fetching gem metadata from https://rubygems.org/............
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.4.2) 
Using i18n (0.7.0) 
Using json (1.8.2) 
Using minitest (5.7.0) 
Using thread_safe (0.3.5) 
Using tzinfo (1.2.2) 
Using activesupport (4.2.1) 
Using builder (3.2.2) 
Using erubis (2.7.0) 
Using mini_portile (0.6.2) 
Using nokogiri (1.6.6.2) 
Using rails-deprecated_sanitizer (1.0.3) 
Using rails-dom-testing (1.0.6) 
Using loofah (2.0.2) 
Using rails-html-sanitizer (1.0.2) 
Using actionview (4.2.1) 
Using rack (1.6.1) 
Using rack-test (0.6.3) 
Using actionpack (4.2.1) 
Using globalid (0.3.5) 
Using activejob (4.2.1) 
Using mime-types (2.6.1) 
Using mail (2.6.3) 
Using actionmailer (4.2.1) 
Using activemodel (4.2.1) 
Using arel (6.0.0) 
Using activerecord (4.2.1) 
Using debug_inspector (0.0.2) 
Using binding_of_caller (0.7.2) 
Using bundler (1.3.5) 
Using coffee-script-source (1.9.1.1) 
Using execjs (2.5.2) 
Using coffee-script (2.4.1) 
Using thor (0.19.1) 
Using railties (4.2.1) 
Using coffee-rails (4.1.0) 
Using columnize (0.9.0) 
Using debugger-linecache (1.2.0) 
Using debugger-ruby_core_source (1.3.8) 
Using debugger (1.6.8) 
Using multi_json (1.11.0) 
Using jbuilder (2.2.16) 
Using jquery-rails (4.0.3) 
Installing pg (0.18.2) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 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.9.1
	--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


Gem files will remain installed in /var/lib/gems/1.9.1/gems/pg-0.18.2 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/pg-0.18.2/ext/gem_make.out
An error occurred while installing pg (0.18.2), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.2'` succeeds before bundling.

то, что предлагается в последней строке тоже пробовал:

sergey@sergey-H61M-D2-B3 ~/rails/sample_app $ sudo gem install pg -v '0.18.2'
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
	ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 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.9.1
	--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


Gem files will remain installed in /var/lib/gems/1.9.1/gems/pg-0.18.2 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/pg-0.18.2/ext/gem_make.out

sudo bundle update

Нахера судно то?

anonymous ()

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

У тебя постгресоклиент и его хедеры-то установлены там, где ты пытаешься собирать свой бандл?

INFOMAN ★★★★★ ()
Ответ на: комментарий от TheLibertyMan

Нет, не нужно, во-первых, нехрен ставить бандлосрач в системные места, где оно будет мешаться с либами, поставленными пакетным менеджером, во-вторых, если ты всё-таки настолько упорот, что готов превратить свою систему в слаку, bundler сам у себя внутри вызовет sudo там где нужно.

INFOMAN ★★★★★ ()

libpq-dev надо поставить, очевидно же.

Kilte ★★★★★ ()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.