hexhex / core

DLVHEX solver: core system and plugin API
http://www.kr.tuwien.ac.at/research/systems/dlvhex/
GNU Lesser General Public License v2.1
24 stars 8 forks source link

Python plugin interface for OS X - Linker problem #13

Closed credl closed 9 years ago

credl commented 10 years ago

The evaluation of a Python plugin under OS X sometimes yields the error: "Fatal Python error: PyThreadState_Get: no current thread". It seems that the error occurs only if the plugin uses a builtin package (such as math or datetime) and that the Python code before the import of the package is executed normally.

The problem can be resolved by removing the option "-lpython2.7" from the final linker call which builds the dlvhex2 binary (but I don't know why this solves the problem); the python library has already been linked to libdlvhex2-internalplugins. However, the linker needs to be called manually with the option being removed since I did not manage to prevent the autotools from adding the library also to the final linker call.

Unter Linux everything works well both with Python 2.7 and 3.4. Unter Windows I tested only with Python 3.4 and everything works as well.

credl commented 9 years ago

The problem was due to mixing up different Python version (OS X native, MacPorts). Make sure that the .a file used for linking correspond to the dylib libraries in the search path.