9 Replies Latest reply on May 9, 2015 5:03 PM by EthanHunt

    Getting compilation error while trying to make yocto project with added image of opencv

    EthanHunt

      Hello Everyone,

       

      I am trying to make yocto project which will support opencv libraries as I want to do image processing on Edison. But during compilation(followed edison_bsp_ug.pdf file) I am getting 1 error like below, so if someone know how to resolve that, please help me. I am trying to compile that yocto project on VMWare > Ubuntu 12.04. Thanks.

       

      Error log:

       

      | i686-linux-libtool: link: `primesieve.lo' is not a valid libtool object

      | make[2]: *** [libgmp.la] Error 1

      | make[2]: Leaving directory `/home/dhruv/Devlopement/Edison/edison-src/build/tmp/work/i686-linux/gmp-native/5.1.1-r0/build'

      | make[1]: *** [all-recursive] Error 1

      | make[1]: Leaving directory `/home/dhruv/Devlopement/Edison/edison-src/build/tmp/work/i686-linux/gmp-native/5.1.1-r0/build'

      | make: *** [all] Error 2

      | ERROR: oe_runmake failed

      | WARNING: exit code 1 from a shell command.

      | ERROR: Function failed: do_compile (log file is located at /home/dhruv/Devlopement/Edison/edison-src/build/tmp/work/i686-linux/gmp-native/5.1.1-r0/temp/log.do_compile.19214)

      ERROR: Task 2871 (virtual:native:/home/dhruv/Devlopement/Edison/edison-src/poky/meta/recipes-support/gmp/gmp_5.1.1.bb, do_compile) failed with exit code '1'

      NOTE: Tasks Summary: Attempted 132 tasks of which 125 didn't need to be rerun and 1 failed.

      Waiting for 0 running tasks to finish:

       

      Summary: 1 task failed:

        virtual:native:/home/dhruv/Devlopement/Edison/edison-src/poky/meta/recipes-support/gmp/gmp_5.1.1.bb, do_compile

      Summary: There was 1 ERROR message shown, returning a non-zero exit code.

        • 1. Re: Getting compilation error while trying to make yocto project with added image of opencv
          mhahn

          why don't you just install from AlexT_Intel's repo.opkg.net/edison/repo/core2-32/?

          • 2. Re: Getting compilation error while trying to make yocto project with added image of opencv
            EthanHunt

            Hello mhahn,

            Thanks for replying. I have tried that one also, but when I try to compile any opencv code using command " g++ -ggdb `pkg-config --cflags opencv` -o `basename opencvtest.cpp .cpp` opencvtest.cpp `pkg-config --libs opencv` " so at that time also I can't get success. It shows that couldn't find opencv package.

            So please if you know how to use AlexT_Intel's repo package then please help me.

            • 3. Re: Getting compilation error while trying to make yocto project with added image of opencv
              mhahn

              after setting Alex' repo and "opkg install"'ing the packages you want (as described in other threads on this forum) you should find opencv on your Edison.

              Try "opkg files <opencv package name>" to see the installed packages.

              Try "pkg-config --cflags opencv" outside of g++. If it doesn't work maybe try setting the include and library paths as well as the libs directly rather than via pkg-config

              • 5. Re: Getting compilation error while trying to make yocto project with added image of opencv
                EthanHunt

                Hi mhahn,

                 

                I have tried your suggested one solution but still when I am compiling sample opencv code(image.cpp) using " g++ image.cpp -o app_image `pkg-config opencv --cflags --libs` "  , I am getting lots of errors as below. Please help me with this. Thanks.

                 

                image.cpp: In function 'int main(int, char**)':

                image.cpp:29:9: error: 'IplImage' was not declared in this scope

                     Ptr<IplImage> iplimg = cvLoadImage(imagename); // Ptr<T> is safe ref-conting pointer class

                         ^

                image.cpp:29:17: error: template argument 1 is invalid

                     Ptr<IplImage> iplimg = cvLoadImage(imagename); // Ptr<T> is safe ref-conting pointer class

                                 ^

                image.cpp:29:26: error: invalid type in declaration before '=' token

                     Ptr<IplImage> iplimg = cvLoadImage(imagename); // Ptr<T> is safe ref-conting pointer class

                                          ^

                image.cpp:29:49: error: 'cvLoadImage' was not declared in this scope

                     Ptr<IplImage> iplimg = cvLoadImage(imagename); // Ptr<T> is safe ref-conting pointer class

                                                                 ^

                image.cpp:30:15: error: request for member 'empty' in 'iplimg', which is of non-class type 'int'

                     if(iplimg.empty())

                               ^

                image.cpp:35:19: error: no matching function for call to 'cv::Mat::Mat(int&)'

                     Mat img(iplimg); // cv::Mat replaces the CvMat and IplImage, but it's easy to convert

                                   ^

                image.cpp:35:19: note: candidates are:

                In file included from /usr/local/include/opencv2/core.hpp:57:0,

                                 from /usr/local/include/opencv2/imgproc.hpp:46,

                                 from /usr/local/include/opencv2/imgproc/imgproc.hpp:48,

                                 from image.cpp:3:

                /usr/local/include/opencv2/core/mat.hpp:684:14: note: cv::Mat::Mat(const cv::cuda::GpuMat&)

                     explicit Mat(const cuda::GpuMat& m);

                              ^

                /usr/local/include/opencv2/core/mat.hpp:684:14: note:   no known conversion for argument 1 from 'int' to 'const cv::cuda::GpuMat&'

                /usr/local/include/opencv2/core/mat.hpp:681:37: note: template<class _Tp> cv::Mat::Mat(const cv::MatCommaInitializer_<_Tp>&)

                     template<typename _Tp> explicit Mat(const MatCommaInitializer_<_Tp>& commaInitializer);

                                                     ^

                /usr/local/include/opencv2/core/mat.hpp:681:37: note:   template argument deduction/substitution failed:

                image.cpp:35:19: note:   mismatched types 'const cv::MatCommaInitializer_<_Tp>' and 'int'

                     Mat img(iplimg); // cv::Mat replaces the CvMat and IplImage, but it's easy to convert

                                   ^

                In file included from /usr/local/include/opencv2/core.hpp:57:0,

                                 from /usr/local/include/opencv2/imgproc.hpp:46,

                                 from /usr/local/include/opencv2/imgproc/imgproc.hpp:48,

                                 from image.cpp:3:

                /usr/local/include/opencv2/core/mat.hpp:679:37: note: template<class _Tp> cv::Mat::Mat(const cv::Point3_<_Tp>&, bool)

                     template<typename _Tp> explicit Mat(const Point3_<_Tp>& pt, bool copyData=true);

                                                     ^

                /usr/local/include/opencv2/core/mat.hpp:679:37: note:   template argument deduction/substitution failed:

                image.cpp:35:19: note:   mismatched types 'const cv::Point3_<_Tp>' and 'int'

                     Mat img(iplimg); // cv::Mat replaces the CvMat and IplImage, but it's easy to convert

                                   ^

                In file included from /usr/local/include/opencv2/core.hpp:57:0,

                                 from /usr/local/include/opencv2/imgproc.hpp:46,

                                 from /usr/local/include/opencv2/imgproc/imgproc.hpp:48,

                                 from image.cpp:3:

                /usr/local/include/opencv2/core/mat.hpp:677:37: note: template<class _Tp> cv::Mat::Mat(const cv::Point_<_Tp>&, bool)

                     template<typename _Tp> explicit Mat(const Point_<_Tp>& pt, bool copyData=true);

                                                     ^

                /usr/local/include/opencv2/core/mat.hpp:677:37: note:   template argument deduction/substitution failed:

                image.cpp:35:19: note:   mismatched types 'const cv::Point_<_Tp>' and 'int'

                     Mat img(iplimg); // cv::Mat replaces the CvMat and IplImage, but it's easy to convert

                                   ^

                In file included from /usr/local/include/opencv2/core.hpp:57:0,

                                 from /usr/local/include/opencv2/imgproc.hpp:46,

                                 from /usr/local/include/opencv2/imgproc/imgproc.hpp:48,

                                 from image.cpp:3:

                /usr/local/include/opencv2/core/mat.hpp:675:51: note: template<class _Tp, int m, int n> cv::Mat::Mat(const cv::Matx<_Tp, m, n>&, bool)

                     template<typename _Tp, int m, int n> explicit Mat(const Matx<_Tp, m, n>& mtx, bool copyData=true);

                                                                   ^

                /usr/local/include/opencv2/core/mat.hpp:675:51: note:   template argument deduction/substitution failed:

                image.cpp:35:19: note:   mismatched types 'const cv::Matx<_Tp, m, n>' and 'int'

                     Mat img(iplimg); // cv::Mat replaces the CvMat and IplImage, but it's easy to convert

                                   ^

                In file included from /usr/local/include/opencv2/core.hpp:57:0,

                                 from /usr/local/include/opencv2/imgproc.hpp:46,

                                 from /usr/local/include/opencv2/imgproc/imgproc.hpp:48,

                                 from image.cpp:3:

                /usr/local/include/opencv2/core/mat.hpp:673:44: note: template<class _Tp, int n> cv::Mat::Mat(const cv::Vec<_Tp, m>&, bool)

                     template<typename _Tp, int n> explicit Mat(const Vec<_Tp, n>& vec, bool copyData=true);

                                                            ^

                /usr/local/include/opencv2/core/mat.hpp:673:44: note:   template argument deduction/substitution failed:

                image.cpp:35:19: note:   mismatched types 'const cv::Vec<_Tp, m>' and 'int'

                     Mat img(iplimg); // cv::Mat replaces the CvMat and IplImage, but it's easy to convert

                                   ^

                In file included from /usr/local/include/opencv2/core.hpp:57:0,

                                 from /usr/local/include/opencv2/imgproc.hpp:46,

                                 from /usr/local/include/opencv2/imgproc/imgproc.hpp:48,

                                 from image.cpp:3:

                /usr/local/include/opencv2/core/mat.hpp:671:37: note: template<class _Tp> cv::Mat::Mat(const std::vector<_Tp>&, bool)

                     template<typename _Tp> explicit Mat(const std::vector<_Tp>& vec, bool copyData=false);

                                                     ^

                /usr/local/include/opencv2/core/mat.hpp:671:37: note:   template argument deduction/substitution failed:

                image.cpp:35:19: note:   mismatched types 'const std::vector<_Tp>' and 'int'

                     Mat img(iplimg); // cv::Mat replaces the CvMat and IplImage, but it's easy to convert

                                   ^

                In file included from /usr/local/include/opencv2/core.hpp:57:0,

                                 from /usr/local/include/opencv2/imgproc.hpp:46,

                                 from /usr/local/include/opencv2/imgproc/imgproc.hpp:48,

                                 from image.cpp:3:

                /usr/local/include/opencv2/core/mat.hpp:669:5: note: cv::Mat::Mat(const cv::Mat&, const cv::Range*)

                     Mat(const Mat& m, const Range* ranges);

                     ^

                /usr/local/include/opencv2/core/mat.hpp:669:5: note:   candidate expects 2 arguments, 1 provided

                /usr/local/include/opencv2/core/mat.hpp:668:5: note: cv::Mat::Mat(const cv::Mat&, const Rect&)

                     Mat(const Mat& m, const Rect& roi);

                     ^

                /usr/local/include/opencv2/core/mat.hpp:668:5: note:   candidate expects 2 arguments, 1 provided

                /usr/local/include/opencv2/core/mat.hpp:667:5: note: cv::Mat::Mat(const cv::Mat&, const cv::Range&, const cv::Range&)

                     Mat(const Mat& m, const Range& rowRange, const Range& colRange=Range::all());

                     ^

                /usr/local/include/opencv2/core/mat.hpp:667:5: note:   candidate expects 3 arguments, 1 provided

                /usr/local/include/opencv2/core/mat.hpp:664:5: note: cv::Mat::Mat(int, const int*, int, void*, const size_t*)

                     Mat(int ndims, const int* sizes, int type, void* data, const size_t* steps=0);

                     ^

                /usr/local/include/opencv2/core/mat.hpp:664:5: note:   candidate expects 5 arguments, 1 provided

                In file included from /usr/local/include/opencv2/core/mat.hpp:2381:0,

                                 from /usr/local/include/opencv2/core.hpp:57,

                                 from /usr/local/include/opencv2/imgproc.hpp:46,

                                 from /usr/local/include/opencv2/imgproc/imgproc.hpp:48,

                                 from image.cpp:3:

                /usr/local/include/opencv2/core/mat.inl.hpp:401:1: note: cv::Mat::Mat(cv::Size, int, void*, size_t)

                Mat::Mat(Size _sz, int _type, void* _data, size_t _step)

                ^

                /usr/local/include/opencv2/core/mat.inl.hpp:401:1: note:   candidate expects 4 arguments, 1 provided

                /usr/local/include/opencv2/core/mat.inl.hpp:370:1: note: cv::Mat::Mat(int, int, int, void*, size_t)

                Mat::Mat(int _rows, int _cols, int _type, void* _data, size_t _step)

                ^

                /usr/local/include/opencv2/core/mat.inl.hpp:370:1: note:   candidate expects 5 arguments, 1 provided

                /usr/local/include/opencv2/core/mat.inl.hpp:351:1: note: cv::Mat::Mat(const cv::Mat&)

                Mat::Mat(const Mat& m)

                ^

                /usr/local/include/opencv2/core/mat.inl.hpp:351:1: note:   no known conversion for argument 1 from 'int' to 'const cv::Mat&'

                /usr/local/include/opencv2/core/mat.inl.hpp:342:1: note: cv::Mat::Mat(int, const int*, int, const Scalar&)

                Mat::Mat(int _dims, const int* _sz, int _type, const Scalar& _s)

                ^

                /usr/local/include/opencv2/core/mat.inl.hpp:342:1: note:   candidate expects 4 arguments, 1 provided

                /usr/local/include/opencv2/core/mat.inl.hpp:334:1: note: cv::Mat::Mat(int, const int*, int)

                Mat::Mat(int _dims, const int* _sz, int _type)

                ^

                /usr/local/include/opencv2/core/mat.inl.hpp:334:1: note:   candidate expects 3 arguments, 1 provided

                /usr/local/include/opencv2/core/mat.inl.hpp:325:1: note: cv::Mat::Mat(cv::Size, int, const Scalar&)

                Mat::Mat(Size _sz, int _type, const Scalar& _s)

                ^

                /usr/local/include/opencv2/core/mat.inl.hpp:325:1: note:   candidate expects 3 arguments, 1 provided

                /usr/local/include/opencv2/core/mat.inl.hpp:308:1: note: cv::Mat::Mat(int, int, int, const Scalar&)

                Mat::Mat(int _rows, int _cols, int _type, const Scalar& _s)

                ^

                /usr/local/include/opencv2/core/mat.inl.hpp:308:1: note:   candidate expects 4 arguments, 1 provided

                /usr/local/include/opencv2/core/mat.inl.hpp:317:1: note: cv::Mat::Mat(cv::Size, int)

                Mat::Mat(Size _sz, int _type)

                ^

                /usr/local/include/opencv2/core/mat.inl.hpp:317:1: note:   candidate expects 2 arguments, 1 provided

                /usr/local/include/opencv2/core/mat.inl.hpp:300:1: note: cv::Mat::Mat(int, int, int)

                Mat::Mat(int _rows, int _cols, int _type)

                ^

                /usr/local/include/opencv2/core/mat.inl.hpp:300:1: note:   candidate expects 3 arguments, 1 provided

                /usr/local/include/opencv2/core/mat.inl.hpp:294:1: note: cv::Mat::Mat()

                Mat::Mat()

                ^

                /usr/local/include/opencv2/core/mat.inl.hpp:294:1: note:   candidate expects 0 arguments, 1 provided

                image.cpp:51:28: error: 'CV_BGR2YCrCb' was not declared in this scope

                     cvtColor(img, img_yuv, CV_BGR2YCrCb); // convert image to YUV color space. The output image will be created automatically

                                            ^

                image.cpp:109:28: error: 'CV_YCrCb2BGR' was not declared in this scope

                     cvtColor(img_yuv, img, CV_YCrCb2BGR);

                                            ^

                image.cpp:116:43: error: 'cvShowImage' was not declared in this scope

                     cvShowImage("image with grain", iplimg);

                                                           ^

                • 6. Re: Getting compilation error while trying to make yocto project with added image of opencv
                  EthanHunt

                  Hi mhahn,

                  I have already updated both packages(opkg install opncv-dev and opkg install opencv-staticdev) as Alex has suggested in his previous opencv solutions. But still I can't find any luck.

                  • 7. Re: Getting compilation error while trying to make yocto project with added image of opencv
                    mhahn

                    EthanHunt wrote:

                     

                    Hi mhahn,

                     

                    I have tried your suggested one solution but still when I am compiling sample opencv code(image.cpp) using " g++ image.cpp -o app_image `pkg-config opencv --cflags --libs` "  , I am getting lots of errors as below. Please help me with this. Thanks.

                     

                     

                    I suggested to test "pkg-config opencv --cflags --libs" outside of g++. Did this work?

                    1 of 1 people found this helpful
                    • 8. Re: Getting compilation error while trying to make yocto project with added image of opencv
                      EthanHunt

                      I have executed following command and it works.Thanks anyway.

                       

                      g++ cameratest.cpp -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_calib3d -lopencv_contrib -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_legacy -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_video -lopencv_videostab -o cameratest

                      • 9. Re: Getting compilation error while trying to make yocto project with added image of opencv
                        EthanHunt

                        Hi mhahn,

                        When I tried  " pkg-config opencv --cflags --libs " command, that works totally fine. Output as below,

                         

                        -I/usr/include/opencv -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab -lrt -lpthread -lm -ldl

                         

                        So I tried then " g++ image.cpp -o app_image `pkg-config opencv --cflags --libs` " command but still it gives error as below.

                         

                        /usr/lib/gcc/i586-poky-linux/4.8.2/../../../../i586-poky-linux/bin/ld: cannot find -lopencv_ts

                        collect2: error: ld returned 1 exit status

                         

                        On above pkg-config command it shows -lopencv_ts is there, then still why it cannot find it?