简体   繁体   English

使用Cython将metis链接到包装的C ++模块

[英]Linking metis to wrapped C++ module using Cython

I am trying to link the metis library during the compiling of the Cython source file but I am having difficulties as I am getting undefined symbols in the compiled shared object file. 我正在尝试在Cython源文件的编译过程中链接metis库,但是由于在已编译的共享库文件中得到未定义的符号,我遇到了困难。

I was wondering if anyone had any experience with linking external libraries such as metis using distutils? 我想知道是否有人在使用distutils链接外部数据库(例如metis)方面有任何经验? Would a better option be using makefile? 使用makefile会是更好的选择吗?

What I have done: 我做了什么:

Adding the directory to libmetis.a in extra_link_args 在extra_link_args中将目录添加到libmetis.a

我找到了解决此问题的方法,而不是使用distutils,而是使用makefile进行编译,这使链接更加容易。

Probably you need 可能你需要

python setup.py build_clib

before 之前

python setup.py build_ext --inplace

If this doesn't help, is the undefined symbol _Py_ZeroStruct ? 如果这没有帮助,未定义符号_Py_ZeroStruct吗? That would be because you did python setup.py build_ext and used from python 3. For that, you'll need python3 command. 那是因为您做了python setup.py build_ext并从python 3使用。为此,您将需要python3命令。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM