[英]OSError during loading of C shared library in Python (undefined symbol:checkedCalloc)
I would like to ask for some help about following problem. 我想寻求有关以下问题的帮助。
Some theory: I am using Ubuntu 12.04, python2.7 and I am trying to load C shared library (libFSToolbox.so) in python. 一些理论:我正在使用Ubuntu 12.04,python2.7,并且试图在python中加载C共享库(libFSToolbox.so)。 I want to use PyFeat that is python wrapper for FEAST. 我想使用PyFeat作为python包装器进行FEAST。 I have compiled FEAST and FEAST prerequisite MIToolbox. 我已经编译了FEAST和FEAST必备MIToolbox。 The problematic libFSToolbox.so is results of compilation of FEAST 有问题的libFSToolbox.so是FEAST编译的结果
...and reality: Building and everything went quite fine, but when I am trying to to use feast there is problem during import ...与现实:建筑和一切都进行得很好,但是当我尝试使用盛宴时,在导入期间会出现问题
File "test.py", line 2, in <module>
from feast import *
File "/usr/local/lib/python2.7/dist-packages/feast.py", line 25, in <module>
libFSToolbox = c.CDLL("/home/peterd/VUT/ML/FEAST-master/libFSToolbox.so");
File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /home/peterd/VUT/ML/FEAST-master/libFSToolbox.so: undefined symbol:
checkedCalloc
I have compiled c libraries as x64 ($(MAKE) libFSToolbox.so "CXXFLAGS = -O3 -fPIC -m64") and my python interpreter is also 64 (tried : python>> platform.machine() answer:'x86_64') 我已经将c库编译为x64($(MAKE)libFSToolbox.so“ CXXFLAGS = -O3 -fPIC -m64”),我的python解释器也是64(尝试过:python >> platform.machine()答案:'x86_64')
Thank you for your time 感谢您的时间
I think the problem is how the options to the linker are given in the Makefile for FEAST. 我认为问题是如何在Makefile for FEAST中提供链接器的选项。
Two options are 两种选择是
1) Change the line in Makefile for FEAST 1)将Makefile中的行更改为FEAST
from LINKER = gcc 来自LINKER = gcc
to 至
LINKER = ld 链接器= ld
2) if you want to use gcc to link change the line 47 of the Makefile 2)如果要使用gcc进行链接,请更改Makefile的第47行
from 从
$(LINKER) -lMIToolbox -lm -L$(MITOOLBOXPATH) -shared -o libFSToolbox.so $(objects) $(链接器)-lMIToolbox -lm -L $(MITOOLBOXPATH)-共享-o libFSToolbox.so $(对象)
to 至
$(LINKER) -L$(MITOOLBOXPATH) -shared -o libFSToolbox.so $(objects) -lMIToolbox -lm $(链接器)-L $(MITOOLBOXPATH)-共享-o libFSToolbox.so $(对象)-lMIToolbox -lm
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.