1

All,

I'm working on a new C++ project for an embedded system. Part of the system is some legacy Python code that we'll need to interface too. I've already prototyped a C++ to Python interface using the various PyImport_ImportModule functions etc. provided by Python, and tested this on my host system (Ubuntu 64 bit 17.04).

However, the build system in the new project also tries to build all dependencies, so it builds Python 2.7.13 from source. The problem I am seeing is the interface code that used to work with the host system Python is not working with the newly built from source Python. The error I am seeing is "time.so: undefined symbol: PyExc_ValueError", and the .py file I'm trying to call from C++ does import time as one of the first few lines. I checked and time.so is present in the custom built Python and I did update LD_LIBRARY_PATH to include it, but this didn't help. At the end of the build for Python I do see these warnings, so perhaps one of them is relevant?

Python build finished, but the necessary bits to build these modules were not found:
_bsddb             _sqlite3           _ssl            
_tkinter           bsddb185           bz2             
dbm                dl                 gdbm           
imageop            readline           sunaudiodev     
zlib                                                  

Can anyone suggest what to try next? We are not enabling any special options or using any non standard flags in the Python we're building from source (perhaps some extra settings are required)?

SeanLabs
  • 1,739
  • 4
  • 18
  • 22

1 Answers1

1

This is usually happening to either:

  • clean build required or
  • wrong libpython lib being linked. I would suggest to start with trying clean build and then double check your linking flags (make sure you build for Python-2.7 and link to Python-2.7 and not to say Python-3.* etc).

Also, please see this discussion, it looks like a very similar issue: https://www.panda3d.org/forums/viewtopic.php?t=13222

Edit: this also might be relevant: undefined symbol: PyExc_ImportError when embedding Python in C

Yatima
  • 119
  • 7