使用rubymine后没有安装rubygem pg

问题描述 投票:1回答:3

我第一次尝试了rubymine并更改了Postgresql设置,现在gem不会安装。下面是尝试安装gem后的错误副本。我删除了Rubymine应用程序及其创建的文件后运行。

Aris-MacBook-Pro:~ arikalmen$ gem install pg
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

    current directory: /Users/arikalmen/.rvm/gems/ruby-2.4.1/gems/pg-0.21.0/ext
/Users/arikalmen/.rvm/rubies/ruby-2.4.1/bin/ruby -r ./siteconf20171221-20772-masvtl.rb 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=/Users/arikalmen/.rvm/rubies/ruby-2.4.1/bin/$(RUBY_BASE_NAME)
    --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

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/arikalmen/.rvm/gems/ruby-2.4.1/extensions/x86_64-darwin-17/2.4.0/pg-0.21.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/arikalmen/.rvm/gems/ruby-2.4.1/gems/pg-0.21.0 for inspection.
Results logged to /Users/arikalmen/.rvm/gems/ruby-2.4.1/extensions/x86_64-darwin-17/2.4.0/pg-0.21.0/gem_make.out
Aris-MacBook-Pro:~ arikalmen$

下面粘贴的是前面提到的mkmf.log

/users/阿日卡乐门/.如VM/戈麦斯/Ruby-2.4.1/extensions/小86_64-Darwin-17/2.4.0/苹果-0.21.0/哥们_马克.呕吐

ind_executable: checking for pg_config... -------------------- no

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

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

"gcc -o conftest -I/Users/arikalmen/.rvm/rubies/ruby-2.4.1/include/ruby-2.4.0/x86_64-darwin17 -I/Users/arikalmen/.rvm/rubies/ruby-2.4.1/include/ruby-2.4.0/ruby/backward -I/Users/arikalmen/.rvm/rubies/ruby-2.4.1/include/ruby-2.4.0 -I.  -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/[email protected]/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens  -fno-common -pipe conftest.c  -L. -L/Users/arikalmen/.rvm/rubies/ruby-2.4.1/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/[email protected]/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/[email protected]/lib     -lruby.2.4.1  -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 */

"gcc -E -I/Users/arikalmen/.rvm/rubies/ruby-2.4.1/include/ruby-2.4.0/x86_64-darwin17 -I/Users/arikalmen/.rvm/rubies/ruby-2.4.1/include/ruby-2.4.0/ruby/backward -I/Users/arikalmen/.rvm/rubies/ruby-2.4.1/include/ruby-2.4.0 -I.  -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/[email protected]/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens  -fno-common -pipe  conftest.c -o conftest.i"
conftest.c:3:10: fatal error: 'libpq-fe.h' file not found
#include <libpq-fe.h>
         ^~~~~~~~~~~~
1 error generated.
checked program was:
"mkmf.log" [readonly] 31L, 2722C
ruby postgresql rubygems rvm rubymine
3个回答
1
投票

首先,安装缺少的库:

brew install libpqxx

然后按照此LINK中的步骤操作


0
投票

上面的错误消息说:

检查libpq-fe.h ...没有

找不到'libpq-fe.h标头

安装它应该可以解决您的错误。


0
投票

你需要指定ARCHFLAG,试试这个:sudo ARCHFLAGS="-arch x86_64" gem install pg

© www.soinside.com 2019 - 2024. All rights reserved.