logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Third-party Modules View previous topic :: View next topic
Reply to topic   Topic: mod_GeoIP?
Author
JorgenHagglund



Joined: 29 May 2011
Posts: 4
Location: Sweden

PostPosted: Sun 29 May '11 10:38    Post subject: mod_GeoIP? Reply with quote

Hi!
First off, some info:
I have been using Apache HTTPD for several years and just recently switched to Your 64-bit version. Which works great for me.
It's running on a Win2008 x64 server.
One thing I am missing though, is the mod_GeoIP.
I tried the one from ApacheHaus, but Apache won't start with it. I don't really understand why, but I guess it's simply not compiled for Your server.
Does anyone have a link to a working module or can someone tell me how to set up Visual Studio 2010 to compile it?
I've tried compiling it myself, but I get lots of unresolved dependencies.
I'm not really a VC-kind of guy, eventhough I've been programming for 25 years or so. My preferred language of programming is Delphi, so I don't really understand VC.

Hope someone out there is willing to help.

Best regards,
/Jörgn
Back to top
Sob



Joined: 19 Apr 2008
Posts: 30

PostPosted: Mon 30 May '11 0:08    Post subject: Reply with quote

And does Apache say anything about why it refuses to start? Usually it outputs some info to error log.

If you're willing to invest time into compiling, then try quick five-minutes test first. Download also whole Apache from ApacheHaus and try if mod_geoip works with it. It's tested and must work, unless there's something strange about your system and that's exactly what you need to rule out. You don't need to mess with your existing install, just put it into another directory and change listening port from 80 to something else.

Required config:
Code:
LoadModule geoip_module modules/mod_geoip.so
GeoIPEnable On
GeoIPDBFile "c:\path\to\GeoIP.dat"
#if you use IPv6 and get the modified module:
GeoIPDBFile "c:\path\to\GeoIPv6.dat"
Back to top
JorgenHagglund



Joined: 29 May 2011
Posts: 4
Location: Sweden

PostPosted: Mon 30 May '11 0:26    Post subject: Reply with quote

Hi!
It did, sorry about that.
The error message I get is:
Quote:
httpd: Syntax error on line 129 of C:/Program Files/Apache Software Foundation/Test/conf/httpd.conf: Cannot load C:/Program Files/Apache Software Foundation/Test/modules/mod_geoip.so into server: The specified procedure could not be found.


And the same with the Apache Haus binaries.
I'd rather not compile it myself, since my last tries fails on trying to compile MaxMind's GeoIP API. It's really not made for Windows. Smile

Any help is appreciated, though.
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Mon 30 May '11 2:34    Post subject: Reply with quote

I'm thinking the problem is that your Apache is built using vc6, Apache Lounge & Apache Haus modules are built using VC9. The two typically do not play well together, in fact I've never gotten VC9 modules working in VC6 Apache.

Maxmind's GeoIP API 1.4.6 compiles fine on Windows, just the makefiles are kind of bunk.

This includes Sob's IPv6 patch found over at the ApacheHaus' forum. It's built in VC6 if you want it.

Edit: removed old link.


Last edited by glsmith on Fri 09 Mar '18 7:07; edited 2 times in total
Back to top
JorgenHagglund



Joined: 29 May 2011
Posts: 4
Location: Sweden

PostPosted: Mon 30 May '11 10:45    Post subject: Reply with quote

Actually, I installed the package found at this link http://www.apachelounge.com/viewtopic.php?t=3508
So, I'm almost sure it's not a VC6 issue.
On the other hand, maybe VC9 and VC10 isn't compatible either?

As I said in my original post, I'm not a VC-guy, I just don't get what all settings are about. Delphi is so much easier. The problem is that the header files would take far too long to translate, otherwise I would use Delphi.
So, if You, or anyone else, could provide a step-by-step instruction on how to set it all up, I could try compiling it myself.
I'm stuck with errors like these:
Code:
1>mod_geoip.obj : error LNK2019: unresolved external symbol __imp_apr_pool_cleanup_register referenced in function geoip_server_init
1>mod_geoip.obj : error LNK2019: unresolved external symbol GeoIP_new referenced in function geoip_server_init

And, about 26 more of the same kind...
Back to top
Sob



Joined: 19 Apr 2008
Posts: 30

PostPosted: Mon 30 May '11 13:26    Post subject: Reply with quote

This is how I do it with VC9 (paths need to be adjusted):

Code:
cl.exe /MD /W3 /O2 /D WIN32 /D NDEBUG -I"c:\Apache22\include" -I"..\GeoIP-1.4.6\libGeoIP" -c mod_geoip.c
link.exe /dll /machine:AMD64 /OUT:mod_geoip.so /libpath:"c:\Apache22\lib" /libpath:"..\GeoIP-1.4.6\libGeoIP" mod_geoip.obj GeoIP.lib libapr-1.lib libhttpd.lib ws2_32.lib


It assumes successfully compiled libGeoIP. I don't have instructions for that, because I have a bad habit of not writing the notes down, because "I'll surely remember". Of course later, for example now, all I know that it wasn't so hard. Wink I might check it later if needed.
Back to top
JorgenHagglund



Joined: 29 May 2011
Posts: 4
Location: Sweden

PostPosted: Mon 30 May '11 14:46    Post subject: Reply with quote

Thanks for the starter. Smile
I just have to say that C sucks... Tried to compile GeoIP 1.4.7 (the latest) but it chokes on a bunch of stuff, so I tried 1.4.6, as You used it.
Now, I'm stuck with this:
Code:
mod_geoip.c
mod_geoip.c(326) : warning C4013: 'ap_add_common_vars' undefined; asuming extern returning int
mod_geoip.c(301) : warning C4101: 'gip' : unreferenced local variable

When using this:
Code:
cl /MD /W3 /O2 /D WIN32 /D NDEBUG /nologo /favor:AMD64 -I"..\httpd-2.2.19\include" -I"..\GeoIP-1.4.6\libGeoIP" -I"..\httpd-2.2.19\srclib\apr\include" -I"..\httpd-2.2.19\srclib\apr-util\include" -I"..\httpd-2.2.19\os\win32" -c mod_geoip.c

Any idea of what I've missed?
Back to top
Sob



Joined: 19 Apr 2008
Posts: 30

PostPosted: Mon 30 May '11 16:15    Post subject: Reply with quote

The linking part. You got mod_geoip.obj from cl. Now call link and you'll get what you need. Or unresolved externals if something goes wrong.
Back to top


Reply to topic   Topic: mod_GeoIP? View previous topic :: View next topic
Post new topic   Forum Index -> Third-party Modules