ruby-on-rails - 捆绑 geoip-c - 给出错误 "you must have geoip c library installed"

标签 ruby-on-rails ruby geoip

尝试捆绑具有 gem geoip-c 但得到

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/Users/durrantm/.rvm/rubies/ruby-2.1.5/bin/ruby -r ./siteconf20151116-4194-j
cyop7.rb extconf.rb
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... yes
checking for GeoIP_record_by_ipnum() in -lGeoIP... no
you must have geoip c library installed!
*** 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
        --without-opt-dir
        --with-opt-include

如何解决这个问题?

我能够 brew install geoip 现在 brew list geoip 显示

/usr/local/Cellar/geoip/1.6.7/bin/geoiplookup
/usr/local/Cellar/geoip/1.6.7/bin/geoiplookup6
/usr/local/Cellar/geoip/1.6.7/include/ (2 files)
/usr/local/Cellar/geoip/1.6.7/lib/libGeoIP.1.dylib
/usr/local/Cellar/geoip/1.6.7/lib/pkgconfig/geoip.pc
/usr/local/Cellar/geoip/1.6.7/lib/ (2 other files)
/usr/local/Cellar/geoip/1.6.7/share/man/ (2 files)
20:59:38 durrantm Michaels-MacBook-Air /Users/durrantm/eq/lynx master

最佳答案

要解决此问题,请将以下环境变量设置为 geoip 库并使用此命令包含目录:

env LDFLAGS=`pkg-config geoip --libs-only-L` CFLAGS=`pkg-config geoip --cflags-only-I` gem install geoip-c

关于ruby-on-rails - 捆绑 geoip-c - 给出错误 "you must have geoip c library installed",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33747907/

相关文章:

javascript - 用于 Twitter Bootstrap 模式的 cucumber 功能

javascript - Rails 5 与咖啡和 jquery

ruby-on-rails - 如果我的服务器不支持 GCC 4.7 怎么办? sass 包

asp.net - geoIP 从 ASP.NET 查找国家

jquery - 使用 Geoplugin 基于国家/地区的自动下拉菜单

ruby-on-rails - FactoryGirl 使用 Rspec 创建字典

ruby-on-rails - 为什么 ActiveRecord 提供 .delete_all 而不是 .truncate?

ruby - MongoDB Ruby 驱动程序 - `synchronize' : can't be called from trap context

ruby - 在使用 Ruby 连接到 HTTPS url 并将源数据传递给 Nokogiri 方面需要帮助

geoip - 如何查找 IP 地址的历史地理位置,也许使用 maxmind?