Closed MarioVilas closed 9 years ago
Thanks, i will look into that.
Meanwhile, you might want to get the Pypi package "capstone-windows", which has the prebuilt core inside, so no compilation is needed. On Mar 17, 2015 6:46 AM, "Mario Vilas" notifications@github.com wrote:
Building seems to work, but setup.py fails. Tested using PIP installer, I haven't tried a manual install.
$ /bin/pip install -U capstone Collecting capstone Downloading capstone-3.0.2.tar.gz (3.1MB) 100% |################################| 3.1MB 209kB/s Installing collected packages: capstone Running setup.py install for capstone building 'capstone' library rm -f ./cs.o ./utils.o ./SStream.o ./MCInstrDesc.o ./MCRegisterInfo.o ./arch/ARM/ARMDisassembler.o ./arch/ARM/ARMInstPrinter.o ./arch/ARM/ARMMapping.o ./arch/ARM/ARMModule.o ./arch/AArch64/AArch64BaseInfo.o ./arch/AArch64/AArch64Disassembler.o ./arch/AArch64/AArch64InstPrinter.o ./arch/AArch64/AArch64Mapping.o ./arch/AArch64/AArch64Module.o ./arch/Mips/MipsDisassembler.o ./arch/Mips/MipsInstPrinter.o ./arch/Mips/MipsMapping.o ./arch/Mips/MipsModule.o ./arch/PowerPC/PPCDisassembler.o ./arch/PowerPC/PPCInstPrinter.o ./arch/PowerPC/PPCMapping.o ./arch/PowerPC/PPCModule.o ./arch/Sparc/SparcDisassembler.o ./arch/Sparc/SparcInstPrinter.o ./arch/Sparc/SparcMapping.o ./arch/Sparc/SparcModule.o ./arch/SystemZ/SystemZDisassembler.o ./arch/SystemZ/SystemZInstPrinter.o ./arch/SystemZ/SystemZMapping.o ./arch/SystemZ/SystemZModule.o ./arch/SystemZ/SystemZMCTargetDesc.o ./arch/X86/X86DisassemblerDecoder.o ./arch/X86/X86Disassembler.o ./arch/X86/X86IntelInstPrinter.o ./arch/X86/X86ATTIns tPrinter.o ./arch/X86/X86Mapping.o ./arch/X86/X86Module.o ./arch/XCore/XCoreDisassembler.o ./arch/XCore/XCoreInstPrinter.o ./arch/XCore/XCoreMapping.o ./arch/XCore/XCoreModule.o ./MCInst.o rm -f ./libcapstone.* ./capstone.* rm -f ./capstone.pc CC cs.o CC utils.o CC SStream.o CC MCInstrDesc.o CC MCRegisterInfo.o CC arch/ARM/ARMDisassembler.o CC arch/ARM/ARMInstPrinter.o CC arch/ARM/ARMMapping.o CC arch/ARM/ARMModule.o CC arch/AArch64/AArch64BaseInfo.o CC arch/AArch64/AArch64Disassembler.o CC arch/AArch64/AArch64InstPrinter.o CC arch/AArch64/AArch64Mapping.o CC arch/AArch64/AArch64Module.o CC arch/Mips/MipsDisassembler.o CC arch/Mips/MipsInstPrinter.o CC arch/Mips/MipsMapping.o CC arch/Mips/MipsModule.o CC arch/PowerPC/PPCDisassembler.o CC arch/PowerPC/PPCInstPrinter.o CC arch/PowerPC/PPCMapping.o CC arch/PowerPC/PPCModule.o CC arch/Sparc/SparcDisassembler.o CC arch/Sparc/SparcInstPrinter.o CC arch/Sparc/SparcMapping.o CC arch/Sparc/SparcModule.o CC arch/SystemZ/SystemZDisassembler.o CC arch/SystemZ/SystemZInstPrinter.o CC arch/SystemZ/SystemZMapping.o CC arch/SystemZ/SystemZModule.o CC arch/SystemZ/SystemZMCTargetDesc.o CC arch/X86/X86DisassemblerDecoder.o CC arch/X86/X86Disassembler.o CC arch/X86/X86IntelInstPrinter.o CC arch/X86/X86ATTInstPrinter.o CC arch/X86/X86Mapping.o CC arch/X86/X86Module.o CC arch/XCore/XCoreDisassembler.o CC arch/XCore/XCoreInstPrinter.o CC arch/XCore/XCoreMapping.o CC arch/XCore/XCoreModule.o CC MCInst.o LINK capstone.dll AR capstone.lib ar: creating ./capstone.lib GEN capstone.pc error: can't copy 'src/libcapstone.so': doesn't exist or not a regular file Complete output from command /usr/bin/python2.7 -c "import setuptools, tokenize;file='/tmp/pip-build-GFVBsC/capstone/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-5P2om6-record/install-record.txt --single-version-externally-managed --compile: running install
running build running build_py creating build creating build/lib creating build/lib/capstone copying capstone/arm.py -> build/lib/capstone copying capstone/arm64.py -> build/lib/capstone copying capstone/arm64_const.py -> build/lib/capstone copying capstone/arm_const.py -> build/lib/capstone copying capstone/hexagon.py -> build/lib/capstone copying capstone/hexagon_const.py -> build/lib/capstone copying capstone/mips.py -> build/lib/capstone copying capstone/mips_const.py -> build/lib/capstone copying capstone/ppc.py -> build/lib/capstone copying capstone/ppc_const.py -> build/lib/capstone copying capstone/sparc.py -> build/lib/capstone copying capstone/sparc_const.py -> build/lib/capstone copying capstone/systemz.py -> build/lib/capstone copying capstone/sysz_const.py -> build/lib/capstone copying capstone/x86.py -> build/lib/capstone copying capstone/x86_const.py -> build/lib/capstone copying capstone/xcore.py -> build/lib/capstone copying capstone/xcore_const.py -> build/lib/capstone copying capstone/__init__.py -> build/lib/capstone running build_clib running custom_build_clib building 'capstone' library rm -f ./cs.o ./utils.o ./SStream.o ./MCInstrDesc.o ./MCRegisterInfo.o ./arch/ARM/ARMDisassembler.o ./arch/ARM/ARMInstPrinter.o ./arch/ARM/ARMMapping.o ./arch/ARM/ARMModule.o ./arch/AArch64/AArch64BaseInfo.o ./arch/AArch64/AArch64Disassembler.o ./arch/AArch64/AArch64InstPrinter.o ./arch/AArch64/AArch64Mapping.o ./arch/AArch64/AArch64Module.o ./arch/Mips/MipsDisassembler.o ./arch/Mips/MipsInstPrinter.o ./arch/Mips/MipsMapping.o ./arch/Mips/MipsModule.o ./arch/PowerPC/PPCDisassembler.o ./arch/PowerPC/PPCInstPrinter.o ./arch/PowerPC/PPCMapping.o ./arch/PowerPC/PPCModule.o ./arch/Sparc/SparcDisassembler.o ./arch/Sparc/SparcInstPrinter.o ./arch/Sparc/SparcMapping.o ./arch/Sparc/SparcModule.o ./arch/SystemZ/SystemZDisassembler.o ./arch/SystemZ/SystemZInstPrinter.o ./arch/SystemZ/SystemZMapping.o ./arch/SystemZ/SystemZModule.o ./arch/SystemZ/SystemZMCTargetDesc.o ./arch/X86/X86DisassemblerDecoder.o ./arch/X86/X86Disassembler.o ./arch/X86/X86IntelInstPrinter.o ./arch/X86/X86ATTIns
tPrinter.o ./arch/X86/X86Mapping.o ./arch/X86/X86Module.o ./arch/XCore/XCoreDisassembler.o ./arch/XCore/XCoreInstPrinter.o ./arch/XCore/XCoreMapping.o ./arch/XCore/XCoreModule.o ./MCInst.o
rm -f ./libcapstone.* ./capstone.* rm -f ./capstone.pc CC cs.o CC utils.o CC SStream.o CC MCInstrDesc.o CC MCRegisterInfo.o CC arch/ARM/ARMDisassembler.o CC arch/ARM/ARMInstPrinter.o CC arch/ARM/ARMMapping.o CC arch/ARM/ARMModule.o CC arch/AArch64/AArch64BaseInfo.o CC arch/AArch64/AArch64Disassembler.o CC arch/AArch64/AArch64InstPrinter.o CC arch/AArch64/AArch64Mapping.o CC arch/AArch64/AArch64Module.o CC arch/Mips/MipsDisassembler.o CC arch/Mips/MipsInstPrinter.o CC arch/Mips/MipsMapping.o CC arch/Mips/MipsModule.o CC arch/PowerPC/PPCDisassembler.o CC arch/PowerPC/PPCInstPrinter.o CC arch/PowerPC/PPCMapping.o CC arch/PowerPC/PPCModule.o CC arch/Sparc/SparcDisassembler.o CC arch/Sparc/SparcInstPrinter.o CC arch/Sparc/SparcMapping.o CC arch/Sparc/SparcModule.o CC arch/SystemZ/SystemZDisassembler.o CC arch/SystemZ/SystemZInstPrinter.o CC arch/SystemZ/SystemZMapping.o CC arch/SystemZ/SystemZModule.o CC arch/SystemZ/SystemZMCTargetDesc.o CC arch/X86/X86DisassemblerDecoder.o CC arch/X86/X86Disassembler.o CC arch/X86/X86IntelInstPrinter.o CC arch/X86/X86ATTInstPrinter.o CC arch/X86/X86Mapping.o CC arch/X86/X86Module.o CC arch/XCore/XCoreDisassembler.o CC arch/XCore/XCoreInstPrinter.o CC arch/XCore/XCoreMapping.o CC arch/XCore/XCoreModule.o CC MCInst.o LINK capstone.dll AR capstone.lib ar: creating ./capstone.lib GEN capstone.pc running install_lib copying build/lib/capstone/arm.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/arm64.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/arm64_const.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/arm_const.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/hexagon.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/hexagon_const.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/mips.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/mips_const.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/ppc.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/ppc_const.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/sparc.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/sparc_const.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/systemz.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/sysz_const.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/x86.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/x86_const.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/xcore.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/xcore_const.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/__init__.py -> /usr/lib/python2.7/site-packages/capstone byte-compiling /usr/lib/python2.7/site-packages/capstone/arm.py to arm.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/arm64.py to arm64.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/arm64_const.py to arm64_const.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/arm_const.py to arm_const.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/hexagon.py to hexagon.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/hexagon_const.py to hexagon_const.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/mips.py to mips.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/mips_const.py to mips_const.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/ppc.py to ppc.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/ppc_const.py to ppc_const.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/sparc.py to sparc.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/sparc_const.py to sparc_const.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/systemz.py to systemz.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/sysz_const.py to sysz_const.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/x86.py to x86.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/x86_const.py to x86_const.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/xcore.py to xcore.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/xcore_const.py to xcore_const.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/__init__.py to __init__.pyc running install_data error: can't copy 'src/libcapstone.so': doesn't exist or not a regular file ---------------------------------------- Command "/usr/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-build-GFVBsC/capstone/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-5P2om6-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-GFVBsC/capstone
— Reply to this email directly or view it on GitHub https://github.com/aquynh/capstone/issues/289.
Thanks for your response! :)
The package capstone-windows seems to install correctly on Cygwin64, but then it fails when trying to load it:
$ python
Python 2.7.8 (default, Jul 25 2014, 14:04:36)
[GCC 4.8.3] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import capstone
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/capstone/__init__.py", line 230, in <module>
raise ImportError("ERROR: fail to load the dynamic library.")
ImportError: ERROR: fail to load the dynamic library.
>>>
Again, this was using the PIP installer.
could you please apply the patch at https://gist.github.com/aquynh/062f30f612ebb731521d and run setup.py install
again on Cygwin to see if the problem is solved?
thanks.
No difference. I checked out the sources from Github, compiled Capstone, then patched bindings/python/setup.py as instructed. Installation works, but still doesn't load the lib:
$ ./setup.py install
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/capstone
copying capstone/arm.py -> build/lib/capstone
copying capstone/arm64.py -> build/lib/capstone
copying capstone/arm64_const.py -> build/lib/capstone
copying capstone/arm_const.py -> build/lib/capstone
copying capstone/mips.py -> build/lib/capstone
copying capstone/mips_const.py -> build/lib/capstone
copying capstone/ppc.py -> build/lib/capstone
copying capstone/ppc_const.py -> build/lib/capstone
copying capstone/sparc.py -> build/lib/capstone
copying capstone/sparc_const.py -> build/lib/capstone
copying capstone/systemz.py -> build/lib/capstone
copying capstone/sysz_const.py -> build/lib/capstone
copying capstone/x86.py -> build/lib/capstone
copying capstone/x86_const.py -> build/lib/capstone
copying capstone/xcore.py -> build/lib/capstone
copying capstone/xcore_const.py -> build/lib/capstone
copying capstone/__init__.py -> build/lib/capstone
running build_clib
running custom_build_clib
running install_lib
creating /usr/lib/python2.7/site-packages/capstone
copying build/lib/capstone/arm.py -> /usr/lib/python2.7/site-packages/capstone
copying build/lib/capstone/arm64.py -> /usr/lib/python2.7/site-packages/capstone
copying build/lib/capstone/arm64_const.py -> /usr/lib/python2.7/site-packages/capstone
copying build/lib/capstone/arm_const.py -> /usr/lib/python2.7/site-packages/capstone
copying build/lib/capstone/mips.py -> /usr/lib/python2.7/site-packages/capstone
copying build/lib/capstone/mips_const.py -> /usr/lib/python2.7/site-packages/capstone
copying build/lib/capstone/ppc.py -> /usr/lib/python2.7/site-packages/capstone
copying build/lib/capstone/ppc_const.py -> /usr/lib/python2.7/site-packages/capstone
copying build/lib/capstone/sparc.py -> /usr/lib/python2.7/site-packages/capstone
copying build/lib/capstone/sparc_const.py -> /usr/lib/python2.7/site-packages/capstone
copying build/lib/capstone/systemz.py -> /usr/lib/python2.7/site-packages/capstone
copying build/lib/capstone/sysz_const.py -> /usr/lib/python2.7/site-packages/capstone
copying build/lib/capstone/x86.py -> /usr/lib/python2.7/site-packages/capstone
copying build/lib/capstone/x86_const.py -> /usr/lib/python2.7/site-packages/capstone
copying build/lib/capstone/xcore.py -> /usr/lib/python2.7/site-packages/capstone
copying build/lib/capstone/xcore_const.py -> /usr/lib/python2.7/site-packages/capstone
copying build/lib/capstone/__init__.py -> /usr/lib/python2.7/site-packages/capstone
byte-compiling /usr/lib/python2.7/site-packages/capstone/arm.py to arm.pyc
byte-compiling /usr/lib/python2.7/site-packages/capstone/arm64.py to arm64.pyc
byte-compiling /usr/lib/python2.7/site-packages/capstone/arm64_const.py to arm64_const.pyc
byte-compiling /usr/lib/python2.7/site-packages/capstone/arm_const.py to arm_const.pyc
byte-compiling /usr/lib/python2.7/site-packages/capstone/mips.py to mips.pyc
byte-compiling /usr/lib/python2.7/site-packages/capstone/mips_const.py to mips_const.pyc
byte-compiling /usr/lib/python2.7/site-packages/capstone/ppc.py to ppc.pyc
byte-compiling /usr/lib/python2.7/site-packages/capstone/ppc_const.py to ppc_const.pyc
byte-compiling /usr/lib/python2.7/site-packages/capstone/sparc.py to sparc.pyc
byte-compiling /usr/lib/python2.7/site-packages/capstone/sparc_const.py to sparc_const.pyc
byte-compiling /usr/lib/python2.7/site-packages/capstone/systemz.py to systemz.pyc
byte-compiling /usr/lib/python2.7/site-packages/capstone/sysz_const.py to sysz_const.pyc
byte-compiling /usr/lib/python2.7/site-packages/capstone/x86.py to x86.pyc
byte-compiling /usr/lib/python2.7/site-packages/capstone/x86_const.py to x86_const.pyc
byte-compiling /usr/lib/python2.7/site-packages/capstone/xcore.py to xcore.pyc
byte-compiling /usr/lib/python2.7/site-packages/capstone/xcore_const.py to xcore_const.pyc
byte-compiling /usr/lib/python2.7/site-packages/capstone/__init__.py to __init__.pyc
running install_data
running install_egg_info
Writing /usr/lib/python2.7/site-packages/capstone-3.0.2-py2.7.egg-info
$ python
Python 2.7.8 (default, Jul 25 2014, 14:04:36)
[GCC 4.8.3] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import capstone
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/capstone/__init__.py", line 230, in <module>
raise ImportError("ERROR: fail to load the dynamic library.")
ImportError: ERROR: fail to load the dynamic library.
>>>
Did you patch setup.py downloaded from Pypi package, then try to install again?
What is the output of "sys.platform" on your Cygwin?
Thanks On Mar 17, 2015 7:44 PM, "Mario Vilas" notifications@github.com wrote:
No difference. I checked out the sources from Github, compiled Capstone, then patched bindings/python/setup.py as instructed. Installation works, but still doesn't load the lib:
$ ./setup.py install running install running build running build_py creating build creating build/lib creating build/lib/capstone copying capstone/arm.py -> build/lib/capstone copying capstone/arm64.py -> build/lib/capstone copying capstone/arm64_const.py -> build/lib/capstone copying capstone/arm_const.py -> build/lib/capstone copying capstone/mips.py -> build/lib/capstone copying capstone/mips_const.py -> build/lib/capstone copying capstone/ppc.py -> build/lib/capstone copying capstone/ppc_const.py -> build/lib/capstone copying capstone/sparc.py -> build/lib/capstone copying capstone/sparc_const.py -> build/lib/capstone copying capstone/systemz.py -> build/lib/capstone copying capstone/sysz_const.py -> build/lib/capstone copying capstone/x86.py -> build/lib/capstone copying capstone/x86_const.py -> build/lib/capstone copying capstone/xcore.py -> build/lib/capstone copying capstone/xcore_const.py -> build/lib/capstone copying capstone/init.py -> build/lib/capstone running build_clib running custom_build_clib running install_lib creating /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/arm.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/arm64.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/arm64_const.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/arm_const.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/mips.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/mips_const.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/ppc.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/ppc_const.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/sparc.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/sparc_const.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/systemz.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/sysz_const.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/x86.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/x86_const.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/xcore.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/xcore_const.py -> /usr/lib/python2.7/site-packages/capstone copying build/lib/capstone/init.py -> /usr/lib/python2.7/site-packages/capstone byte-compiling /usr/lib/python2.7/site-packages/capstone/arm.py to arm.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/arm64.py to arm64.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/arm64_const.py to arm64_const.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/arm_const.py to arm_const.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/mips.py to mips.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/mips_const.py to mips_const.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/ppc.py to ppc.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/ppc_const.py to ppc_const.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/sparc.py to sparc.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/sparc_const.py to sparc_const.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/systemz.py to systemz.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/sysz_const.py to sysz_const.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/x86.py to x86.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/x86_const.py to x86_const.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/xcore.py to xcore.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/xcore_const.py to xcore_const.pyc byte-compiling /usr/lib/python2.7/site-packages/capstone/init.py to init.pyc running install_data running install_egg_info Writing /usr/lib/python2.7/site-packages/capstone-3.0.2-py2.7.egg-info $ python Python 2.7.8 (default, Jul 25 2014, 14:04:36) [GCC 4.8.3] on cygwin Type "help", "copyright", "credits" or "license" for more information.
import capstone Traceback (most recent call last): File "
", line 1, in File "/usr/lib/python2.7/site-packages/capstone/init.py", line 230, in raise ImportError("ERROR: fail to load the dynamic library.") ImportError: ERROR: fail to load the dynamic library. — Reply to this email directly or view it on GitHub https://github.com/aquynh/capstone/issues/289#issuecomment-82324897.
"sys.platform" is the expected:
$ python
Python 2.7.8 (default, Jul 25 2014, 14:04:36)
[GCC 4.8.3] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.platform
'cygwin'
>>>
I patched the sources from Github. I'll try again now with the Pypi package instead.
Ok, I tried unpacking the .tar.gz from Pypi, patching setup.py and running that. Now it won't install :(
$ ./setup.py install
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/capstone
copying capstone/arm.py -> build/lib/capstone
copying capstone/arm64.py -> build/lib/capstone
copying capstone/arm64_const.py -> build/lib/capstone
copying capstone/arm_const.py -> build/lib/capstone
copying capstone/hexagon.py -> build/lib/capstone
copying capstone/hexagon_const.py -> build/lib/capstone
copying capstone/mips.py -> build/lib/capstone
copying capstone/mips_const.py -> build/lib/capstone
copying capstone/ppc.py -> build/lib/capstone
copying capstone/ppc_const.py -> build/lib/capstone
copying capstone/sparc.py -> build/lib/capstone
copying capstone/sparc_const.py -> build/lib/capstone
copying capstone/systemz.py -> build/lib/capstone
copying capstone/sysz_const.py -> build/lib/capstone
copying capstone/x86.py -> build/lib/capstone
copying capstone/x86_const.py -> build/lib/capstone
copying capstone/xcore.py -> build/lib/capstone
copying capstone/xcore_const.py -> build/lib/capstone
copying capstone/__init__.py -> build/lib/capstone
running build_clib
running custom_build_clib
building 'capstone' library
rm -f ./cs.o ./utils.o ./SStream.o ./MCInstrDesc.o ./MCRegisterInfo.o ./arch/ARM/ARMDisassembler.o ./arch/ARM/ARMInstPrinter.o ./arch/ARM/ARMMapping.o ./arch/ARM/ARMModule.o ./arch/AArch64/AArch64BaseInfo.o ./arch/AArch64/AArch64Disassembler.o ./arch/AArch64/AArch64InstPrinter.o ./arch/AArch64/AArch64Mapping.o ./arch/AArch64/AArch64Module.o ./arch/Mips/MipsDisassembler.o ./arch/Mips/MipsInstPrinter.o ./arch/Mips/MipsMapping.o ./arch/Mips/MipsModule.o ./arch/PowerPC/PPCDisassembler.o ./arch/PowerPC/PPCInstPrinter.o ./arch/PowerPC/PPCMapping.o ./arch/PowerPC/PPCModule.o ./arch/Sparc/SparcDisassembler.o ./arch/Sparc/SparcInstPrinter.o ./arch/Sparc/SparcMapping.o ./arch/Sparc/SparcModule.o ./arch/SystemZ/SystemZDisassembler.o ./arch/SystemZ/SystemZInstPrinter.o ./arch/SystemZ/SystemZMapping.o ./arch/SystemZ/SystemZModule.o ./arch/SystemZ/SystemZMCTargetDesc.o ./arch/X86/X86DisassemblerDecoder.o ./arch/X86/X86Disassembler.o ./arch/X86/X86IntelInstPrinter.o ./arch/X86/X86ATTInstPrinter.o ./arch/X86/X86Mapping.o ./arch/X86/X86Module.o ./arch/XCore/XCoreDisassembler.o ./arch/XCore/XCoreInstPrinter.o ./arch/XCore/XCoreMapping.o ./arch/XCore/XCoreModule.o ./MCInst.o
rm -f ./libcapstone.* ./capstone.*
rm -f ./capstone.pc
CC cs.o
CC utils.o
CC SStream.o
CC MCInstrDesc.o
CC MCRegisterInfo.o
CC arch/ARM/ARMDisassembler.o
CC arch/ARM/ARMInstPrinter.o
CC arch/ARM/ARMMapping.o
CC arch/ARM/ARMModule.o
CC arch/AArch64/AArch64BaseInfo.o
CC arch/AArch64/AArch64Disassembler.o
CC arch/AArch64/AArch64InstPrinter.o
CC arch/AArch64/AArch64Mapping.o
CC arch/AArch64/AArch64Module.o
CC arch/Mips/MipsDisassembler.o
CC arch/Mips/MipsInstPrinter.o
CC arch/Mips/MipsMapping.o
CC arch/Mips/MipsModule.o
CC arch/PowerPC/PPCDisassembler.o
CC arch/PowerPC/PPCInstPrinter.o
CC arch/PowerPC/PPCMapping.o
CC arch/PowerPC/PPCModule.o
CC arch/Sparc/SparcDisassembler.o
CC arch/Sparc/SparcInstPrinter.o
CC arch/Sparc/SparcMapping.o
CC arch/Sparc/SparcModule.o
CC arch/SystemZ/SystemZDisassembler.o
CC arch/SystemZ/SystemZInstPrinter.o
CC arch/SystemZ/SystemZMapping.o
CC arch/SystemZ/SystemZModule.o
CC arch/SystemZ/SystemZMCTargetDesc.o
CC arch/X86/X86DisassemblerDecoder.o
CC arch/X86/X86Disassembler.o
CC arch/X86/X86IntelInstPrinter.o
CC arch/X86/X86ATTInstPrinter.o
CC arch/X86/X86Mapping.o
CC arch/X86/X86Module.o
CC arch/XCore/XCoreDisassembler.o
CC arch/XCore/XCoreInstPrinter.o
CC arch/XCore/XCoreMapping.o
CC arch/XCore/XCoreModule.o
CC MCInst.o
LINK capstone.dll
AR capstone.lib
ar: creating ./capstone.lib
GEN capstone.pc
running install_lib
copying build/lib/capstone/hexagon.py -> /usr/lib/python2.7/site-packages/capstone
copying build/lib/capstone/hexagon_const.py -> /usr/lib/python2.7/site-packages/capstone
byte-compiling /usr/lib/python2.7/site-packages/capstone/hexagon.py to hexagon.pyc
byte-compiling /usr/lib/python2.7/site-packages/capstone/hexagon_const.py to hexagon_const.pyc
running install_data
error: can't copy 'src/libcapstone.so': doesn't exist or not a regular file
There are more platform checks down below, I think more stuff needs to be patched. I'll try coming up with a patch of my own.
Ok, got it working. Here's the patch to setup.py: https://gist.github.com/MarioVilas/9e7111b8443cb7e116a4
Please could you make a Pull Request, so i can just merge it?
Thanks
On Mar 17, 2015 8:22 PM, "Mario Vilas" notifications@github.com wrote:
Ok, got it working. Here's the patch to setup.py: https://gist.github.com/MarioVilas/9e7111b8443cb7e116a4
— Reply to this email directly or view it on GitHub.
I'm getting something similar right now (pip3 install capstone
) on cygwin 64 python 3.4.
Below is the is final lines before the error on setup.py.
CC arch/XCore/XCoreMapping.o
CC arch/XCore/XCoreModule.o
CC MCInst.o
LINK capstone.dll
./arch/Sparc/SparcInstPrinter.o:SparcInstPrinter.c:(.text+0x680): multiple definition of `imaxabs'
./arch/PowerPC/PPCInstPrinter.o:PPCInstPrinter.c:(.text+0x134f0): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:331: capstone.dll] Error 1
running install_lib
creating /usr/lib/python3.4/site-packages/capstone
copying build/lib/capstone/arm.py -> /usr/lib/python3.4/site-packages/capstone
copying build/lib/capstone/arm64.py -> /usr/lib/python3.4/site-packages/capstone
copying build/lib/capstone/arm64_const.py -> /usr/lib/python3.4/site-packages/capstone
copying build/lib/capstone/arm_const.py -> /usr/lib/python3.4/site-packages/capstone
copying build/lib/capstone/hexagon.py -> /usr/lib/python3.4/site-packages/capstone
copying build/lib/capstone/hexagon_const.py -> /usr/lib/python3.4/site-packages/capstone
copying build/lib/capstone/mips.py -> /usr/lib/python3.4/site-packages/capstone
copying build/lib/capstone/mips_const.py -> /usr/lib/python3.4/site-packages/capstone
copying build/lib/capstone/ppc.py -> /usr/lib/python3.4/site-packages/capstone
copying build/lib/capstone/ppc_const.py -> /usr/lib/python3.4/site-packages/capstone
copying build/lib/capstone/sparc.py -> /usr/lib/python3.4/site-packages/capstone
copying build/lib/capstone/sparc_const.py -> /usr/lib/python3.4/site-packages/capstone
copying build/lib/capstone/systemz.py -> /usr/lib/python3.4/site-packages/capstone
copying build/lib/capstone/sysz_const.py -> /usr/lib/python3.4/site-packages/capstone
copying build/lib/capstone/x86.py -> /usr/lib/python3.4/site-packages/capstone
copying build/lib/capstone/x86_const.py -> /usr/lib/python3.4/site-packages/capstone
copying build/lib/capstone/xcore.py -> /usr/lib/python3.4/site-packages/capstone
copying build/lib/capstone/xcore_const.py -> /usr/lib/python3.4/site-packages/capstone
copying build/lib/capstone/__init__.py -> /usr/lib/python3.4/site-packages/capstone
byte-compiling /usr/lib/python3.4/site-packages/capstone/arm.py to arm.cpython-34.pyc
byte-compiling /usr/lib/python3.4/site-packages/capstone/arm64.py to arm64.cpython-34.pyc
byte-compiling /usr/lib/python3.4/site-packages/capstone/arm64_const.py to arm64_const.cpython-34.pyc
byte-compiling /usr/lib/python3.4/site-packages/capstone/arm_const.py to arm_const.cpython-34.pyc
byte-compiling /usr/lib/python3.4/site-packages/capstone/hexagon.py to hexagon.cpython-34.pyc
byte-compiling /usr/lib/python3.4/site-packages/capstone/hexagon_const.py to hexagon_const.cpython-34.pyc
byte-compiling /usr/lib/python3.4/site-packages/capstone/mips.py to mips.cpython-34.pyc
byte-compiling /usr/lib/python3.4/site-packages/capstone/mips_const.py to mips_const.cpython-34.pyc
byte-compiling /usr/lib/python3.4/site-packages/capstone/ppc.py to ppc.cpython-34.pyc
byte-compiling /usr/lib/python3.4/site-packages/capstone/ppc_const.py to ppc_const.cpython-34.pyc
byte-compiling /usr/lib/python3.4/site-packages/capstone/sparc.py to sparc.cpython-34.pyc
byte-compiling /usr/lib/python3.4/site-packages/capstone/sparc_const.py to sparc_const.cpython-34.pyc
byte-compiling /usr/lib/python3.4/site-packages/capstone/systemz.py to systemz.cpython-34.pyc
byte-compiling /usr/lib/python3.4/site-packages/capstone/sysz_const.py to sysz_const.cpython-34.pyc
byte-compiling /usr/lib/python3.4/site-packages/capstone/x86.py to x86.cpython-34.pyc
byte-compiling /usr/lib/python3.4/site-packages/capstone/x86_const.py to x86_const.cpython-34.pyc
byte-compiling /usr/lib/python3.4/site-packages/capstone/xcore.py to xcore.cpython-34.pyc
byte-compiling /usr/lib/python3.4/site-packages/capstone/xcore_const.py to xcore_const.cpython-34.pyc
byte-compiling /usr/lib/python3.4/site-packages/capstone/__init__.py to __init__.cpython-34.pyc
running install_data
error: can't copy 'src/capstone.dll': doesn't exist or not a regular file
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-grjoi2bp/capstone/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-zbnxn4dy-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-grjoi2bp/capstone/
can you try with the branch "next" and directly install from Github code?
pip3 install "https://github.com/aquynh/capstone/archive/next.zip#egg=capstone&subdirectory=bindings/python"
@aquynh I still get the same error:
> pip3 install "https://github.com/aquynh/capstone/archive/next.zip#egg=capstone&subdirectory=bindings/python"
Collecting capstone from https://github.com/aquynh/capstone/archive/next.zip#egg=capstone&subdirectory=bindings/python
Downloading https://github.com/aquynh/capstone/archive/next.zip
/ 3.4MB 3.2MB/s
Installing collected packages: capstone
Running setup.py install for capstone ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-qpicwgmi/capstone/bindings/python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-vuz0dsd3-record/install-record.txt --single-version-externally-managed --compile:
/usr/lib/python3.4/site-packages/setuptools/dist.py:282: UserWarning: Normalizing '4.0.0.rc1' to '4.0.0rc1'
normalized_version,
running install
running build
Building C extensions
CC cs.o
CC MCInstrDesc.o
CC utils.o
CC SStream.o
CC MCRegisterInfo.o
CC arch/ARM/ARMDisassembler.o
CC arch/ARM/ARMInstPrinter.o
CC arch/ARM/ARMMapping.o
CC arch/ARM/ARMModule.o
CC arch/AArch64/AArch64BaseInfo.o
CC arch/AArch64/AArch64Disassembler.o
CC arch/AArch64/AArch64InstPrinter.o
CC arch/AArch64/AArch64Mapping.o
CC arch/AArch64/AArch64Module.o
CC arch/M68K/M68KInstPrinter.o
CC arch/M68K/M68KDisassembler.o
CC arch/M68K/M68KModule.o
CC arch/Mips/MipsDisassembler.o
CC arch/Mips/MipsInstPrinter.o
CC arch/Mips/MipsMapping.o
CC arch/Mips/MipsModule.o
CC arch/PowerPC/PPCDisassembler.o
CC arch/PowerPC/PPCInstPrinter.o
CC arch/PowerPC/PPCMapping.o
CC arch/PowerPC/PPCModule.o
CC arch/Sparc/SparcDisassembler.o
CC arch/Sparc/SparcInstPrinter.o
CC arch/Sparc/SparcMapping.o
CC arch/Sparc/SparcModule.o
CC arch/SystemZ/SystemZDisassembler.o
CC arch/SystemZ/SystemZInstPrinter.o
CC arch/SystemZ/SystemZMapping.o
CC arch/SystemZ/SystemZModule.o
CC arch/SystemZ/SystemZMCTargetDesc.o
CC arch/X86/X86DisassemblerDecoder.o
CC arch/X86/X86Disassembler.o
CC arch/X86/X86IntelInstPrinter.o
CC arch/X86/X86ATTInstPrinter.o
CC arch/X86/X86Mapping.o
CC arch/X86/X86Module.o
CC arch/XCore/XCoreDisassembler.o
CC arch/XCore/XCoreInstPrinter.o
CC arch/XCore/XCoreMapping.o
CC arch/XCore/XCoreModule.o
CC MCInst.o
GEN capstone.pc
LINK capstone.
AR capstone.lib
ar: creating ./capstone.lib
error: [Errno 2] No such file or directory: 'capstone.dll'
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-qpicwgmi/capstone/bindings/python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-vuz0dsd3-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-qpicwgmi/capstone/bindings/python
i dont have Cygwin setup now to test this.
@rhelmot, what do you think about this "pip install" issue??
I don't have a working cygwin install right now, so I can't test this for myself... but the line LINK capstone.
from the build log looks incredibly suspect. That seems like an error in the main build system, not the python bindings. Can you post the output of cc -dumpmachine | grep -i cygwin | wc -l
from your cygwin system?
Building seems to work, but setup.py fails. Tested using PIP installer, I haven't tried a manual install.