gem install pg --with-PG-config działa, pakiet nie działa

When run (as root)

gem install pg -v '0.12.0' -- --with-pg-config=/usr/pgsql-9.1/bin/pg_config

Otrzymuję następujące wyjście:

#-> gem instal pg -v '0.12.0' -- --with-pg-config=/usr/pgsql-9.1/bin/pg_config
Building native extensions.  This could take a while...
Successfully installed pg-0.12.0
1 gem installed
Installing ri documentation for pg-0.12.0...
Installing RDoc documentation for pg-0.12.0...
#-> 

Kiedy uruchamiam bundle install:

Installing pg (0.12.0) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /usr/local/rvm/rubies/ruby-1.9.2-p290/bin/ruby 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
--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/local/rvm/rubies/ruby-1.9.2-p290/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


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

Mam libpq-fe.H zainstalowany w /usr / pgsql-9.1 / include / libpq-fe.h. więc próbowałem

gem install pg -v '0.12.0' -- --with-pg-config=/usr/pgsql-9.1/bin/pg_config --with-pg-lib=/usr/pgsql-9.1/include/libpq-fe.h but still no go. 
Każda pomoc będzie bardzo mile widziana.

Zainstalowałem również postgresql91-devel i ruby-devel. Działa CentOS 6.

Author: Johannes Fahrenkrug, 2012-02-11

16 answers

Próbowałeś to uruchomić przed uruchomieniem bundle install?

bundle config build.pg --with-pg-config=/usr/pgsql-9.1/bin/pg_config

Zobacz http://bundler.io/v1.3/bundle_config.html

 154
Author: Johannes Fahrenkrug,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-11-08 21:08:43

Jeśli ktoś używa macports do instalacji postgres i ma problemy ze znalezieniem swojego pg_config, spróbuj tak:

bundle config build.pg --with-pg-config=/opt/local/lib/postgresql91/bin/pg_config
Mam nadzieję, że to pomoże komuś zaoszczędzić trochę czasu. Zdrowie!
 17
Author: Lester Celestial,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2012-04-23 08:21:42

Jeśli nie jesteś pewien, gdzie jest Twój pg_config i zakładając, że jesteś na Linuksie lub Macu, możesz uruchomić następujące polecenie:

which pg_config

To powróci ==> /usr/pgsql-9.1/bin/pg_config

Teraz użyj tej ścieżki jako

bundle config build.pg --with-pg-config=/usr/pgsql-9.1/bin/pg_config

Done now bundle install

 10
Author: Jai Kumar Rajput,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-02-02 06:08:12

Miał ten sam problem, naprawiony przez instalację libpq-dev.

Ref: https://bitbucket.org/ged/ruby-pg/issue/83/help-gem-install-pg-failed-on-opensuse-103

 7
Author: TTT,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-01-22 16:37:18

Możesz uzyskać ten błąd, jeśli masz zainstalowany pg_config, ale nie ma go w żadnej ścieżce. Możesz dodać go do swojej ścieżki env w swoim~/.bashrc.

Na przykład.

export PATH=${PATH}:/usr/pgsql-9.2/bin
 4
Author: AndyM,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-01-14 16:35:47

Jestem na Macu i używam Homebrew, więc aby rozwiązać ten problem zainstalowałem postgresql z brew:

brew install postgresql

A następnie zainstalował klejnot.

 4
Author: Billy Kovalsky,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-11-20 07:18:16

Kopiuj I Wklej:

bundle config build.pg --with-pg-config=`which pg_config` && bundle

Szczegóły:

Odwiedź więcej informacji:

pierwszą rzeczą, którą powinieneś zrobić, to upewnić się, że narzędzie' pg_config', które jest dostarczane z Postgresem, znajduje się w twojej ścieżce. Jeśli nie, lub ten, który jest pierwszy na twojej ścieżce, nie jest Tym, który został zainstalowany z Postgres, na którym chcesz budować, możesz określić ścieżkę do niego za pomocą opcji-with-pg-config.

Źródło: https://github.com/ged/ruby-pg/blob/1f274f68c16f1af1c642db1b9d3d28aef169dc84/ext/extconf.rb#L27

 4
Author: Inanc Gumus,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-12-08 16:31:36

Musiałem to zrobić, aby naprawić mój na OS X:

export PATH=/opt/local/lib/postgresql84/bin/:$PATH

I musiałem to zrobić pomimo tego, że już to miałem na swojej drodze:

[user@foo ~] which psql84
/opt/local/bin/psql84

[user@foo ~] ls -altrh /opt/local/bin/psql84 
lrwxr-xr-x  1 root  admin    36B Dec  7 02:15 /opt/local/bin/psql84 ->  /opt/local/lib/postgresql84/bin/psql

Mam nadzieję, że pomoże to innemu użytkownikowi Mac z tym problemem.

 3
Author: Luke Sheppard,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-01-29 20:38:27

Gem Postgres nie może znaleźć pliku konfiguracyjnego Postgres. Musisz powiedzieć, gdzie jest. Moim zdaniem najprzyjemniejszym rozwiązaniem jest pominięcie Brew i Macportów i po prostu skorzystanie z aplikacji Postgres. Pobierz i zainstaluj stąd:

Http://postgresapp.com/

Teraz Dodaj folder bin do swojej ścieżki:

PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"

Możesz również dodać to do swojego~/.bash_profile

Teraz zainstaluj gem:

gem install pg
Powinno pójść gładko.
 3
Author: superluminary,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-11-05 14:26:32

Używam Arch Linuksa i miałem podobne problemy. Użyłem sudo pacman -S libpqxx i reran zainstalował PG gem, a następnie uruchomił bundle install ponownie, i tym razem w końcu zadziałało!

 2
Author: Joshua Michael Calafell,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-03-26 20:07:11

Spróbuj tego:

yum install libpqxx-devel

Działa z Postgr9. 2.

 1
Author: MaciejO,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-06-01 21:41:57

Kiedy używasz postgresapp na Macu, przeczytaj http://postgresapp.com/documentation/cli-tools.html Dokumentacja i konfiguracja $PATH. Przed tym spróbuj ponownie uruchomić pakiet instalacyjny.

 1
Author: Roberto Capelo,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-03-22 02:44:17

This link suggested using:

gem install pg --pre

Przez kilka dni nie mogłem zainstalować pg gem, ale ta metoda w końcu zadziałała. Mam nadzieję, że to będzie pomocne.

 1
Author: NickJ987,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-04-06 09:43:43
gem install pg -v '0.17.1'
Zrobił dla mnie sztuczkę.
 0
Author: gabemartinez,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-03-19 05:12:16

Upewnij się, że masz zainstalowany postgress. jeśli nie zainstaluj go najpierw. Na przykład używając terminala.

brew install postgresql

Po tym biegu

bundle install
 0
Author: Ronny Kibet,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-05-25 14:10:11

Niektóre przypadki na UBUNTU

sudo apt-get install libpq-dev

Then

bundle install
To mi pomogło.
 0
Author: Thialyson Martins,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-08-02 20:15:55