opencv compiling errors when running python main.py ubuntu

501 views
Skip to first unread message

Antonio Lutfi

unread,
Dec 13, 2016, 11:32:01 PM12/13/16
to pupil-discuss
Hello,

I have just followed the instructions on https://github.com/pupil-labs/pupil/wiki/Dependencies-Installation-Linux for dependency installation under linux. I use opencv on my other projects and my current version is the latest one, 3.something.

When trying to run python main.py, there are several compilation errors on opencv modules. Could this be a conflict of versions? should I get an earliar released OpenCV? I really don't think thats the problem, it appears to be some toolchain shenannigans. Can anybody help me?

Thanks in advance

The log is as follows:

 MainProcess - [INFO] os_utils: Disabling idle sleep not supported on this OS version.
world - [INFO] world: Application Version: 0.8.7.3
world - [INFO] world: System Info: User: tonho, Platform: Linux, Machine: hal, Release: 4.4.0-53-generic, Version: #74-Ubuntu SMP Fri Dec 2 15:59:10 UTC 2016
Warning: Extension name 'detector_2d' does not match fully qualified name 'pupil_detectors.detector_2d' of 'detector_2d.pyx'
Warning: Extension name 'detector_3d' does not match fully qualified name 'pupil_detectors.detector_3d' of 'detector_3d.pyx'
running build_ext
building 'detector_2d' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include/eigen3 -I/usr/include/eigen3 -I../../shared_cpp/include -Isingleeyefitter/ -I/usr/include/python2.7 -c detector_2d.cpp -o build/temp.linux-x86_64-2.7/detector_2d.o -std=c++11 -w -O2
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from detector_2d.cpp:506:0:
/usr/local/include/opencv2/core/core_c.h:97:1: error: ‘IplImage’ does not name a type
 CVAPI(IplImage*)  cvCreateImageHeader( CvSize size, int depth, int channels );
 ^
/usr/local/include/opencv2/core/core_c.h:109:1: error: ‘IplImage’ does not name a type
 CVAPI(IplImage*) cvInitImageHeader( IplImage* image, CvSize size, int depth,
 ^
/usr/local/include/opencv2/core/core_c.h:125:1: error: ‘IplImage’ does not name a type
 CVAPI(IplImage*)  cvCreateImage( CvSize size, int depth, int channels );
 ^
In file included from /usr/local/include/opencv2/core/utility.hpp:1168:0,
                 from /usr/local/include/opencv2/core.hpp:3216,
                 from /usr/local/include/opencv2/core/types_c.h:101,
                 from detector_2d.cpp:506:
/usr/local/include/opencv2/core/core_c.h:140:36: error: variable or field ‘cvReleaseImageHeader’ declared void
 CVAPI(void)  cvReleaseImageHeader( IplImage** image );
                                    ^
/usr/local/include/opencv2/core/core_c.h:140:36: error: ‘IplImage’ was not declared in this scope
/usr/local/include/opencv2/core/core_c.h:140:47: error: ‘image’ was not declared in this scope
 CVAPI(void)  cvReleaseImageHeader( IplImage** image );
                                               ^
/usr/local/include/opencv2/core/core_c.h:154:30: error: variable or field ‘cvReleaseImage’ declared void
 CVAPI(void)  cvReleaseImage( IplImage** image );
                              ^
/usr/local/include/opencv2/core/core_c.h:154:30: error: ‘IplImage’ was not declared in this scope
/usr/local/include/opencv2/core/core_c.h:154:41: error: ‘image’ was not declared in this scope
 CVAPI(void)  cvReleaseImage( IplImage** image );
                                         ^
In file included from detector_2d.cpp:506:0:
/usr/local/include/opencv2/core/core_c.h:157:1: error: ‘IplImage’ does not name a type
 CVAPI(IplImage*) cvCloneImage( const IplImage* image );
 ^
In file included from /usr/local/include/opencv2/core/utility.hpp:1168:0,
                 from /usr/local/include/opencv2/core.hpp:3216,
                 from /usr/local/include/opencv2/core/types_c.h:101,
                 from detector_2d.cpp:506:
/usr/local/include/opencv2/core/core_c.h:169:29: error: variable or field ‘cvSetImageCOI’ declared void
 CVAPI(void)  cvSetImageCOI( IplImage* image, int coi );
                             ^
/usr/local/include/opencv2/core/core_c.h:169:29: error: ‘IplImage’ was not declared in this scope
/usr/local/include/opencv2/core/core_c.h:169:39: error: ‘image’ was not declared in this scope
 CVAPI(void)  cvSetImageCOI( IplImage* image, int coi );
                                       ^
/usr/local/include/opencv2/core/core_c.h:169:46: error: expected primary-expression before ‘int’
 CVAPI(void)  cvSetImageCOI( IplImage* image, int coi );
                                              ^
/usr/local/include/opencv2/core/core_c.h:177:34: error: ‘IplImage’ does not name a type
 CVAPI(int)  cvGetImageCOI( const IplImage* image );
                                  ^
/usr/local/include/opencv2/core/core_c.h:190:29: error: variable or field ‘cvSetImageROI’ declared void
 CVAPI(void)  cvSetImageROI( IplImage* image, CvRect rect );
                             ^
/usr/local/include/opencv2/core/core_c.h:190:29: error: ‘IplImage’ was not declared in this scope
/usr/local/include/opencv2/core/core_c.h:190:39: error: ‘image’ was not declared in this scope
 CVAPI(void)  cvSetImageROI( IplImage* image, CvRect rect );
                                       ^
/usr/local/include/opencv2/core/core_c.h:190:46: error: ‘CvRect’ was not declared in this scope
 CVAPI(void)  cvSetImageROI( IplImage* image, CvRect rect );
                                              ^
/usr/local/include/opencv2/core/core_c.h:201:31: error: variable or field ‘cvResetImageROI’ declared void
 CVAPI(void)  cvResetImageROI( IplImage* image );
                               ^
/usr/local/include/opencv2/core/core_c.h:201:31: error: ‘IplImage’ was not declared in this scope
/usr/local/include/opencv2/core/core_c.h:201:41: error: ‘image’ was not declared in this scope
 CVAPI(void)  cvResetImageROI( IplImage* image );
                                         ^
In file included from detector_2d.cpp:506:0:
/usr/local/include/opencv2/core/core_c.h:208:1: error: ‘CvRect’ does not name a type
 CVAPI(CvRect) cvGetImageROI( const IplImage* image );
 ^
In file included from /usr/local/include/opencv2/core/utility.hpp:1168:0,
                 from /usr/local/include/opencv2/core.hpp:3216,
                 from /usr/local/include/opencv2/core/types_c.h:101,
                 from detector_2d.cpp:506:
/usr/local/include/opencv2/core/core_c.h:298:32: error: variable or field ‘cvDecRefData’ declared void
 CV_INLINE  void  cvDecRefData( CvArr* arr )
                                ^
/usr/local/include/opencv2/core/core_c.h:298:32: error: ‘CvArr’ was not declared in this scope
/usr/local/include/opencv2/core/core_c.h:298:39: error: ‘arr’ was not declared in this scope
 CV_INLINE  void  cvDecRefData( CvArr* arr )
                                       ^
In file included from /usr/include/eigen3/Eigen/Core:318:0,
                 from /usr/include/eigen3/Eigen/Dense:1,
                 from /usr/include/eigen3/Eigen/Eigen:1,
                 from detector_2d.cpp:508:
/usr/include/eigen3/Eigen/src/Core/arch/SSE/Complex.h:101:30: error: expected ‘}’ before end of line
/usr/include/eigen3/Eigen/src/Core/arch/SSE/Complex.h:101:30: error: expected declaration before end of line
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Process world:
Traceback (most recent call last):
  File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "/home/tonho/ubuntail/Dropbox/pupil-source/pupil/pupil_src/capture/world.py", line 98, in world
    import pupil_detectors
  File "/home/tonho/ubuntail/Dropbox/pupil-source/pupil/pupil_src/capture/pupil_detectors/__init__.py", line 18, in <module>
    from detector_2d import Detector_2D
