How can I build a Python module using Accelerate.h in MacOS?

Viewed 40

I used to have a self-made Python module built with C++ compiled and installed through a setup.py script. It used to work just fine, but after updating to Python 3.8 (from 3.7), I needed to reinstall it.

To do so, I thought I'd just need to rebuild through the same setup.py file and that it would be working again.

Although it compiles correctly, when importing the module within Python, I get the following error message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/usr/local/lib/python3.8/site-packages/cvmodule.cpython-38-darwin.so, 2): Symbol not found: _dgesv_
  Referenced from: /usr/local/lib/python3.8/site-packages/cvmodule.cpython-38-darwin.so
  Expected in: flat namespace
 in /usr/local/lib/python3.8/site-packages/cvmodule.cpython-38-darwin.so

The problem seems to be with Apple's own LAPACK in Accelerate.h. My module uses the dgesv_ function of this library.

In case anyone wonders, my module does not include any library or header file not included in the system apart from Python.h. The Extension within my setup.py looks just like:

cvmodule_module = Extension(
    name='cvmodule',
    sources=['cvmodule.cpp']
)

Any ideas?

0 Answers
Related