我在Mac OS X High Sierra和Rails 5.2上有postgres 10.4,但是当我尝试安装pg gem时,我得到了一个gem building错误。尽管成功确认了pg_config,但它表示无法构建gem。我希望有人能看到这个错误并指出我正确的方向吗?
cdougherty1242m% 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/cdougherty/.rvm/gems/jruby-9.1.13.0/gems/pg-1.0.0/ext
/Users/cdougherty/.rvm/rubies/jruby-9.1.13.0/bin/jruby -r ./siteconf20180523-76754-a2cdps.rb extconf.rb
checking for pg_config... yes
Using config values from /usr/local/bin/pg_config
RuntimeError: The compiler failed to generate an executable file.
You have to install development tools first.
try_do at /Users/cdougherty/.rvm/rubies/jruby-9.1.13.0/lib/ruby/stdlib/mkmf.rb:456
try_link0 at /Users/cdougherty/.rvm/rubies/jruby-9.1.13.0/lib/ruby/stdlib/mkmf.rb:541
try_link at /Users/cdougherty/.rvm/rubies/jruby-9.1.13.0/lib/ruby/stdlib/mkmf.rb:556
<main> at extconf.rb:40
*** 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.
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/cdougherty/.rvm/gems/jruby-9.1.13.0/extensions/universal-java-1.8/2.3.0/pg-1.0.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/cdougherty/.rvm/gems/jruby-9.1.13.0/gems/pg-1.0.0 for inspection.
Results logged to /Users/cdougherty/.rvm/gems/jruby-9.1.13.0/extensions/universal-java-1.8/2.3.0/pg-1.0.0/gem_make.out
如果它有帮助,这是来自mfmk日志的猫。
find_executable: checking for pg_config... -------------------- yes
" -o conftest -I/include/universal-java1.8 -I/Users/cdougherty/.rvm/rubies/jruby-9.1.13.0/lib/ruby/include/ruby/backward -I/Users/cdougherty/.rvm/rubies/jruby-9.1.13.0/lib/ruby/include -I. -I/usr/local/Cellar/postgresql/10.4/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fPIC -DTARGET_RT_MAC_CFM=0 -fno-omit-frame-pointer -fno-strict-aliasing -fexceptions conftest.c -L. -L/Users/cdougherty/.rvm/rubies/jruby-9.1.13.0/lib -L/usr/local/lib -arch x86_64 "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <ruby.h>
4: int main(int argc, char **argv)
5: {
6: return 0;
7: }
/* end */