首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >gem在MAC 10.7.5上安装pg?

gem在MAC 10.7.5上安装pg?
EN

Stack Overflow用户
提问于 2013-08-12 20:24:57
回答 1查看 1.2K关注 0票数 1

这只是关于同一个问题的另一条线索。如何安装gem pg。我尝试了我在堆栈溢出中找到的几乎所有其他线程,但都无法工作。

我试着通过brew和dmg包安装post宿。结果是同样的错误。

代码语言:javascript
运行
复制
Xcode Verion: 4.6
Rails Version: 4.0.0
Ruby Version: ruby-2.0.0-p247:

$ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gem install pg
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

    /Users/arturo/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/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... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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=/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
    --with-pg
    --without-pg
    --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}/
    --with-pqlib
    --without-pqlib
    --with-libpqlib
    --without-libpqlib
    --with-ms/libpqlib
    --without-ms/libpqlib


Gem files will remain installed in /Users/arturo/.rvm/gems/ruby-2.0.0-p247/gems/pg-0.16.0 for inspection.
Results logged to /Users/arturo/.rvm/gems/ruby-2.0.0-p247/gems/pg-0.16.0/ext/gem_make.out

$ cat /Users/arturo/.rvm/gems/ruby-2.0.0-p247/gems/pg-0.16.0/ext/mkmf.log 
find_executable: checking for pg_config... -------------------- yes

--------------------

"/usr/bin/clang -o conftest -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/x86_64-darwin11.4.2 -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/backward -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0 -I. -I/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/opt/local/include    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration  -fno-common -pipe conftest.c  -L. -L/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/lib -L/usr/lib -L/opt/local/lib -L. -fstack-protector -L/usr/local/lib -L/opt/local/lib      -lruby.2.0.0  -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"/usr/bin/clang -o conftest -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/x86_64-darwin11.4.2 -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/backward -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0 -I. -I/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/opt/local/include    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration  -fno-common -pipe conftest.c  -L. -L/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/lib -L/usr/lib -L/opt/local/lib -L. -fstack-protector -L/usr/local/lib -L/opt/local/lib      -lruby.2.0.0  -Wl,-rpath,/usr/lib -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main() {return 0;}
/* end */

find_header: checking for libpq-fe.h... -------------------- yes

"/usr/bin/clang -E -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/x86_64-darwin11.4.2 -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/backward -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0 -I. -I/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/opt/local/include    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration  -fno-common -pipe  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <libpq-fe.h>
/* end */

--------------------

find_header: checking for libpq/libpq-fs.h... -------------------- yes

"/usr/bin/clang -E -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/x86_64-darwin11.4.2 -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/backward -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0 -I. -I/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/opt/local/include    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration  -fno-common -pipe  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <libpq/libpq-fs.h>
/* end */

--------------------

find_header: checking for pg_config_manual.h... -------------------- yes

"/usr/bin/clang -E -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/x86_64-darwin11.4.2 -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/backward -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0 -I. -I/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/opt/local/include    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration  -fno-common -pipe  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <pg_config_manual.h>
/* end */

--------------------

have_library: checking for PQconnectdb() in -lpq... -------------------- no

