Python wrappers crash on macosx (Bug #1345)
Description
import cv causes a silent segfault. gdb traces (below) point to numpy problem. My python version is 2.6, numpy version is 1.2.1.
gdb snapshot:
#0 0x0000000000000000 in ?? ()
#1 0x000000010050032c in _import_array () at +multiarray_api.h:1232
#2 0x00000001005003f5 in initcv () at /Users/relrotciv/opencv/2.3.0/opencv/modules/python/src1/cv.cpp:4009
#3 0x000000010009bd3b in _PyImport_LoadDynamicModule ()
...
(gdb) frame 2
#2 0x00000001005003f5 in initcv () at /Users/relrotciv/opencv/2.3.0/opencv/modules/python/src1/cv.cpp:4009
4009 import_array();
Current language: auto; currently c++
(gdb) list
4004 #endif
4005
4006 void initcv()
4007 {
4008 #if PYTHON_USE_NUMPY
4009 import_array();
4010 #endif
4011
4012 PyObject *m, *d;
4013
(gdb) frame 1
#1 0x000000010050032c in _import_array () at +multiarray_api.h:1232
1232 if (NPY_FEATURE_VERSION > PyArray_GetNDArrayCFeatureVersion()) {
(gdb) list
1227 PyErr_Format(PyExc_RuntimeError, "module compiled against "\
1228 "ABI version %x but this version of numpy is %x", \
1229 (int) NPY_VERSION, (int) PyArray_GetNDArrayCVersion());
1230 return -1;
1231 }
1232 if (NPY_FEATURE_VERSION > PyArray_GetNDArrayCFeatureVersion()) {
1233 PyErr_Format(PyExc_RuntimeError, "module compiled against "\
1234 "API version %x but this version of numpy is %x", \
1235 (int) NPY_FEATURE_VERSION, (int) PyArray_GetNDArrayCFeatureVersion());
1236 return -1;
Associated revisions
Merge pull request #1345 from pengx17:2.4_tvl1ocl_opt
History
Updated by Victor Eruhimov over 13 years ago
This appeared to me a cmake problem. find_package() finds a wrong python installation (in my case, in /opt/local/..., installed by macports), different from what is executed from console command line. This results in a different set of headers from numpy used during opencv build. The path to numpy headers is logged to console by the cmake script, so one can check whether the correct path is used. I have deactivate the macports python installation, rebuilt opencv and python bindings started working.
Thanks to Vadim for solving this issue!
However I leave this bug as open in case one finds a way around cmake find_package.
Updated by Vadim Pisarevsky about 13 years ago
As we cleaning up the base of open errors, I close the bug.
- Status changed from Open to Done
- (deleted custom field) set to obsolete
Updated by Andrey Kamaev about 13 years ago
- Status changed from Done to Cancelled
Updated by Andrey Kamaev almost 13 years ago
- Target version set to 2.4.0