huey
huey

Reputation: 115

Problems installing GeoIP using Cloud9 (Windows 10)

I'm trying to set up a cloud-based IDE (on a Windows machine) to test and update a Ruby project on GitHub. I'm struggled with installing all the required parts.

'bundle install' works to a point, then it fails here:

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.

All of these fail:

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

with this error message:

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!

Been scratching my brain for a couple of days now - any help gratefully appreciated.

Upvotes: 0

Views: 410

Answers (1)

fabOnReact
fabOnReact

Reputation: 5942

this are the install instructions from the geoip gem. You need to perform this on the Cloud9 server, not on your local windows 10 machine.

Your application is running on a Linux Server hosted by cloud9, you need to access that server terminal (the black and white window) so that you can install and configure some utilities on the Linux host.

This shows how to open the terminal on Cloud9 https://docs.c9.io/docs/terminal

This are the installation instructions for geoip, you need to follow those for linux, if you are running on cloud9 a linux server.

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

So maybe this is just not compatible with Windows.

Install

Some variation of the following should work.

Install the GeoCity C library. You can get it from MaxMind. For example, I like to install mine in /opt/GeoIP, so I do this:

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

On Mac OS X, you can install using homebrew:

brew install geoip

Linux platforms utilizing Apt have several packages available:

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

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

Alternatively, if you installed libgeoip using homebrew:

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

direct link will work. I put this file in

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

If you installed libgeoip using homebrew then put it in:

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

If you are a paying customer, you will download the files required below:

MaxMind Customer Downloads

You will want to get the City Rev1 data file and Organization files at minimum. Use it!

See above for usage details.

Hints

Might need to set

export ARCHFLAGS="-arch i386"

to be able to compile the gem.

Example:

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.

Upvotes: 1

Related Questions