pg gem install error - lion osx, bundler и rvm - PullRequest
       34

pg gem install error - lion osx, bundler и rvm

0 голосов
/ 01 февраля 2012

Я потратил слишком много часов, пытаясь это исправить.

Я переформатировал свой компьютер - убери снежного барса, чем немедленно обнови до льва.

Xcode 4.2.1 установлен

RVM установлен

Когда я настроил свою среду, я наконец-то получил пакетную установку, и он не смог создать гем PG.

Я установил postgresql с помощью macports (не знал, что он предустановлен в lion). Следующие инструкции здесь: http://benscheirman.com/2010/06/installing-postgresql-for-rails-on-mac-os-x И столкнулся с большим количеством ошибок при попытке установить гем pg:

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

        /Users/me/.rvm/rubies/ruby-1.8.7-p357/bin/ruby extconf.rb 
checking for pg_config... yes
Using config values from /usr/local/bin/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=/Users/sling31/.rvm/rubies/ruby-1.8.7-p357/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 /Users/me/.rvm/gems/ruby-1.8.7-p357/gems/pg-0.12.0 for inspection.
Results logged to /Users/me/.rvm/gems/ruby-1.8.7-p357/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.

Я непрерывно искал stackoverflow и почти все перепробовал.

Я удалил версию macports, а затем решил попробовать установить с помощью homebrew:

"brew install postgresql"

pg_config дает мне:

BINDIR = /usr/local/Cellar/postgresql/9.1.2/bin
DOCDIR = /usr/local/Cellar/postgresql/9.1.2/share/doc/postgresql
HTMLDIR = /usr/local/Cellar/postgresql/9.1.2/share/doc/postgresql
INCLUDEDIR = /usr/local/Cellar/postgresql/9.1.2/include
PKGINCLUDEDIR = /usr/local/Cellar/postgresql/9.1.2/include
INCLUDEDIR-SERVER = /usr/local/Cellar/postgresql/9.1.2/include/server
LIBDIR = /usr/local/Cellar/postgresql/9.1.2/lib
PKGLIBDIR = /usr/local/Cellar/postgresql/9.1.2/lib
LOCALEDIR = /usr/local/Cellar/postgresql/9.1.2/share/locale
MANDIR = /usr/local/Cellar/postgresql/9.1.2/share/man
SHAREDIR = /usr/local/Cellar/postgresql/9.1.2/share/postgresql
SYSCONFDIR = /usr/local/Cellar/postgresql/9.1.2/etc
PGXS = /usr/local/Cellar/postgresql/9.1.2/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--disable-debug' '--prefix=/usr/local/Cellar/postgresql/9.1.2' '--enable-thread-safety' '--with-bonjour' '--with-gssapi' '--with-krb5' '--with-openssl' '--with-libxml' '--with-libxslt' '--with-python' '--with-perl' '--with-ossp-uuid' '--datadir=/usr/local/Cellar/postgresql/9.1.2/share/postgresql' '--docdir=/usr/local/Cellar/postgresql/9.1.2/share/doc/postgresql' 'ARCHFLAGS='''-arch x86_64'''' 'CC=/usr/bin/llvm-gcc' 'CFLAGS=-O3 -w -pipe -march=core2 -msse4.1 -I/opt/local/include/ossp' 'LDFLAGS=-L/usr/local/Cellar/readline/6.2.2/lib -L/opt/local/lib' 'LIBS=-luuid' 'CPPFLAGS=-I/usr/local/Cellar/readline/6.2.2/include -I/usr/include/libxml2'
CC = /usr/bin/llvm-gcc
CPPFLAGS = -I/usr/local/Cellar/readline/6.2.2/include -I/usr/include/libxml2 -I/opt/local/include/libxml2
CFLAGS = -O3 -w -pipe -march=core2 -msse4.1 -I/opt/local/include/ossp -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv
CFLAGS_SL = 
LDFLAGS = -L/usr/local/Cellar/readline/6.2.2/lib -L/opt/local/lib -L/opt/local/lib -Wl,-dead_strip_dylibs
LDFLAGS_EX = 
LDFLAGS_SL = 
LIBS = -lpgport -lxslt -lxml2 -lssl -lcrypto -lgssapi_krb5 -lz -lreadline -lm -luuid
VERSION = PostgreSQL 9.1.2

Я перепробовал все решения типа export rvm_archflags = "- arch x86_64", но ни одно из них не показало никакой разницы.

Есть идеи, с чего мне начать?

Ответы [ 2 ]

1 голос
/ 01 февраля 2012

Я не знаком с Brew, но похоже, что вызываемый вами pg_config не тот, который используется для настройки pg.

Так что, пожалуйста, попробуйте включить / usr / local / Cellar / postgresql /9.1.2 / bin (ожидается наличие pg_config) к пути и повторная попытка.

На самом деле, вывод говорит: «Используя значения конфигурации из / usr / local / bin / pg_config», это должен быть pg_config вПуть варки.Я предполагаю, что это в /usr/local/Cellar/postgresql/9.1.2/bin.

0 голосов
/ 18 февраля 2012

Это может помочь: https://plus.google.com/104769575749979987265/posts/CVdrNMZYU9R

В любом случае это подходит для Linux.

...