前言
问题出现
近期在研究动态链接库的跨平台汇编时,用到了keystone-engine这个库。
发现直接在python里输入pip install 出现如下异常信息:
pip install keystone-engine
错误信息:
'..' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
running install_lib
warning: install_lib: byte-compiling is disabled, skipping.
running install_data
error: can't copy 'src\build\llvm\lib\libkeystone.so': doesn't exist or not a regular file
搜索方案
在谷歌上搜索关键字 warning: install_lib: byte-compiling is disabled, skipping.
发现几个可用答案:
1.
python安装库报 error: can’t copy ‘src/build/llvm/lib/libkeystone.so’
手动编译源码安装
$ git clone https://github.com/keystone-engine/keystone.git
$ cd keystone
$ mkdir build
$ cd build
$ ../make-share.sh
$ sudo make install
$ sudo ldconfig
$ cd ../bindings/python
$ sudo make install3 # or sudo make install for python2-bindings
2.
跨平台调so函数的框架
提到的issue答案:
https://github.com/keystone-engine/keystone/issues/388
试下官方的方法吧
GitHub issue 提供的方法
方案1 自行重编译
Mojave stopped supporting 32bit architecture.
You need to download sources from https://pypi.org/project/keystone-engine/#files
Delete i386 from src/make-common.sh and then build it manually.
cd keystone-engine-0.9.1-3
sudo python setup.py install
it will build it fine.
In my case IDA still wouldn't find keystone module when it tried to load keypatch so I followed this troubleshoot.
keystone-engine/keypatch#12
Now it works fine
方案2 下载平台二进制文件(已采用)
My environment is windows10 python3.7 report similar fault,solve method load http://www.keystone-engine.org/download/ Python module for Windows - Binaries.
下载python 64 位的安装文件 下载地址
https://github.com/keystone-engine/keystone/releases/download/0.9.1/keystone-0.9.1-python-win64.msi
成功解决
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-0xiVs9Ry-1635837790679)(en-resource://database/998:1)]
程序直接运行无异常了