"/usr/bin/clang -o conftest -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/x86_64-darwin11.4.2 -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/backward -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0 -I. -I/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/opt/local/include    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration  -fno-common -pipe conftest.c  -L. -L/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/lib -L/usr/lib -L/opt/local/lib -L. -fstack-protector -L/usr/local/lib -L/opt/local/lib  -Wl,-rpath,/usr/lib     -lruby.2.0.0 -lpq  -lpthread -ldl -lobjc "
Undefined symbols for architecture x86_64:
  "_CRYPTO_num_locks", referenced from:
      _pqsecure_initialize in libpq.a(fe-secure.o)
  "_CRYPTO_set_id_callback", referenced from:
      _pqsecure_destroy in libpq.a(fe-secure.o)
      _pqsecure_initialize in libpq.a(fe-secure.o)
  "_CRYPTO_set_locking_callback", referenced from:
      _pqsecure_destroy in libpq.a(fe-secure.o)
      _pqsecure_initialize in libpq.a(fe-secure.o)
  "_ENGINE_by_id", referenced from:
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_ENGINE_finish", referenced from:
      _close_SSL in libpq.a(fe-secure.o)
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_ENGINE_free", referenced from:
      _close_SSL in libpq.a(fe-secure.o)
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_ENGINE_init", referenced from:
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_ENGINE_load_private_key", referenced from:
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_ERR_get_error", referenced from:
      _SSLerrmessage in libpq.a(fe-secure.o)
  "_ERR_reason_error_string", referenced from:
      _SSLerrmessage in libpq.a(fe-secure.o)
  "_GSS_C_NT_HOSTBASED_SERVICE", referenced from:
      _pg_fe_sendauth in libpq.a(fe-auth.o)
  "_OPENSSL_config", referenced from:
      _pqsecure_initialize in libpq.a(fe-secure.o)
  "_SSL_CTX_ctrl", referenced from:
      _pqsecure_initialize in libpq.a(fe-secure.o)
  "_SSL_CTX_get_cert_store", referenced from:
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_SSL_CTX_load_verify_locations", referenced from:
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_SSL_CTX_new", referenced from:
      _pqsecure_initialize in libpq.a(fe-secure.o)
  "_SSL_CTX_use_certificate_chain_file", referenced from:
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_SSL_check_private_key", referenced from:
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_SSL_connect", referenced from:
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_SSL_free", referenced from:
      _close_SSL in libpq.a(fe-secure.o)
  "_SSL_get_error", referenced from:
      _pqsecure_write in libpq.a(fe-secure.o)
      _pqsecure_read in libpq.a(fe-secure.o)
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_SSL_get_peer_certificate", referenced from:
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_SSL_library_init", referenced from:
      _pqsecure_initialize in libpq.a(fe-secure.o)
  "_SSL_load_error_strings", referenced from:
      _pqsecure_initialize in libpq.a(fe-secure.o)
  "_SSL_new", referenced from:
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_SSL_pending", referenced from:
      _pqSocketCheck in libpq.a(fe-misc.o)
  "_SSL_read", referenced from:
      _pqsecure_read in libpq.a(fe-secure.o)
  "_SSL_set_ex_data", referenced from:
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_SSL_set_fd", referenced from:
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_SSL_set_verify", referenced from:
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_SSL_shutdown", referenced from:
      _close_SSL in libpq.a(fe-secure.o)
  "_SSL_use_PrivateKey", referenced from:
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_SSL_use_PrivateKey_file", referenced from:
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_SSL_use_certificate_file", referenced from:
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_SSL_write", referenced from:
      _pqsecure_write in libpq.a(fe-secure.o)
  "_TLSv1_method", referenced from:
      _pqsecure_initialize in libpq.a(fe-secure.o)
  "_X509_NAME_get_text_by_NID", referenced from:
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_X509_NAME_oneline", referenced from:
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_X509_STORE_load_locations", referenced from:
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_X509_STORE_set_flags", referenced from:
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_X509_free", referenced from:
      _close_SSL in libpq.a(fe-secure.o)
  "_X509_get_subject_name", referenced from:
      _pqsecure_open_client in libpq.a(fe-secure.o)
  "_error_message", referenced from:
      _pg_fe_sendauth in libpq.a(fe-auth.o)
  "_gss_delete_sec_context", referenced from:
      _closePGconn in libpq.a(fe-connect.o)
      _pg_GSS_continue in libpq.a(fe-auth.o)
  "_gss_display_status", referenced from:
      _pg_GSS_error_int in libpq.a(fe-auth.o)
  "_gss_import_name", referenced from:
      _pg_fe_sendauth in libpq.a(fe-auth.o)
  "_gss_init_sec_context", referenced from:
      _pg_GSS_continue in libpq.a(fe-auth.o)
  "_gss_release_buffer", referenced from:
      _closePGconn in libpq.a(fe-connect.o)
      _pg_GSS_error_int in libpq.a(fe-auth.o)
      _pg_GSS_continue in libpq.a(fe-auth.o)
  "_gss_release_name", referenced from:
      _closePGconn in libpq.a(fe-connect.o)
      _pg_GSS_continue in libpq.a(fe-auth.o)
  "_krb5_cc_close", referenced from:
      _pg_fe_sendauth in libpq.a(fe-auth.o)
      _pg_krb5_destroy in libpq.a(fe-auth.o)
  "_krb5_cc_default", referenced from:
      _pg_fe_sendauth in libpq.a(fe-auth.o)
  "_krb5_cc_get_principal", referenced from:
      _pg_fe_sendauth in libpq.a(fe-auth.o)
  "_krb5_free_context", referenced from:
      _pg_fe_sendauth in libpq.a(fe-auth.o)
      _pg_krb5_destroy in libpq.a(fe-auth.o)
  "_krb5_free_error", referenced from:
      _pg_fe_sendauth in libpq.a(fe-auth.o)
  "_krb5_free_principal", referenced from:
      _pg_fe_sendauth in libpq.a(fe-auth.o)
      _pg_krb5_destroy in libpq.a(fe-auth.o)
  "_krb5_free_unparsed_name", referenced from:
      _pg_krb5_destroy in libpq.a(fe-auth.o)
  "_krb5_init_context", referenced from:
      _pg_fe_sendauth in libpq.a(fe-auth.o)
  "_krb5_sendauth", referenced from:
      _pg_fe_sendauth in libpq.a(fe-auth.o)
  "_krb5_sname_to_principal", referenced from:
      _pg_fe_sendauth in libpq.a(fe-auth.o)
  "_krb5_unparse_name", referenced from:
      _pg_fe_sendauth in libpq.a(fe-auth.o)
  "_ldap_count_entries", referenced from:
      _parseServiceFile in libpq.a(fe-connect.o)
  "_ldap_err2string", referenced from:
      _parseServiceFile in libpq.a(fe-connect.o)
  "_ldap_first_entry", referenced from:
      _parseServiceFile in libpq.a(fe-connect.o)
  "_ldap_get_values_len", referenced from:
      _parseServiceFile in libpq.a(fe-connect.o)
  "_ldap_init", referenced from:
      _parseServiceFile in libpq.a(fe-connect.o)
  "_ldap_msgfree", referenced from:
      _parseServiceFile in libpq.a(fe-connect.o)
  "_ldap_result", referenced from:
      _parseServiceFile in libpq.a(fe-connect.o)
  "_ldap_search_st", referenced from:
      _parseServiceFile in libpq.a(fe-connect.o)
  "_ldap_simple_bind", referenced from:
      _parseServiceFile in libpq.a(fe-connect.o)
  "_ldap_unbind", referenced from:
      _parseServiceFile in libpq.a(fe-connect.o)
  "_ldap_value_free_len", referenced from:
      _parseServiceFile in libpq.a(fe-connect.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <libpq-fe.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int t(void) { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return 0; }
 8: int main(int argc, char **argv)
 9: {
10:   if (argc > 1000000) {
11:     printf("%p", &t);
12:   }
13: 
14:   return 0;
15: }
/* end */

"/usr/bin/clang -o conftest -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/x86_64-darwin11.4.2 -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/backward -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0 -I. -I/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/opt/local/include    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration  -fno-common -pipe conftest.c  -L. -L/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/lib -L/usr/lib -L/opt/local/lib -L. -fstack-protector -L/usr/local/lib -L/opt/local/lib  -Wl,-rpath,/usr/lib     -lruby.2.0.0 -lpq  -lpthread -ldl -lobjc "
conftest.c:7:27: error: too few arguments to function call, single argument 'conninfo' was not specified
int t(void) { PQconnectdb(); return 0; }
              ~~~~~~~~~~~ ^
/usr/include/libpq-fe.h:234:1: note: 'PQconnectdb' declared here
extern PGconn *PQconnectdb(const char *conninfo);
^
1 error generated.
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <libpq-fe.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int t(void) { PQconnectdb(); return 0; }
 8: int main(int argc, char **argv)
 9: {
10:   if (argc > 1000000) {
11:     printf("%p", &t);
12:   }
13: 
14:   return 0;
15: }
/* end */

--------------------

have_library: checking for PQconnectdb() in -llibpq... -------------------- no

"/usr/bin/clang -o conftest -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/x86_64-darwin11.4.2 -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/backward -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0 -I. -I/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/opt/local/include    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration  -fno-common -pipe conftest.c  -L. -L/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/lib -L/usr/lib -L/opt/local/lib -L. -fstack-protector -L/usr/local/lib -L/opt/local/lib  -Wl,-rpath,/usr/lib     -lruby.2.0.0 -llibpq  -lpthread -ldl -lobjc "
ld: library not found for -llibpq
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <libpq-fe.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int t(void) { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return 0; }
 8: int main(int argc, char **argv)
 9: {
10:   if (argc > 1000000) {
11:     printf("%p", &t);
12:   }
13: 
14:   return 0;
15: }
/* end */

"/usr/bin/clang -o conftest -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/x86_64-darwin11.4.2 -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/backward -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0 -I. -I/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/opt/local/include    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration  -fno-common -pipe conftest.c  -L. -L/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/lib -L/usr/lib -L/opt/local/lib -L. -fstack-protector -L/usr/local/lib -L/opt/local/lib  -Wl,-rpath,/usr/lib     -lruby.2.0.0 -llibpq  -lpthread -ldl -lobjc "
conftest.c:7:27: error: too few arguments to function call, single argument 'conninfo' was not specified
int t(void) { PQconnectdb(); return 0; }
              ~~~~~~~~~~~ ^
/usr/include/libpq-fe.h:234:1: note: 'PQconnectdb' declared here
extern PGconn *PQconnectdb(const char *conninfo);
^
1 error generated.
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <libpq-fe.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int t(void) { PQconnectdb(); return 0; }
 8: int main(int argc, char **argv)
 9: {
10:   if (argc > 1000000) {
11:     printf("%p", &t);
12:   }
13: 
14:   return 0;
15: }
/* end */

--------------------

have_library: checking for PQconnectdb() in -lms/libpq... -------------------- no

"/usr/bin/clang -o conftest -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/x86_64-darwin11.4.2 -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/backward -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0 -I. -I/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/opt/local/include    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration  -fno-common -pipe conftest.c  -L. -L/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/lib -L/usr/lib -L/opt/local/lib -L. -fstack-protector -L/usr/local/lib -L/opt/local/lib  -Wl,-rpath,/usr/lib     -lruby.2.0.0 -lms/libpq  -lpthread -ldl -lobjc "
ld: library not found for -lms/libpq
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <libpq-fe.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int t(void) { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return 0; }
 8: int main(int argc, char **argv)
 9: {
10:   if (argc > 1000000) {
11:     printf("%p", &t);
12:   }
13: 
14:   return 0;
15: }
/* end */

"/usr/bin/clang -o conftest -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/x86_64-darwin11.4.2 -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/backward -I/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0 -I. -I/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/opt/local/include    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration  -fno-common -pipe conftest.c  -L. -L/Users/arturo/.rvm/rubies/ruby-2.0.0-p247/lib -L/usr/lib -L/opt/local/lib -L. -fstack-protector -L/usr/local/lib -L/opt/local/lib  -Wl,-rpath,/usr/lib     -lruby.2.0.0 -lms/libpq  -lpthread -ldl -lobjc "
conftest.c:7:27: error: too few arguments to function call, single argument 'conninfo' was not specified
int t(void) { PQconnectdb(); return 0; }
              ~~~~~~~~~~~ ^
/usr/include/libpq-fe.h:234:1: note: 'PQconnectdb' declared here
extern PGconn *PQconnectdb(const char *conninfo);
^
1 error generated.
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <libpq-fe.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int t(void) { PQconnectdb(); return 0; }
 8: int main(int argc, char **argv)
 9: {
10:   if (argc > 1000000) {
11:     printf("%p", &t);
12:   }
13: 
14:   return 0;
15: }
/* end */

--------------------

提前感谢

解决方案下面的解决方案适用于mac上的mysql和postgresql。

  1. 确保安装了xcode +逗号行工具。
  2. 在我的例子中,我删除了mysql和postgresql以前的安装。我还删除了rvm和它的ruby版本。(不要删除MAC附带的RUBY )
  3. 如果已安装brew,则卸载brew。
  4. 再安装一次啤酒。
  5. 运行$ brew医生
  6. 修正所有来自brew医生的警告。
  7. 运行: brew安装postgresql
  8. 运行: brew安装mysql
  9. 安装rvm
  10. 运行rvm需求并修复任何问题。
  11. 通过rvm安装ruby
  12. 运行创业板安装'pg‘
  13. 运行gem安装'mysql2‘

一切都是好的(Y)

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-08-12 20:52:46

在安装pg之前,必须在您的系统上安装PostgreSQL。

安装它的最简单的方法是使用自制的:http://brew.sh/

  1. 确保首先安装了Xcode。
  2. 运行:brew install postgresql
  3. 添加到您的GemFile:gem 'pg'
  4. 运行:bundle install
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18196054

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档