Comments (13)
the point is that you have to install Capstone into your system before
running those Python tests.
$ make; $ sudo make install
similarly, brew/macports should be used to install the core before
installing from pip/easy_install. only after that, you can write Python
code.
see http://capstone-engine.org/documentation.html
thanks.
On Tue, Feb 18, 2014 at 1:34 PM, Omar [email protected] wrote:
The error:
2502:python jesus$ python test_x86.py
Traceback (most recent call last):
File "test_x86.py", line 5, in
from capstone import *
File "/Users/xxx/development/capstone-2.0/bindings/python/capstone/init.py", line 1, in
from capstone import Cs, CsError, cs_disasm_quick, cs_version, cs_support, CS_API_MAJOR, CS_API_MINOR, CS_ARCH_ARM, CS_ARCH_ARM64, CS_ARCH_MIPS, CS_ARCH_X86, CS_ARCH_PPC, CS_ARCH_ALL, CS_MODE_LITTLE_ENDIAN, CS_MODE_ARM, CS_MODE_THUMB, CS_OPT_SYNTAX, CS_OPT_SYNTAX_DEFAULT, CS_OPT_SYNTAX_INTEL, CS_OPT_SYNTAX_ATT, CS_OPT_SYNTAX_NOREGNAME, CS_OPT_DETAIL, CS_OPT_ON, CS_OPT_OFF, CS_MODE_16, CS_MODE_32, CS_MODE_64, CS_MODE_BIG_ENDIAN, CS_MODE_MICRO, CS_MODE_N64
File "/Users/xxx/development/capstone-2.0/bindings/python/capstone/capstone.py", line 150, in
raise ImportError("ERROR: fail to load the dynamic library.")
ImportError: ERROR: fail to load the dynamic library.bindings/python/capstone.py when imported looks for libcapstone.dll,
libcapstone.so, and libcapstone.dylib in a number of locations. There _is_a
libcapstone.dylib file that is produced in the root directory of the
project. Moving this to the same folder as capstone.py (in reality it
should work anywhere as long as it's in $PATH) fixes the error. I faced
this problem using both brew&pip and compiling from source. I did not have
this issue on Linux.Reply to this email directly or view it on GitHubhttps://github.com//issues/74
.
from capstone.
I installed capstone using brew before installing the python bindings using pip.
502:~ jesus$ brew install capstone
==> Downloading http://capstone-engine.org/download/2.0/capstone-2.0.tgz
Already downloaded: /Library/Caches/Homebrew/capstone-2.0.tgz
==> ./make.sh
==> ./make.sh install
/usr/local/Cellar/capstone/2.0: 14 files, 6.9M, built in 4 seconds
2502:~ jesus$ sudo pip install capstone
Password:
Downloading/unpacking capstone
Running setup.py egg_info for package capstone
Installing collected packages: capstone
Running setup.py install for capstone
Successfully installed capstone
Cleaning up...
2502:~ jesus$ python
Python 2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import capstone
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/capstone/__init__.py", line 1, in <module>
from capstone import Cs, CsError, cs_disasm_quick, cs_version, cs_support, CS_API_MAJOR, CS_API_MINOR, CS_ARCH_ARM, CS_ARCH_ARM64, CS_ARCH_MIPS, CS_ARCH_X86, CS_ARCH_PPC, CS_ARCH_ALL, CS_MODE_LITTLE_ENDIAN, CS_MODE_ARM, CS_MODE_THUMB, CS_OPT_SYNTAX, CS_OPT_SYNTAX_DEFAULT, CS_OPT_SYNTAX_INTEL, CS_OPT_SYNTAX_ATT, CS_OPT_SYNTAX_NOREGNAME, CS_OPT_DETAIL, CS_OPT_ON, CS_OPT_OFF, CS_MODE_16, CS_MODE_32, CS_MODE_64, CS_MODE_BIG_ENDIAN, CS_MODE_MICRO, CS_MODE_N64
File "/Library/Python/2.7/site-packages/capstone/capstone.py", line 150, in <module>
raise ImportError("ERROR: fail to load the dynamic library.")
ImportError: ERROR: fail to load the dynamic library.
>>>
from capstone.
oh, you need to do some setup before using Python. the reason is brew put
the library in non-standard place.
the solution is to put the path of Capstone library into DYLD_LIBRARY_PATH,
so Python can find it.
can you try this command on command line, and report the result?
$ export DYLD_LIBRARY_PATH=/usr/local/opt/capstone/lib64/:$DYLD_LIBRARY_PATH
thanks.
On Tue, Feb 18, 2014 at 1:57 PM, Omar [email protected] wrote:
I installed capstone using brew before installing the python bindings
using pip.502:~ jesus$ brew install capstone
==> Downloading http://capstone-engine.org/download/2.0/capstone-2.0.tgz
Already downloaded: /Library/Caches/Homebrew/capstone-2.0.tgz
==> ./make.sh
==> ./make.sh install
/usr/local/Cellar/capstone/2.0: 14 files, 6.9M, built in 4 seconds
2502:~ jesus$ sudo pip install capstone
Password:
Downloading/unpacking capstone
Running setup.py egg_info for package capstoneInstalling collected packages: capstone
Running setup.py install for capstoneSuccessfully installed capstone
Cleaning up...
2502:~ jesus$ python
Python 2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.import capstone
Traceback (most recent call last):
File "", line 1, in
File "/Library/Python/2.7/site-packages/capstone/init.py", line 1, in
from capstone import Cs, CsError, cs_disasm_quick, cs_version, cs_support, CS_API_MAJOR, CS_API_MINOR, CS_ARCH_ARM, CS_ARCH_ARM64, CS_ARCH_MIPS, CS_ARCH_X86, CS_ARCH_PPC, CS_ARCH_ALL, CS_MODE_LITTLE_ENDIAN, CS_MODE_ARM, CS_MODE_THUMB, CS_OPT_SYNTAX, CS_OPT_SYNTAX_DEFAULT, CS_OPT_SYNTAX_INTEL, CS_OPT_SYNTAX_ATT, CS_OPT_SYNTAX_NOREGNAME, CS_OPT_DETAIL, CS_OPT_ON, CS_OPT_OFF, CS_MODE_16, CS_MODE_32, CS_MODE_64, CS_MODE_BIG_ENDIAN, CS_MODE_MICRO, CS_MODE_N64
File "/Library/Python/2.7/site-packages/capstone/capstone.py", line 150, 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 GitHubhttps://github.com//issues/74#issuecomment-35355159
.
from capstone.
This fixes the problem. I thought it was make.sh
to blame, but it makes sense that it's brew's fault, since compiling from source actually does work. Thanks for the help.
from capstone.
no problem.
if you are doing anything cool with Capstone, just let us know :-)
thanks.
On Tue, Feb 18, 2014 at 2:44 PM, Omar [email protected] wrote:
This fixes the problem. I thought it was make.sh to blame, but it makes
sense that it's brew's fault, since compiling from source actually does
work. Thanks for the help.Reply to this email directly or view it on GitHubhttps://github.com//issues/74#issuecomment-35356964
.
from capstone.
i'm install capstone by pip in ubuntu 12, but i get same error! Why???
from capstone.
On Tue, Sep 16, 2014 at 2:51 AM, Max [email protected] wrote:
i'm install capstone by pip in ubuntu 12, but i get same error! Why???
did you install the core yet? without the core, the Python binding will not
work.
if you did install the core, how to reproduce your problem?
thanks.
from capstone.
On Tue, Sep 16, 2014 at 8:31 AM, Nguyen Anh Quynh [email protected] wrote:
On Tue, Sep 16, 2014 at 2:51 AM, Max [email protected] wrote:
i'm install capstone by pip in ubuntu 12, but i get same error! Why???
did you install the core yet? without the core, the Python binding will
not work.if you did install the core, how to reproduce your problem?
by the way, make sure to match the core's version with the binding's
version.
example: if you are using Python binding 2.1.2, you need the core 2.1.2.
thanks.
from capstone.
Thanks! I just found brew install capstone
install nothing but INSTALL_RECEIPT.json.
Finally I place libcapstone.dylib into /usr/local/opt/capstone/lib64/ and export:
$ export DYLD_LIBRARY_PATH=/usr/local/opt/capstone/lib64/:$DYLD_LIBRARY_PATH
It works again!
$ brew install capstone
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/capstone-3.0.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring capstone-3.0.yosemite.bottle.tar.gz
🍺 /usr/local/Cellar/capstone/3.0: 5 files, 28K
$ ls /usr/local/opt/capstone/
ChangeLog INSTALL_RECEIPT.json LICENSE.TXT README TODO
$ cat INSTALL_RECEIPT.json
{"used_options":[],"unused_options":[],"built_as_bottle":true,"poured_from_bottle":true,"tapped_from":"Homebrew/homebrew","time":1416408096,"HEAD":"9921bc632ef7158656bba9dc89e2549ca04bb45a","stdlib":null,"compiler":"clang"}
from capstone.
confirmed this issue & working on a fix for Brew formula now, thanks.
from capstone.
this should be fixed now in Brew formula. can you update Brew (with brew update
), then try to reinstall Capstone?
thanks.
from capstone.
After reinstall Capstone 3.0_1, it fix now. Thanks for the great disassembly framework!
$ brew install capstone
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/capstone-3.0_1.yosemite.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/capstone-3.0_1.yosemite.bottle.tar.gz
==> Pouring capstone-3.0_1.yosemite.bottle.tar.gz
🍺 /usr/local/Cellar/capstone/3.0_1: 18 files, 5.6M
$ cd /usr/local/Cellar/capstone/3.0_1/
heineko:3.0_1 zhou$ ls
ChangeLog LICENSE.TXT TODO lib
INSTALL_RECEIPT.json README include
$ ll /usr/local/lib/libcapstone.*
lrwxr-xr-x 1 zhou admin 48 12 3 08:34 /usr/local/lib/libcapstone.3.dylib -> ../Cellar/capstone/3.0_1/lib/libcapstone.3.dylib
lrwxr-xr-x 1 zhou admin 42 12 3 08:34 /usr/local/lib/libcapstone.a -> ../Cellar/capstone/3.0_1/lib/libcapstone.a
lrwxr-xr-x 1 zhou admin 46 12 3 08:34 /usr/local/lib/libcapstone.dylib -> ../Cellar/capstone/3.0_1/lib/libcapstone.dylib
from capstone.
thanks for reporting the issue.
from capstone.
Related Issues (20)
- Got abnormal behavior when set CS_OPT_DETAIL_REAL without CS_OPT_ON
- Can capstone recognize fmv.w.x instruction in RISCV ? HOT 3
- HPPADisassembler.c unitialized variables
- Incorrect/Missing Python Binding for operands within the X86-64 STOS Instruction
- Ensure API is properly documented before `v6`
- Use proper versioning on CMakeLists.txt - pkgconf versions are wrong otherwise HOT 1
- [BPF] `bpf_insn` collides with `libbpf` definition. HOT 13
- Build failure on Windows with MSVC \ capstone_static.vcxproj HOT 4
- HPPADisassembler: more unitialized variables HOT 3
- cs_insn::id is always invalid value on aarch64 HOT 2
- pip install on Mac HOT 1
- skipdata doesn't work correctly from python
- Ability to Generate Bitmasks for Specific Instruction Components? HOT 3
- x64 disassembler big endian bug
- Compiler warnings in the next branch HOT 2
- python bindings depends on setuptools HOT 3
- Remove python2 leftovers
- [AArch64] Instr. with groups `HasNEON`, don't have `HasNEONorSME` and similar assigned. HOT 25
- Release v4.0.3
- Wrong operand type for RISCV compressed instruction disassemble
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from capstone.