Svalorzen / AI-Toolbox

A C++ framework for MDPs and POMDPs with Python bindings

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to import POMDP in python

omangin opened this issue · comments

Importing POMDP in python raises the following error:

import POMDP
>>> ImportError: ./POMDP.so: undefined symbol: _ZNK9AIToolbox5POMDP18IncrementalPruning10getEpsilonEv

The error does not occur on import MDP, if I try again the import POMDP, python segfaults. The import was working on dcbe953.

(Compiled from 722826b, with python 1.7.12, boost 1.62.0 and eigen 3.2.95.)

It seems I forgot to link the Python libraries against the .cpp implementations. I'll fix this ASAP and add a couple of easy tests just to check that everything is working. I only had MDP tests so I unfortunately missed this. Thanks for the report!

I seem to have fixed this, however fixing it revealed a worse problem: CMake does not seem to be able to discriminate between static and shared libraries.

This is a problem since lpsolve can be found in both static and shared forms. I can't seem to be able to make linking work with the static version since the Python library is shared.

This means that we'd need to automatically understand whether CMake could find a shared version, and depending if Python was requested or not stop the configuring process. I'm looking around but there does not seem to be a portable way to do this, so I'm still trying to understand what the best way of doing this is.

I've resolved this by simply emitting a warning if lpsolve libraries may be static, since we may not be able to link Python in this way (the default static Ubuntu ones in liblpsolve55-dev are not compiled with -fpic). However, we cannot know for certain since the user may have compiled his/her own, and there is no real cross platform way to be sure.

So we just emit the CMake warning and hope for the best.

Let me know if it works again!

It seems that the problem is solved now! Thanks a lot.