PiRSquared17 / pyopencv

Automatically exported from code.google.com/p/pyopencv
0 stars 1 forks source link

redefinition errors #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.sudo /opt/local/bin/python2.6 setup.py install

What is the expected output? What do you see instead?
Instead of compiling I get all kinds of redefinition errors

GNU C++ (GCC) version 4.4.4 (i386-apple-darwin10)
        compiled by GNU C version 4.4.4, GMP version 5.0.1, MPFR version 3.0.0-p3.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: ff8da831b3da44f67c54b87ca93b4280
In file included from pyopencv/pyopencvext/opencv_converters.hpp:17,
                 from pyopencv/pyopencvext/__dummy_struct.pypp.cpp:6:
pyopencv/pyopencvext/opencv_extra.hpp:21:1: warning: "BOOST_PYTHON_MAX_ARITY" 
redefined
In file included from /tmp/boost_1_43_0/boost/python/args.hpp:12,
                 from /tmp/boost_1_43_0/boost/python.hpp:11,
                 from pyopencv/pyopencvext/__dummy_struct.pypp.cpp:3:
/tmp/boost_1_43_0/boost/python/detail/preprocessor.hpp:29:1: warning: this is 
the location of the previous definition
In file included from pyopencv/pyopencvext/core/opencv_headers.hpp:7,
                 from pyopencv/pyopencvext/__dummy_struct.pypp.cpp:5:
pyopencv/pyopencvext/sdopencv/sdcxmat.hpp:58: error: redefinition of 
'cv::Mat::Mat()'
/opt/local/include/opencv/cxmat.hpp:57: error: 'cv::Mat::Mat()' previously 
defined here
pyopencv/pyopencvext/sdopencv/sdcxmat.hpp:61: error: redefinition of 
'cv::Mat::Mat(int, int, int)'
/opt/local/include/opencv/cxmat.hpp:60: error: 'cv::Mat::Mat(int, int, int)' 
previously defined here
pyopencv/pyopencvext/sdopencv/sdcxmat.hpp:68: error: redefinition of 
'cv::Mat::Mat(int, int, int, const cv::Scalar&)'
/opt/local/include/opencv/cxmat.hpp:67: error: 'cv::Mat::Mat(int, int, int, 
const cv::Scalar&)' previously defined here
pyopencv/pyopencvext/sdopencv/sdcxmat.hpp:79: error: redefinition of 
'cv::Mat::Mat(cv::Size, int)'
/opt/local/include/opencv/cxmat.hpp:78: error: 'cv::Mat::Mat(cv::Size, int)' 
previously defined here
pyopencv/pyopencvext/sdopencv/sdcxmat.hpp:87: error: redefinition of 
'cv::Mat::Mat(cv::Size, int, const cv::Scalar&)'
/opt/local/include/opencv/cxmat.hpp:86: error: 'cv::Mat::Mat(cv::Size, int, 
const cv::Scalar&)' previously defined here
pyopencv/pyopencvext/sdopencv/sdcxmat.hpp:98: error: redefinition of 
'cv::Mat::Mat(const cv::Mat&)'
/opt/local/include/opencv/cxmat.hpp:97: error: 'cv::Mat::Mat(const cv::Mat&)' 
previously defined here
pyopencv/pyopencvext/sdopencv/sdcxmat.hpp:106: error: redefinition of 
'cv::Mat::Mat(int, int, int, void*, size_t)'
/opt/local/include/opencv/cxmat.hpp:105: error: 'cv::Mat::Mat(int, int, int, 
void*, size_t)' previously defined here

What version of the product are you using? On what operating system?
Apple OS X, Snow Leopard 10.6, gcc 4.4

Please provide any additional information below.
Some kind of conflict between the opencv header files and redefinitions in 
pyopencv/pyopencvext/sdopencv files.

A commentor at this link seems to have a very similiar problem.

http://translate.google.com/translate?hl=en&sl=fr&u=http://samuel.goutenoir.com/
%3Fp%3D41&ei=Z0xgTLCOKYL-8AbO0Y25DQ&sa=X&oi=translate&ct=result&resnum=1&ved=0CB
UQ7gEwAA&prev=/search%3Fq%3Dpyopencv%2Bredefinition%26hl%3Den%26sa%3DG

