简体   繁体   English

在 Python 中使用 dlopen 找不到符号

[英]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.我发现thisthis提供了丰富的信息,但我无法确定如何解决这个问题,以便我可以与 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.

相关问题 找不到dlopen符号:_PyClass_Type - dlopen Symbol not found: _PyClass_Type ImportError:dlopen(…):找不到符号:__PyCodecInfo_GetIncrementalDecoder - ImportError: dlopen(…): Symbol not found: __PyCodecInfo_GetIncrementalDecoder 在平面名称空间中找不到预期的ImportError dlopen()符号 - Importerror dlopen () symbol not found expected in flat namespace 为什么我会收到此错误“ImportError: dlopen(...): Symbol not found”? 当我在 python 上导入我的库时 - Why do I get this error “ImportError: dlopen(…): Symbol not found”? when I import my library on python 如何解决ImportError: dlopen(): Symbol not found:.... Expected in: flat namespace - How to solve ImportError: dlopen(): Symbol not found:.... Expected in: flat namespace oserror dlopen 找不到合适的图像 python 3 - oserror dlopen no suitable image found python 3 导入错误:dlopen(/usr/local/opt/opencv3/lib/python2.7/site-packages/cv2.so, 2):找不到符号:_PyCObject_Type - ImportError: dlopen(/usr/local/opt/opencv3/lib/python2.7/site-packages/cv2.so, 2): Symbol not found: _PyCObject_Type mod_wsgi错误:ImportError:dlopen(/usr/local/lib/python3.6/site-packages/cv2.so,2):找不到符号:_iconv - mod_wsgi Error: ImportError: dlopen(/usr/local/lib/python3.6/site-packages/cv2.so, 2): Symbol not found: _iconv python picamera OSError:dlopen(libmmal.so,6):找不到图片 - python picamera OSError: dlopen(libmmal.so, 6): image not found 使用 python 来自 Rust 问题:dyld:惰性符号绑定失败:找不到符号:_Py_IsInitialized - Using python from Rust problem: dyld: lazy symbol binding failed: Symbol not found: _Py_IsInitialized
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM