robidouille / robidouille

http://www.robidouille.com
BSD 2-Clause "Simplified" License
71 stars 58 forks source link

Error while compile #7

Open gplreis opened 9 years ago

gplreis commented 9 years ago

Hi, I follow the little tutorial to execute the example, but when i send make command in raspicam_cv i got the msg: gcc objs/RaspiCamTest.o libraspicamcv.a -lopencv_highgui -lopencv_core -lopencv_legacy -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_imgproc -L/home/pi/git/raspberrypi/userland/build/lib -lmmal_core -lmmal -l mmal_util -lvcos -lbcm_host -lX11 -lXext -lrt -lstdc++ -L. -lraspicamcv -lpthread -o raspicamtest /usr/bin/ld: objs/RaspiCamTest.o: undefined reference to symbol 'lrint@@GLIBC_2.4' //lib/arm-linux-gnueabihf/libm.so.6: error adding symbols: DSO missing from command line collect2: ld returned 1 exit status

Someone can help me with it?

gplreis commented 9 years ago

I try using -lpthread and -lm on LFLAGS2 but now got the msg: gcc objs/RaspiCamTest.o libraspicamcv.a -lopencv_highgui -lopencv_core -lopencv_legacy -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_imgproc -L/home/pi/git/raspberrypi/userland/build/lib -lmmal_core -lmmal -l mmal_util -lvcos -lbcm_host -lX11 -lXext -lrt -lstdc++ -lpthread -lm -L. -lraspicamcv -o raspicamtest //usr/local/lib/libopencv_ml.so.2.4: undefined reference to cv::parallel_for_(cv::Range const&, cv::ParallelLoopBody const&, double)' //usr/local/lib/libopencv_ml.so.2.4: undefined reference totypeinfo for cv::ParallelLoopBody' //usr/local/lib/libopencv_ml.so.2.4: undefined reference to cv::Mutex::unlock()' //usr/local/lib/libopencv_ml.so.2.4: undefined reference tocv::Mutex::lock()' //usr/local/lib/libopencv_ml.so.2.4: undefined reference to cv::Mutex::Mutex()' //usr/local/lib/libopencv_ml.so.2.4: undefined reference tocv::ParallelLoopBody::~ParallelLoopBody()' //usr/local/lib/libopencv_ml.so.2.4: undefined reference to `cv::Mutex::~Mutex()' collect2: ld returned 1 exit status Makefile:54: recipe for target 'raspicamtest' failed make: *\ [raspicamtest] Error 1

keownrwk commented 9 years ago

I added -pthread and -lm to LDFLAGS_PI in Makefile and successfully compiled.

AGS-Knight commented 9 years ago

I replaced LDFLAGS2_OPENCV in Makefile with the pkg-config line and it compiled fine.

#LDFLAGS2_OPENCV = -lopencv_highgui -lopencv_core -lopencv_legacy -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_imgproc 
 LDFLAGS2_OPENCV = `pkg-config --static --cflags --libs opencv`
mojjj commented 9 years ago

same problem as @gplreis second post ( ... /lib/libopencv_ml.so.2.4: undefined reference tocv::Mutex::lock()' ...)

reason: opencv libs were not found, because i compiled 2.4.10 and installed into /usr/local/lib

the solution from @AGS-Knight found the libs and the compiling succeeded. (replacing in CMAKELIST.txt to DFLAGS2_OPENCV = pkg-config --static --cflags --libs opencv) thank you!