简体   繁体   English

在Python中加载C共享库期间发生OSError(未定义符号:checkedCalloc)

[英]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.

相关问题 加载Python共享库时C ++中的未定义符号 - Undefined Symbol in C++ When Loading a Python Shared Library 在Python中加载共享库时未定义符号 - Undefined symbol when loading shared library in Python Python ctypes:加载库时OSError未定义符号 - Python ctypes : OSError undefined symbol when loading library 在dlopen打开另一个C库的Python中加载C库-未解析的共享符号 - Loading C library in Python that dlopens another C library - unresolved shared symbol 尝试在 python session 中导入用 c++ 编写的共享库时出现“未定义符号”错误 - getting `undefined symbol` errors when trying to import shared library written in c++ in python session 在Python ctypes中加载共享库期间出现分段错误(核心转储) - Segmentation fault (core dumped) during loading shared library in Python ctypes 为C库生成Python SWIG绑定时的未定义符号 - Undefined symbol when generating Python SWIG binding for C library Python/C++ 扩展,链接库时出现未定义符号错误 - Python/C++ Extension, Undefined symbol error when linking a library 从Python加载动态共享C ++库时出现问题 - Problem in loading dynamic shared c++ library from Python 未定义的符号:PyOS_InputHook,来自共享库 - undefined symbol: PyOS_InputHook, from shared library
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM