Michael Durrant
Michael Durrant

Reputation: 96554

bundle geoip-c - gives error "you must have geoip c library installed"

Trying to bundle an app that has gem geoip-c but getting

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

How to get past this?

I was able to brew install geoip and now brew list geoip shows

/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

Upvotes: 3

Views: 1480

Answers (3)

teju c
teju c

Reputation: 336

For Linux environments

As mentioned in the geoip-c gem readme file, you need to install following libraries first

  • sudo apt-get install geoip-bin
  • sudo apt-get install geoip-database
  • sudo apt-get install libgeoip-dev

Upvotes: 4

skojin
skojin

Reputation: 33

Install only libgeoip-dev is enough

Upvotes: 0

lmnleaf
lmnleaf

Reputation: 111

To address this, set the following environment variables to the geoip lib and include directories using this command:

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

Upvotes: 11

Related Questions