2011-03-21 3 views
0

Windows 7에 GeoIP-Python-1.2.4를 설치하려고합니다. 하기 전에 GeoIP-1.4.6을 설치해야합니다. 설치를 위해 README.MinGW 지침을 사용하고 있습니다. 나는 MinGW를 사용했고 ./configure를 통과했다. 내가 '메이크업'을 할 때, 나는 오류 다음 얻을 : 나는 단순히 GeoIP가-Python을 설치하려고 할 때ERROR Windows에 GeoIP-Python 설치하기

*** Warning: This system can not link to static lib archive libGeoIP.la. 
*** I have the capability to make that library automatically link in when 
*** you link to this library. But I can only do this if you have a 
*** shared version of the library, which you do not appear to have. 
libtool: link: warning: undefined symbols not allowed in i686-pc-mingw32 shared 
libraries 
ar cru .libs/libGeoIPUpdate.a GeoIPUpdate.o md5.o 
ranlib .libs/libGeoIPUpdate.a 
creating libGeoIPUpdate.la 
(cd .libs && rm -f libGeoIPUpdate.la && cp -p ../libGeoIPUpdate.la libGeoIPUpdat 
e.la) 
make[1]: Leaving directory `/home/Harp/GeoIP-1.4.6/libGeoIP' 
Making all in apps 
make[1]: Entering directory `/home/Harp/GeoIP-1.4.6/apps' 
gcc -DPACKAGE_NAME=\"GeoIP\" -DPACKAGE_TARNAME=\"GeoIP\" -DPACKAGE_VERSION=\"1.4 
.6\" -DPACKAGE_STRING=\"GeoIP\ 1.4.6\" -DPACKAGE_BUGREPORT=\"[email protected] 
\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 - 
DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE 
_STDINT_H=1 -DHAVE_UNISTD_H=1 -D__EXTENSIONS__=1 -D_ALL_SOURCE=1 -D_GNU_SOURCE=1 
-D_POSIX_PTHREAD_SEMANTICS=1 -D_TANDEM_SOURCE=1 -DPACKAGE=\"GeoIP\" -DVERSION=\ 
"1.4.6\" -DLITTLE_ENDIAN_HOST=1 -DHAVE_STDINT_H=1 -DHAVE_ZLIB_H=1 -DHAVE_GETTIME 
OFDAY=1 -DHAVE_VSNPRINTF=1 -DHAVE_VSPRINTF=1 -I. -I../libGeoIP -Wall -DSYSCONFDI 
R=\"/usr/local/etc\" -Wall -O3 -I/usr/local/include -c geoiplookup.c 
/bin/sh ../libtool --tag=CC --mode=link gcc -O3 -I/usr/local/include -L/usr/ 
local/lib -lwsock32 -o geoiplookup.exe geoiplookup.o ../libGeoIP/libGeoIP.la 
mkdir .libs 
gcc -O3 -I/usr/local/include -o geoiplookup.exe geoiplookup.o -L/usr/local/lib 
../libGeoIP/.libs/libGeoIP.a -lwsock32 
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x8af): undefined reference 
to `getnameinfo' 
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0xa1c): undefined reference 
to `getaddrinfo' 
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0xa48): undefined reference 
to `freeaddrinfo' 
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x14ae): undefined referenc 
e to `getaddrinfo' 
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x14e7): undefined referenc 
e to `freeaddrinfo' 
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x162c): undefined referenc 
e to `getaddrinfo' 
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x170f): undefined referenc 
e to `freeaddrinfo' 
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x2713): undefined referenc 
e to `getaddrinfo' 
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x281f): undefined referenc 
e to `freeaddrinfo' 
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x2ffb): undefined referenc 
e to `getaddrinfo' 
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x30bf): undefined referenc 
e to `freeaddrinfo' 
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x32b3): undefined referenc 
e to `getaddrinfo' 
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x3377): undefined referenc 
e to `freeaddrinfo' 
collect2: ld returned 1 exit status 
make[1]: *** [geoiplookup.exe] Error 1 
make[1]: Leaving directory `/home/Harp/GeoIP-1.4.6/apps' 
make: *** [all-recursive] Error 1 

것은, 내가 오류 다음 얻을 :

[email protected] ~/GeoIP-Python-1.2.4 
$ python setup.py install 
running install 
running build 
running build_ext 
building 'GeoIP' extension 
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox 
/MD /W3 /GS- /DNDEBUG -IInclude -Ic:\Python27\include -Ic:\Python27\PC /Tcpy_Geo 
IP.c /Fobuild\temp.win32-2.7\Release\py_GeoIP.obj 
py_GeoIP.c 
py_GeoIP.c(31) : error C2059: syntax error : ';' 
py_GeoIP.c(33) : error C2059: syntax error : '}' 
py_GeoIP.c(37) : error C2065: 'GeoIP_GeoIPObject' : undeclared identifier 
py_GeoIP.c(37) : error C2275: 'GeoIP' : illegal use of this type as an expressio 
n 
     c:\mingw\msys\1.0\home\harp\geoip-python-1.2.4\include\GeoIP.h(74) : see 
declaration of 'GeoIP' 
py_GeoIP.c(38) : error C2143: syntax error : missing ';' before 'type' 
py_GeoIP.c(40) : error C2065: 'flags' : undeclared identifier 
... 
... 
py_GeoIP.c(275) : error C2065: 'GeoIP_GeoIPObject' : undeclared identifier 
py_GeoIP.c(275) : error C2059: syntax error : ')' 
py_GeoIP.c(275) : fatal error C1003: error count exceeds 100; stopping compilati 
on 
error: command '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.ex 
e"' failed with exit status 2 

내 목표는 GeoIP가-파이썬을 설치하는 것입니다. 내가 어떻게 그것을 할 수 있는지 어떤 생각? 또는 누군가이 오류의 의미를 설명 할 수 있습니까?

사전 제작 된 옵션을 찾으려고했지만 아무 것도 찾을 수 없었습니다.

답변

2

당신은

python setup.py build_ext -cmingw32 

시도 할 수 있습니다 (또는 -cmingw는 기억하지 수 있습니다.)

는 (그것을 기본값을는 MinGW 컴파일러를 사용하려고합니다이 방법을, 당신은에서 볼 수있다 명령 줄에서 MSVC로)

0

지시어에서 제공하는 LDFLAGS를 변경하여 GeoIP C 라이브러리를 구축하는 동안 링커 오류가 발생했습니다. winsock32를 연결하는 대신 ws2_32를 연결했습니다. 확인은 여전히 ​​나를 위해 실패하지만 이름 테스트로 2 개 국가 코드에서만 가능합니다. 주소 코드 별 국가 코드는 정상적으로 완료되었습니다.

2

더 나은 선택 : pygeoip, 그것은 MaxMind GeoIP가 데이터베이스에 대한 순수 파이썬 API는 더 이상

를 C API를 필요가 없습니다이다