Ask Your Question
0

opengl_interop.o build error

asked 2017-03-10 15:14:52 -0600

xarpus gravatar image

I recently started to use OpenCV on Qt Creator 4.2.1. Now I am trying to run opengl_interop.cpp from samples/opengl but I am getting this error: opengl_interop.o: undefined reference to symbol '_ZN2cv3ogl13unmapGLBufferERNS_4UMatE'.

OS is Ubuntu 16.10.

ProjectTest.pro looks like this:

TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt

SOURCES += \
    ../../../../../../Downloads/opencv/opencv/samples/opengl/opengl_interop.cpp

INCLUDEPATH += "/usr/local/include"
LIBS += -L"/usr/lib/x86_64-linux-gnu/" -L"/usr/local/lib"
QMAKE_RPATHDIR += "/opt/Qt/5.8/gcc_64/lib"

LIBS += `pkg-config --libs opencv` -lGLU -lGL -lglut -lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core


HEADERS += \
    ../../../../../../Downloads/opencv/opencv/samples/opengl/winapp.hpp

Compile output log

20:33:29: Running steps for project ProjectTest...
20:33:29: Configuration unchanged, skipping qmake step.
20:33:29: Starting: "/usr/bin/make" 

/opt/Qt/5.8/gcc_64/bin/qmake -o Makefile ../ProjectTest/ProjectTest.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug

g++ -Wl,-rpath,/opt/Qt/5.8/gcc_64/lib -o ProjectTest opengl_interop.o   -L/usr/lib/x86_64-linux-gnu/ -L/usr/local/lib `pkg-config --libs opencv` -lGLU -lGL -lglut -lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core 
/usr/bin/ld: warning: libopencv_imgproc.so.3.2, needed by /usr/local/lib/libopencv_videoio.so, may conflict with libopencv_imgproc.so.2.4

/usr/bin/ld: warning: libopencv_core.so.3.2, needed by /usr/local/lib/libopencv_videoio.so, may conflict with libopencv_core.so.2.4

Makefile:227: recipe for target 'ProjectTest' failed

//usr/bin/ld: opengl_interop.o: undefined reference to symbol '_ZN2cv3ogl13unmapGLBufferERNS_4UMatE'
//usr/local/lib/libopencv_core.so.3.2: error adding symbols: DSO missing from command line

collect2: error: ld returned 1 exit status

make: *** [ProjectTest] Error 1

20:33:30: The process "/usr/bin/make" exited with code 2.

Error while building/deploying project ProjectTest (kit: Desktop Qt 5.8.0 GCC 64bit)

When executing step "Make"
20:33:30: Elapsed time: 00:01.
edit retag flag offensive close merge delete

Comments

please try to remove old opencv2.4 libs

berak gravatar imageberak ( 2017-03-11 00:41:38 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-03-13 06:38:54 -0600

xarpus gravatar image

I realized what the problem was. I installed qt4-dev-tools (instead of qt5-dev-tools) that are in collision with current Qt version. As the @berak suggested , I deleted OpenCV with :

sudo find / -name "opencv" -exec rm -i {} \;

Then installed qt5 dev tools: sudo apt-get install qt5-dev-tools

I also should've add this line in .pro file :

LIBS += -lX11 -ldl -lXext -lz

and rebuild OpenCV (WITH_OPENGL in CMake-gui wasn't checked).

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-03-10 15:14:52 -0600

Seen: 370 times

Last updated: Mar 13 '17