OpenCV Python Binding Problem

Ubuntu version: 18.04.2
Python version: 3.6
g++ version: 7.3.0
clang version: 6.0.0
swig version: 3.0.12
OpenCV version: 4.0.0

[C++ code]
class Image { private: cv::Mat mat; public: Image() {} };

The following errors occur when importing my module after binding the above code.

[Compiled by g++ with Pybind11]
Segmentation fault (core dumped)

[Compiled by g++ with SWIG]
Traceback (most recent call last):
File “/home/wanhochoi/”, line 14, in swig_import_helper
return importlib.import_module(mname)
File “/usr/lib/python3.6/importlib/”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File ““, line 994, in _gcd_import
File ““, line 971, in _find_and_load
File ““, line 955, in _find_and_load_unlocked
File ““, line 658, in _load_unlocked
File ““, line 571, in module_from_spec
File ““, line 922, in create_module
File ““, line 219, in _call_with_frames_removed
ImportError: /home/wanhochoi/ undefined symbol: _ZN2cv8fastFreeEPv

[Compiled by clang++ with Pybind11]
ImportError: /home/wanhochoi/ undefined symbol: _ZTVN10__cxxabiv120__si_class_type_infoE

[Compiled by clang++ with SWIG]
No Error!

Leave a Reply