环境:winXP,python2.7
网上下载的libasm_1.5
参照这位兄台的做法:http://www.adintr.com/article/blog/263
由于没装VS,所以C的编译很是问题。google了下,有说用MingW即可。
安装完MingW之后,将bin设置到环境变量的path中,基本上准备工作是完成了。为了方便,在%Python27%\Lib\distutils下建了个distutils.cfg,作用是方便在build的时候不用写 --compiler = mingw32
[build]
compiler = mingw32
但是在编译pydasm的时候,还是出现了一点问题,提示 “cc1.exe: 错误:unrecognized command line option ‘-mno-cygwin’”,不识别编译选项
D:\Program Files\Python27\Lib\site-packages\libdasm-1.5\pydasm>setup.py install
running install
running build
running build_ext
building 'pydasm' extension
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
D:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall "-ID:\Program Files\Python27\inc
lude" "-ID:\Program Files\Python27\include" "-ID:\Program Files\Python27\PC" -c
../libdasm.c -o build\temp.win32-2.7\Release\..\libdasm.o
cc1.exe: 错误:unrecognized command line option ‘-mno-cygwin’
error: command 'gcc' failed with exit status 1
费了九牛二虎之力,才找到办法,即修改 %Python27%\Lib\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
直接install ,OK
D:\Program Files\Python27\Lib\site-packages\libdasm-1.5\pydasm>setup.py install
running install
running build
running build_ext
building 'pydasm' extension
D:\MinGW\bin\gcc.exe -mdll -O -Wall "-ID:\Program Files\Python27\include" "-ID:\
Program Files\Python27\include" "-ID:\Program Files\Python27\PC" -c ../libdasm.c
-o build\temp.win32-2.7\Release\..\libdasm.o
D:\MinGW\bin\gcc.exe -mdll -O -Wall "-ID:\Program Files\Python27\include" "-ID:\
Program Files\Python27\include" "-ID:\Program Files\Python27\PC" -c pydasm.c -o
build\temp.win32-2.7\Release\pydasm.o
writing build\temp.win32-2.7\Release\..\pydasm.def
creating build\lib.win32-2.7
D:\MinGW\bin\gcc.exe -shared -s build\temp.win32-2.7\Release\..\libdasm.o build\
temp.win32-2.7\Release\pydasm.o build\temp.win32-2.7\Release\..\pydasm.def "-LD:
\Program Files\Python27\libs" "-LD:\Program Files\Python27\PCbuild" -lpython27 -
lmsvcr90 -o build\lib.win32-2.7\pydasm.pyd
running install_lib
copying build\lib.win32-2.7\pydasm.pyd -> D:\Program Files\Python27\Lib\site-pac
kages
running install_egg_info
Writing D:\Program Files\Python27\Lib\site-packages\pydasm-1.5-py2.7.egg-info
过几天再把pydbg装上