[英]Symbol not found using dlopen in Python
I compiled BlockSci in macOS High Sierra 10.13.6.我在 macOS High Sierra 10.13.6 中编译了 BlockSci。 This created
/usr/local/lib/libblocksci.dylib
.这创建了
/usr/local/lib/libblocksci.dylib
。 I used pip3
to install the blocksci
Python analysis library and this created /Users/${USER}/dev/BlockSci/blockscipy/blocksci/_blocksci.cpython-39-darwin.so
.我使用
pip3
安装了blocksci
Python 分析库,这创建了/Users/${USER}/dev/BlockSci/blockscipy/blocksci/_blocksci.cpython-39-darwin.so
。
When I try to import the library via $ python3 hello.py
:当我尝试通过
$ python3 hello.py
导入库时:
import blocksci
It creates the following error in dlopen
due to a symbol not found:由于找不到符号,它会在
dlopen
中创建以下错误:
Traceback (most recent call last):
File "/Users/${USER}/dev/BlockSci/hello.py", line 1, in <module>
import blocksci
File "/Users/${USER}/dev/BlockSci/blockscipy/blocksci/__init__.py", line 29, in <module>
from ._blocksci import *
ImportError: dlopen(/Users/${USER}/dev/BlockSci/blockscipy/blocksci/_blocksci.cpython-39-darwin.so, 2): Symbol not found: __ZN8blocksci10heuristics16getPoisonTaintedERSt6vectorINS_6OutputESaIS2_EEib
Referenced from: /Users/${USER}/dev/BlockSci/blockscipy/blocksci/_blocksci.cpython-39-darwin.so
Expected in: flat namespace
in /Users/${USER}/dev/BlockSci/blockscipy/blocksci/_blocksci.cpython-39-darwin.so
I found this and this to be informative but I can't determine how to fix this so I can interact with the C++ library.我发现this和this提供了丰富的信息,但我无法确定如何解决这个问题,以便我可以与 C++ 库进行交互。
Finally, pip3 list
returns:最后,
pip3 list
返回:
Package Version Editable project location
--------------------- ----------- ----------------------------------------
astroid 2.5
blocksci 0.7.0 /Users/${USER}/dev/BlockSci/blockscipy
certifi 2021.10.8
...
I found the problem.我发现了问题。 I was mixing compilers, using clang for the BlockSci code and gcc in pybind11 to bind the C++ code with Python.
我正在混合编译器,对 BlockSci 代码使用 clang,在 pybind11 中使用 gcc 将 C++ 代码与 Python 绑定。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.