使用Cloud9安装GeoIP时出现问题(Windows 10)

时间:2017-06-28 08:39:01

标签: ruby-on-rails ruby bundler geoip cloud9

我正在尝试建立一个基于云的IDE(在Windows机器上)来测试和更新GitHub上的Ruby项目。我很难安装所有必需的部件。

'bundle install'适用于某一点,然后在这里失败:

checking for iconv_open() in iconv.h... yes
checking for GeoIP_record_by_ipnum() in -lGeoIP... no
you must have geoip c library installed!
.
.
An error occurred while installing geoip-c (0.9.1), and Bundler cannot continue.
Make sure that `gem install geoip-c -v '0.9.1'` succeeds before bundling.

所有这些都失败了:

gem install geoip-c
gem install geoip-c -v '0.9.1'
gem install geoip-c -- --with-geoip-dir=/opt/GeoIP

出现此错误消息:

ERROR:  Error installing geoip-c:
ERROR: Failed to build gem native extension.

current directory: /usr/local/rvm/gems/ruby-2.4.1/gems/geoip-c-0.9.1/ext/geoip
/usr/local/rvm/rubies/ruby-2.4.1/bin/ruby -r ./siteconf20170628-2852-11bgk28.rb extconf.rb
checking for iconv_open() in iconv.h... yes
checking for GeoIP_record_by_ipnum() in -lGeoIP... no
you must have geoip c library installed!

现在已经刮了我的大脑几天 - 感谢任何帮助。

1 个答案:

答案 0 :(得分:1)

这是geoip gem的安装说明。 您需要在Cloud9服务器上执行此操作,而不是在本地Windows 10计算机上执行此操作。

您的应用程序在由cloud9托管的Linux服务器上运行,您需要访问该服务器终端(黑白窗口),以便您可以在Linux主机上安装和配置某些实用程序。

这显示了如何在Cloud9上打开终端 https://docs.c9.io/docs/terminal

这是geoip的安装说明,如果你在cloud9上运行linux服务器,你需要遵循linux的安装说明。

https://github.com/mtodd/geoip#install

所以也许这与Windows不兼容。

  

安装

     

以下一些变体应该有效。

     

安装GeoCity C库。你可以从MaxMind获得它。对于   例如,我喜欢在/ opt / GeoIP中安装我的,所以我这样做:

     

tar -zxvf GeoIP-1.4.3.tar.gz cd GeoIP-1.4.3 ./configure   --prefix = / opt / GeoIP make&& sudo make install

     

在Mac OS X上,您可以使用安装   homebrew

brew install geoip
     

利用Apt的Linux平台有几个可用的软件包:

geoip-bin
geoip-database
libgeoip-dev Now install the geoip gem
     

gem install geoip-c - --with-geoip-dir = / opt / GeoIP

     

或者,如果您使用自制程序安装了libgeoip:

gem install geoip-c Download the GeoLite City database file in binary format at http://www.maxmind.com/app/geolitecity Maybe this
     

直接链接将起作用。我把这个文件放在

中      

/opt/GeoIP/share/GeoIP/GeoLiteCity.dat

     

如果您使用自制软件安装了libgeoip,请将其放入:

/usr/local/share/GeoIP/GeoLiteCity.dat
     

如果您是付费客户,则会下载所需的文件   下面:

     

MaxMind Customer Downloads

     

您需要获取City Rev1数据文件和组织文件   至少。使用它!

     

有关使用详情,请参阅上文。

     

提示

     

可能需要设置

     

export ARCHFLAGS =“ - arch i386”

     

能够编译gem。

     

示例:

env ARCHFLAGS="-arch i386" gem install geoip-c -- --with-geoip-dir=/opt/GeoIP You might find this shell script helpful to install the C library.