ImportError: No module named detector_2d

info

unread,
Dec 14, 2016, 2:26:03 AM12/14/16
to pupil-discuss
Hi Antonio, 

OpenCV3 is not compatible with the master branch of Pupil because the current master uses OpenCV2. OpenCV3 has different naming conventions for headers/libs, which leads to many of the errors you are seeing.

We have a opencv3 branch that should work with Python2.7 - see discussion here: https://github.com/pupil-labs/pupil/pull/490

There is also the python3_opencv3_merged branch: https://github.com/pupil-labs/pupil/tree/python3_opencv3_merged - if you are willing to use python3

You should be able to easily set up a virtual environment for Python3 and install packages in your VENV accordingly.  

Best, 
Will

Antonio Lutfi

unread,
Dec 14, 2016, 10:59:31 PM12/14/16
to pupil-...@googlegroups.com

Thanks, Will!

I have cloned the opencv3 branch and although I still have some problems, it sure made considerable progress.

Now I am stuck on an ImportError, I'll post the traceback below.

Thanks for all the help!


Traceback (most recent call last):
  File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "/home/tonho/ubuntail/Dropbox/pupil-source/pupil/pupil_src/capture/world.py", line 91, in world

    import pupil_detectors
  File "/home/tonho/ubuntail/Dropbox/pupil-source/pupil/pupil_src/capture/pupil_detectors/__init__.py", line 18, in <module>
    from detector_2d import Detector_2D
ImportError: /home/tonho/ubuntail/Dropbox/pupil-source/pupil/pupil_src/capture/pupil_detectors/detector_2d.so: undefined symbol: _ZN2cv7ellipseERKNS_17_InputOutputArrayERKNS_11RotatedRectERKNS_7Scalar_IdEEii

--
You received this message because you are subscribed to the Google Groups "pupil-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pupil-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to pupil-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pupil-discuss/81c83203-1cad-4e70-b118-a35213a87ea5%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Pupil Labs Info

unread,
Jan 4, 2017, 4:12:12 AM1/4/17
to pupil-...@googlegroups.com
hi,

this is a linker error. You will need to make sure that all dependencies where built correctly.

Best,
Moritz



For more options, visit https://groups.google.com/d/optout.



--
Pupil Labs
research + development + design

Reply all
Reply to author
Forward
0 new messages