Original issue reported on code.google.com by aaron.ba...@gmail.com on 9 Aug 2010 at 6:44

GoogleCodeExporter commented 9 years ago
Which version of OpenCV are you using? PyOpenCV is not compatible with the 
current version in WG's svn repository. It is only compatible with OpenCV 2.1 
released in April.

Cheers,
Minh-Tri

Original comment by pmtri80@gmail.com on 9 Aug 2010 at 7:25

GoogleCodeExporter commented 9 years ago
Thanks for your response. I am using the opencv installation from macports 
which is 2.0.0. I will soon try the 2.1 april release and report back.

Original comment by aaron.ba...@gmail.com on 9 Aug 2010 at 8:38

GoogleCodeExporter commented 9 years ago
Alright everything compiles just fine now, using opencv 2.1. However I am 
getting a seg fault when importing pyopencv, similar to the other issue on this 
board trying to us pyopencv on mac. Here is a stack trace, any thoughts?

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   ???                             0000000000 0 + 0
1   pyopencvext.so                  0x02032f43 
__static_initialization_and_destruction_0(int, int) + 131 (ndarray.cpp:791)
2   dyld                            0x8fe0ed6d 
ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 235
3   dyld                            0x8fe0d31e 
ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned 
int) + 246
4   dyld                            0x8fe0d3d1 
ImageLoader::runInitializers(ImageLoader::LinkContext const&) + 61
5   dyld                            0x8fe0200b 
dyld::runInitializers(ImageLoader*) + 34
6   dyld                            0x8fe0b299 dlopen + 558
7   libSystem.B.dylib               0x94957068 dlopen + 66
8   org.python.python               0x000adca8 _PyImport_GetDynLoadFunc + 462
9   org.python.python               0x0009d9d3 _PyImport_LoadDynamicModule + 118
10  org.python.python               0x00099402 PyImport_GetImporter + 535
11  org.python.python               0x0008b372 PyEval_EvalFrameEx + 16375
12  org.python.python               0x0008b4d5 PyEval_EvalFrameEx + 16730
13  org.python.python               0x0008cf64 PyEval_EvalCodeEx + 1720
14  org.python.python               0x0008d009 PyEval_EvalCode + 87
15  org.python.python               0x0009a532 PyImport_ExecCodeModuleEx + 240
16  org.python.python               0x000c6582 initzipimport + 6643
17  org.python.python               0x0000c700 PyObject_Call + 101
18  org.python.python               0x0000cc8f PyObject_CallMethodObjArgs + 257
19  org.python.python               0x0000effa PyObject_CallMethod + 203
20  org.python.python               0x0009c1b8 _PyImport_FindModule + 1120
21  org.python.python               0x0009c87f PyImport_ReloadModule + 1392
22  org.python.python               0x0009ccd7 PyImport_ReloadModule + 2504
23  org.python.python               0x0009d285 PyImport_ImportModuleLevel + 1167
24  org.python.python               0x0008577f _PyBuiltin_Init + 14665
25  org.python.python               0x0000c700 PyObject_Call + 101
26  org.python.python               0x0008677a PyEval_CallObjectWithKeywords + 
171
27  org.python.python               0x0008a748 PyEval_EvalFrameEx + 13261
28  org.python.python               0x0008cf64 PyEval_EvalCodeEx + 1720
29  org.python.python               0x0008d009 PyEval_EvalCode + 87
30  org.python.python               0x0009a532 PyImport_ExecCodeModuleEx + 240
31  org.python.python               0x000c6582 initzipimport + 6643
32  org.python.python               0x0000c700 PyObject_Call + 101
33  org.python.python               0x0000cc8f PyObject_CallMethodObjArgs + 257
34  org.python.python               0x0000effa PyObject_CallMethod + 203
35  org.python.python               0x0009c1b8 _PyImport_FindModule + 1120
36  org.python.python               0x0009c87f PyImport_ReloadModule + 1392
37  org.python.python               0x0009ccd7 PyImport_ReloadModule + 2504
38  org.python.python               0x0009d285 PyImport_ImportModuleLevel + 1167
39  org.python.python               0x0008577f _PyBuiltin_Init + 14665
40  org.python.python               0x0000c700 PyObject_Call + 101
41  org.python.python               0x0008677a PyEval_CallObjectWithKeywords + 
171
42  org.python.python               0x0008a748 PyEval_EvalFrameEx + 13261
43  org.python.python               0x0008cf64 PyEval_EvalCodeEx + 1720
44  org.python.python               0x0008d009 PyEval_EvalCode + 87
45  org.python.python               0x0009a532 PyImport_ExecCodeModuleEx + 240
46  org.python.python               0x000c6582 initzipimport + 6643
47  org.python.python               0x0000c700 PyObject_Call + 101
48  org.python.python               0x0000cc8f PyObject_CallMethodObjArgs + 257
49  org.python.python               0x0000effa PyObject_CallMethod + 203
50  org.python.python               0x0009c1b8 _PyImport_FindModule + 1120
51  org.python.python               0x0009c87f PyImport_ReloadModule + 1392
52  org.python.python               0x0009ccd7 PyImport_ReloadModule + 2504
53  org.python.python               0x0009d285 PyImport_ImportModuleLevel + 1167
54  org.python.python               0x0008577f _PyBuiltin_Init + 14665
55  org.python.python               0x0000c700 PyObject_Call + 101
56  org.python.python               0x0008677a PyEval_CallObjectWithKeywords + 
171
57  org.python.python               0x0008a748 PyEval_EvalFrameEx + 13261
58  org.python.python               0x0008cf64 PyEval_EvalCodeEx + 1720
59  org.python.python               0x0008d009 PyEval_EvalCode + 87
60  org.python.python               0x000a40bb Py_CompileString + 111
61  org.python.python               0x000a6140 PyRun_InteractiveOneFlags + 483
62  org.python.python               0x000a628e PyRun_InteractiveLoopFlags + 216
63  org.python.python               0x000a6317 PyRun_AnyFileExFlags + 85
64  org.python.python               0x000b3168 Py_Main + 3074
65  org.python.python.app           0x00001eb5 start + 53

