使用cocoapods安装AFNetworking时无法找到libpq.h标头

时间:2015-03-11 14:16:16

标签: ios ruby afnetworking cocoapods

我已经有各种pod与我的Xcode项目完美配合。我现在尝试通过修改podfile来安装AFNetworking pod。这是我的新podfile

platform : ios '7.0'

pod 'MKNetworkKit'
pod 'SBJson', '~> 4.0.0'
pod 'MBProgressHUD'
pod 'STTweetLabel'
pod 'AFNetworking'

然而,当我运行命令

pod update

它引发了我这个问题

/Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/ext/builder.rb:89:in `run': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError)

/Users/fernandolizana/.rvm/rubies/ruby-2.1.1/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... no
Can't find the 'libpq-fe.h header

extconf failed, exit code 1

Gem files will remain installed in /Users/fernandolizana/.rvm/gems/ruby-2.1.1/gems/pg-0.17.1 for inspection.
Results logged to /Users/fernandolizana/.rvm/gems/ruby-2.1.1/extensions/x86_64-darwin-12/2.1.0-static/pg-0.17.1/gem_make.out
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:38:in `block in build'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/tempfile.rb:324:in `open'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:17:in `build'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/ext/builder.rb:161:in `block (2 levels) in build_extension'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:in `chdir'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:in `block in build_extension'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/ext/builder.rb:159:in `synchronize'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/ext/builder.rb:159:in `build_extension'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/ext/builder.rb:198:in `block in build_extensions'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in `each'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in `build_extensions'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/specification.rb:1436:in `block in build_extensions'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/user_interaction.rb:45:in `use_ui'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/specification.rb:1434:in `build_extensions'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/stub_specification.rb:60:in `build_extensions'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/specification.rb:925:in `block in find_inactive_by_path'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/specification.rb:924:in `each'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/specification.rb:924:in `find'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/specification.rb:924:in `find_inactive_by_path'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems.rb:185:in `try_activate'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
from /Users/fernandolizana/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
from /Users/fernandolizana/.rvm/gems/ruby-2.1.1@global/gems/rubygems-bundler-1.4.3/lib/rubygems_executable_plugin.rb:4:in `block in <top (required)>'
from /Users/fernandolizana/.rvm/gems/ruby-2.1.1@global/gems/executable-hooks-1.3.1/lib/executable-hooks/hooks.rb:50:in `call'
from /Users/fernandolizana/.rvm/gems/ruby-2.1.1@global/gems/executable-hooks-1.3.1/lib/executable-hooks/hooks.rb:50:in `block in run'
from /Users/fernandolizana/.rvm/gems/ruby-2.1.1@global/gems/executable-hooks-1.3.1/lib/executable-hooks/hooks.rb:49:in `each'
from /Users/fernandolizana/.rvm/gems/ruby-2.1.1@global/gems/executable-hooks-1.3.1/lib/executable-hooks/hooks.rb:49:in `run'
from /Users/fernandolizana/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:10:in `<main>'

我尝试重新安装cocoapods并使用另一个版本的ruby。

1 个答案:

答案 0 :(得分:0)

最后通过运行

解决了这个问题
gem update --system
gem update cocoapods
pod update