First time here? Check out the FAQ!

Ask Your Question
0

Static building undefined reference in Linux

asked Feb 23 '13

lokoArt gravatar image

updated Feb 23 '13

Hello. I built Opencv in Windows/Mac os as static library. It was easy. But in Linux I can't do it! How I build library: 1) Run graphic CMake and uncheck all modules except Core/ImgProc/Gighgui. Also Unchecked shared_library. 2) Do make and make install

In my .pro file in Qt creator there're lines like this there:

LIBS += -L/usr/local/lib/ \
 -lopencv_core \
 -lopencv_imgproc  \
 -lopencv_highgui \
 -llibjpeg \
 -lpng

And as I see it's being used at compliling:

g++ ... -L/usr/local/lib/ -lopencv_core -lopencv_imgproc -lopencv_highgui -llibjpeg -lpng ...

But i got errors like this:

 imgwarp.cpp:-1: error: undefined reference to `cv::ParallelLoopBody::~ParallelLoopBody()' color.cpp:-1: error: undefined reference to `cv::parallel_for_(cv::Range const&, cv::ParallelLoopBody const&, double)'

There're errors inside Img proc library. What's wrong?

UPD: I checked building as shared library and everything's ok. There's problem only with static build

Preview: (hide)

1 answer

Sort by » oldest newest most voted
1

answered Feb 23 '13

ParallelLoopBody class is a part of core module in OpenCV. On Linux library order in linking time is important, because one-pass linker is used. You need to reorder OpenCV libs and try again.

Preview: (hide)

Comments

Oh... Thank you... I didn't know. I'm new in Linux developing and in Linux at all)

lokoArt gravatar imagelokoArt (Feb 24 '13)edit

It's necesary to reorder OpenCV libs, but what is the correct order to successfully compile using it as static libs? ... libs/opencv/lib/libopencv_imgproc.a(color.cpp.o): In function cv::CvtColorLoop_Invoker<cv::RGB2RGB<unsigned char> >::~CvtColorLoop_Invoker()': color.cpp:(.text._ZN2cv20CvtColorLoop_InvokerINS_7RGB2RGBIhEEED2Ev[_ZN2cv20CvtColorLoop_InvokerINS_7RGB2RGBIhEEED5Ev]+0xf): undefined reference tocv::ParallelLoopBody::~ParallelLoopBody()' ...

I appreciate your help

osval gravatar imageosval (Jan 24 '15)edit

Question Tools

Stats

Asked: Feb 23 '13

Seen: 2,474 times

Last updated: Feb 23 '13