PyCrypto 윈도우즈 환경에서 컴파일하기 edit

PyCrypto는 파이썬 암호화 툴킷이다.

MinGW 설치

C로 작성된 소스들을 컴파일하기위해 MinGW를 설치하였고 설치도중 MSYS 설치해야 autoconf 에러가 안난다.

MSYS is a collection of GNU utilities such as bash, make, gawk and grep to allow building of applications and programs which depend on traditionally UNIX tools to be present. It is intended to supplement MinGW and the deficiencies of the cmd shell.

시스템 환경 변수 수정

설치 이후 환경 변수(컴퓨터 > 고급 시스템 설정 > 고급 탭 > 환경 변수)의 시스템 변수 Path에 아래 경로를 새로 추가해준다. ';'는 경로들을 구분짓기위한 문자이다.

;C:\MinGW\bin;C:\MinGW\msys\1.0\bin

만약 바로 적용이 안된다면 시스템을 재부팅 하거나 레지스트리 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\EnvironmentPath값을 직접 수정한다.

빌드(설치) 하기

컴파일러 옵션 없이 setup.py를 실행하면 vcvarsall.bat를 찾을 수 없다는 에러가 난다. 옵션 --compiler=mingw32를 붙여준다.

python setup.py install --compiler=mingw32

gcc: error: unrecognized command line option '-mno-cygwin'

컴파일 도중 위와 같은 에러가 난다면 C:\python2.x\distutils\cygwinccompiler.py를 직접 수정하여 -mno-cygwin를 찾아 바꿔 모조리 지워버린다.

It sounds like GCC 4.7.0 has finally removed the deprecated -mno-cygwin option, but distutils has not yet caught up with it. Either install a slightly older version of MinGW, or edit distutils\cygwinccompiler.py in your Python directory to remove all instances of -mno-cygwin.

-mno-cygwin옵션은 더이상 사용되지 않는 옵션이며 파이썬 버그리포트 참조.

0 comments:

Post a Comment

Newer -> <- Older