Ich versuche, bundle
in meinem Rails-Projekt unter OSX 10.9 auszuführen. Es schlägt fehl, wenn Sie mit diesem Fehler zum pg
gem gelangen:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/kyledecot/.rvm/rubies/Ruby-2.0.0-p247/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... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.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 PQescapeLiteral()... yes
checking for PQescapeIdentifier()... yes
checking for PQgetCancel()... yes
checking for lo_create()... yes
checking for pg_encoding_to_char()... yes
checking for pg_char_to_encoding()... yes
checking for PQsetClientEncoding()... yes
checking for PQlibVersion()... yes
checking for PQping()... yes
checking for PQsetSingleRowMode()... yes
checking for rb_encdb_alias()... yes
checking for rb_enc_alias()... no
checking for rb_thread_call_without_gvl()... yes
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_fd_select()... yes
checking for rb_w32_wrap_io_handle()... no
checking for PGRES_COPY_BOTH in libpq-fe.h... no
checking for PGRES_SINGLE_Tuple in libpq-fe.h... no
checking for PG_DIAG_TABLE_NAME in libpq-fe.h... no
checking for struct pgNotify.extra in libpq-fe.h... yes
checking for unistd.h... yes
checking for Ruby/st.h... yes
creating extconf.h
creating Makefile
make "DESTDIR="
compiling gvl_wrappers.c
clang: warning: argument unused during compilation: '-fno-fast-math'
compiling pg.c
clang: warning: argument unused during compilation: '-fno-fast-math'
pg.c:272:9: warning: implicit declaration of function 'PQlibVersion' is invalid in C99 [-Wimplicit-function-declaration]
return INT2NUM(PQlibVersion());
^
In file included from pg.c:48:
In file included from ./pg.h:17:
In file included from /Users/kyledecot/.rvm/rubies/Ruby-2.0.0-p247/include/Ruby-2.0.0/Ruby.h:33:
/Users/kyledecot/.rvm/rubies/Ruby-2.0.0-p247/include/Ruby-2.0.0/Ruby/ruby.h:1167:21: note: instantiated from:
# define INT2NUM(v) INT2FIX((int)(v))
^
pg.c:272:9: note: instantiated from:
return INT2NUM(PQlibVersion());
^
pg.c:272:17: note: instantiated from:
return INT2NUM(PQlibVersion());
^
pg.c:375:48: error: use of undeclared identifier 'PQPING_OK'
rb_define_const(rb_mPGconstants, "PQPING_OK", INT2FIX(PQPING_OK));
^
pg.c:375:56: note: instantiated from:
rb_define_const(rb_mPGconstants, "PQPING_OK", INT2FIX(PQPING_OK));
^
pg.c:377:52: error: use of undeclared identifier 'PQPING_REJECT'
rb_define_const(rb_mPGconstants, "PQPING_REJECT", INT2FIX(PQPING_REJECT));
^
pg.c:377:60: note: instantiated from:
rb_define_const(rb_mPGconstants, "PQPING_REJECT", INT2FIX(PQPING_REJECT));
^
pg.c:379:57: error: use of undeclared identifier 'PQPING_NO_RESPONSE'
rb_define_const(rb_mPGconstants, "PQPING_NO_RESPONSE", INT2FIX(PQPING_NO_RESPONSE));
^
pg.c:379:65: note: instantiated from:
rb_define_const(rb_mPGconstants, "PQPING_NO_RESPONSE", INT2FIX(PQPING_NO_RESPONSE));
^
pg.c:381:56: error: use of undeclared identifier 'PQPING_NO_ATTEMPT'
rb_define_const(rb_mPGconstants, "PQPING_NO_ATTEMPT", INT2FIX(PQPING_NO_ATTEMPT));
^
pg.c:381:64: note: instantiated from:
rb_define_const(rb_mPGconstants, "PQPING_NO_ATTEMPT", INT2FIX(PQPING_NO_ATTEMPT));
^
1 warning and 4 errors generated.
make: *** [pg.o] Error 1
Gem files will remain installed in /Users/kyledecot/.rvm/gems/[email protected]/gems/pg-0.17.0 for inspection.
Results logged to /Users/kyledecot/.rvm/gems/[email protected]/gems/pg-0.17.0/ext/gem_make.out
An error occurred while installing pg (0.17.0), and Bundler cannot continue.
Make sure that `gem install pg -v '0.17.0'` succeeds before bundling.
Stellen Sie außerdem sicher, dass Sie Xcode aktualisiert haben, um Befehlszeilentools auf Mavericks erneut zu installieren. In Terminaltyp:
xcode-select --install
Folgen Sie dann den Anweisungen.
Für mich hat es funktioniert, als ich es tat:
brew install postgresql
das hat für mich mit Mavericks und dem Postgresapp funktioniert:
gem install pg -v '0.17.0' -- --with-pg-config=/Applications/Postgres93.app/Contents/MacOS/bin/pg_config
Versuchen Sie es mit dem --with-pg-config
-Argument:
bundle config build.pg --with-pg-config=/usr/pgsql-9.1/bin/pg_config
So zeigen Sie den Pfad des pg_config
an:
which pg_config
Für Ubuntu-Benutzer:
Sudo apt-get install postgresql
Sudo apt-get install libpq-dev
Dann:
bundle install
Für Mavericks, Rails 3.2.13, Ruby 2.0.0-p247, PostgreSQL 9.1 musste ich Folgendes tun:
gem install pg -v '0.15.1' -- --with-pg-config=/Library/PostgreSQL/9.1/bin/pg_config
Wenn ich versuche zu installieren
apt-get install libpq-dev
Installation fehlgeschlagen, nicht erfüllte Abhängigkeitsprobleme zu lösen
apt-get remove libpq5
dann installieren
apt-get install libpq-dev
Endlich wurde das Problem mit dem Pg behoben.
Ich habe es gerade durch laufen bekommen
ARCHFLAGS="-Arch x86_64" gem install pg
nach der Installation von Postgres mit Brew
Dies funktionierte für mich unter Mac OS X 10.9.3 und Postgres.app Version 9.3.4.2:
1) Installiere Postgres.app
2) bundle config build.pg --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
3) gem install pg -v '0.17.1'
4) bundle install
Sie müssen pg mit Ihrer aktuellen Version konfigurieren. Ich habe meine Version 9.4 auf Yosemite verwendet. Hier ist der folgende Befehl
bundle config build.pg --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
Sie sollten Ihre eigene Version verwenden
bundle config build.pg --with-pg-config=/Applications/Postgres.app/Contents/Versions/(YOUR POSTGRES VERSION)/bin/pg_config
dann mach
bundle install
Folgendes hat für mich gearbeitet:
gem install pg -v '0.18.1' - --with-pg config =/Library/PostgreSQL/9.3/bin/pg_config
An error occurred while installing debugger (1.6.5), and Bundler cannot continue.
Make sure that `gem install debugger -v '1.6.5'` succeeds before bundling.
Ich konnte diesen Fehler durch Rollback auf Ruby v2.0.0 beheben. Ich habe Ruby 2.1.1 ausgeführt, das für diese Debugger-Version nicht unterstützt wird. Überprüfen Sie unbedingt Ihre Ruby-Version, wenn Sie ebenfalls auf dieses Problem stoßen.