Caffe: opencv error

15,892

Solution 1

You can also add the opencv_imgcodecs to the MakeFile in line 187, see this pull.

Solution 2

It could be that you are using OpenCV version 3. If yes just uncomment the following line in your Makefile.config:

# OPENCV_VERSION := 3

So it will look like

OPENCV_VERSION := 3

You could verify the version currently in use by doing:

$ python
>>> import cv2
>>> cv2.__version__
'3.1.0-dev'

Solution 3

The problem report is very clear. There is a problem with linking library libraries.The reason may be the difference between 3.0 and 2.x. You need to add

opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs

into LIBRARIES +=.

Solution 4

I used cmake instead with the -DBUILD_TIFF=ON flag and got a successful build.

Share:
15,892
user1561108
Author by

user1561108

Updated on June 11, 2022

Comments

  • user1561108
    user1561108 almost 2 years

    I've built opencv 3.0 from source and can run a few sample apps, build against the headers ok so I presume it's installed successfully.

    I'm also using python3 and I now go to install and build caffe. I set a few variables in Makefile.config as I'm using the CPU due to having an AMD GPU and also Anaconda.

    When I run make all I get this error:

    $ make all
    CXX/LD -o .build_release/examples/cpp_classification/classification.bin
    /usr/bin/ld: .build_release/examples/cpp_classification/classification.o: undefined reference to symbol '_ZN2cv6imreadERKNS_6StringEi'
    //usr/local/lib/libopencv_imgcodecs.so.3.0: error adding symbols: DSO missing from command line
    collect2: error: ld returned 1 exit status
    Makefile:565: recipe for target '.build_release/examples/cpp_classification/classification.bin' failed
    make: *** [.build_release/examples/cpp_classification/classification.bin] Error 1
    

    from searching I think this is something to do with using openCV 3 but I'm not sure where to start looking for a solution. Any help?

    And yes I'm one of the horde of inexperienced users looking to fiddle with the Google Inception learning technique.

  • Alter
    Alter about 8 years
    adding -lopencv_imgcodecs worked great for my g++ compile.