Original comment by aaron.ba...@gmail.com on 11 Aug 2010 at 5:00

GoogleCodeExporter commented 9 years ago
Now it's getting complicated because I don't have a Mac OS platform to test 
with. By the way, have you checked out this page:

http://code.google.com/p/pyopencv/wiki/Installation_OpenCV

to see if your OpenCV library is usable by PyOpenCV?

Cheers,
Minh-Tri

Original comment by pmtri80@gmail.com on 11 Aug 2010 at 8:13

GoogleCodeExporter commented 9 years ago
I used gdb to track down the line of code where the segfault occurs. 

pyopencv-2.1.0.wr1.1.0/pyopencv/pyopencvext/numpy_include/__multiarray_api.h
line: 1004

st = PyArray_GetEndianness();

which seems to be a numpy function. As far as I can tell numpy is installed 
correctly, I can do an import numpy inside of python. 

What do you think? Any chance you could write a sample program that uses 
PyArray_GetEndianness(), I am unsure how to build and and link against numpy. 

It would be cool to get pyopencv working on the mac platform.

Original comment by aaron.ba...@gmail.com on 12 Aug 2010 at 2:51

GoogleCodeExporter commented 9 years ago
Alright, I simply removed the offending line 
st = PyArray_GetEndianness();

and replaced it with 

  st = NPY_CPU_LITTLE;

for my intel macbook. I am now able to run this demo code just fine.

from pyopencv import *

img = imread('people.jpg')
hog = HOGDescriptor()
hog.setSVMDetector(HOGDescriptor.getDefaultPeopleDetector())
for r in hog.detectMultiScale(img, 0, Size(8,8), Size(24,16), 1.05, 2):
    r.x += round(r.width*0.1)
    r.y += round(r.height*0.1)
    r.width = round(r.width*0.8)
    r.height = round(r.height*0.8)
    rectangle(img, r.tl(), r.br(), Scalar(0,255,0), 1)

namedWindow("people detector", 1)
imshow("people detector", img)
waitKey(0)

Original comment by aaron.ba...@gmail.com on 12 Aug 2010 at 5:39

GoogleCodeExporter commented 9 years ago

Original comment by pmtri80@gmail.com on 13 Aug 2010 at 12:11

GoogleCodeExporter commented 9 years ago
I'd like to close this issue. Please don't hesitate to open a new issue if the 
problem persists.

Cheers,
Minh-Tri

Original comment by pmtri80@gmail.com on 27 Aug 2010 at 7:22