Git Product home page Git Product logo

Comments (6)

abh avatar abh commented on August 12, 2024

You need to install the geoip development package. (geoip-devel or libgeoip-dev or some such).

from geoip.

fatih avatar fatih commented on August 12, 2024

Ok seems this is then an extra dependency that I have to take care of. Because I'm doing development on Mac but deploying on a Linux machine. Will have a look.

from geoip.

abh avatar abh commented on August 12, 2024

Ah, installing geoip via macports should work then. Do you use something else?

from geoip.

abh avatar abh commented on August 12, 2024

The default flags that it compiles with are

#cgo CFLAGS: -I/opt/local/include -I/usr/local/include -I/usr/include
#cgo LDFLAGS: -lGeoIP -L/opt/local/lib -L/usr/local/lib -L/usr/lib

So the headers and library file needs to be found there.

Beware that cgo doesn't support cross compilations, so you can't compile linux binaries for your program on OS X. (But geoip works fine on OS X, that's how I develop too and then deploy on Linux and FreeBSD).

from geoip.

fatih avatar fatih commented on August 12, 2024

Thanks for the info @abh. Just one question, I've found this https://github.com/nranchev/go-libGeoIP. This just implement it instead of using the C library. Is your choice better? or is there any reason you're using the c library?

from geoip.

abh avatar abh commented on August 12, 2024

@fatih I think I also tried go-libGeoIP briefly and it didn't work for me right away. Re-using the C library means "less new code" which was important for me in my first use case (the GeoDNS server), so using cgo made more sense. Also when I started I wasn't very good at Go (this was the first thing I did after "Hello World" because it was a dependency for me for the real project), so wrapping C was easier than writing a lot of Go. :-)

There are tradeoffs either way, I haven't done any benchmarks.

Whichever one you use will be good for the community as long as you report any bugs you find and send patches if you can. :-)

from geoip.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.