ImportError: ERROR : fail to load the dynamic library
shinmao opened this issue · 2 comments
After I run the sudo python setup.py install
in the project directory, it always can show https://github.com/JonathanSalwan/ROPgadget
, so I think I should have installed successfully. However, when I make the command of $ ROPgadget, it always show the error like following:
Traceback (most recent call last):
File "/usr/local/bin/ROPgadget", line 4, in <module>
__import__('pkg_resources').run_script('ROPGadget==5.6', 'ROPgadget')
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 742, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1510, in run_script
exec(script_code, namespace, namespace)
File "/usr/local/lib/python2.7/dist-packages/ROPGadget-5.6-py2.7.egg/EGG-INFO/scripts/ROPgadget", line 10, in <module>
File "build/bdist.linux-x86_64/egg/ropgadget/__init__.py", line 10, in <module>
File "build/bdist.linux-x86_64/egg/ropgadget/binary.py", line 9, in <module>
File "build/bdist.linux-x86_64/egg/ropgadget/loaders/__init__.py", line 9, in <module>
File "build/bdist.linux-x86_64/egg/ropgadget/loaders/elf.py", line 9, in <module>
File "/home/parallels/.local/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.
Do you know how to solve the problem? I have already tried apt-get update
, reinstall python, and rerun the setup.py for many times. Please help me to handle this problem, thank you very much!
it is because capstone cant find it library, you can open
/home/parallels/.local/lib/python2.7/site-packages/capstone/__init__.py
and see line 195:
_all_libs = ['capstone.dll', 'libcapstone.so.3', 'libcapstone.so', 'libcapstone.dylib']
find where is your lib is and add the path to the list:
_all_libs = ['capstone.dll', 'libcapstone.so.3', 'libcapstone.so', '/usr/local/Cellar/capstone/3.0.4/lib/libcapstone.dylib']
then just save and all will be ok.
@seviezhou really thanks for your help, I have solved the problem.