ld: library not found for -llibtbb.dylib

后端 未结 5 2345
忘掉有多难
忘掉有多难 2021-02-14 08:41

I try to compile some files from the opencv-2.4.8/apps/haarfinder but i get the following error:

ld: library not found for -llibtbb.dylib

Notic

5条回答
  •  名媛妹妹
    2021-02-14 09:33

    I installed opencv 2.4.12 with tbb from homebrew on El Capitan, and then separately downloaded the source from github in order to compile mergevec and the s/libtbb\.dylib/tbb/ fix on its own still didn't help.

    My fix was to add -L/usr/local/lib to the start of the g++ arguments as by default it wasn't searching for my homebrew libs. I also had to add cvsamplesoutput.cpp as mentioned in another answer to fix the following error:

    Undefined symbols for architecture x86_64:
      "IOutput::createOutput(char const*, IOutput::OutputType)", referenced from:
          JpgDatasetGenerator::JpgDatasetGenerator(char const*) in cvhaartraining-8f5a1b.o
          PngDatasetGenerator::PngDatasetGenerator(char const*) in cvhaartraining-8f5a1b.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    

    The final command that worked for me was:

    g++ -L/usr/local/lib `pkg-config --libs --cflags opencv | sed 's/libtbb\.dylib/tbb/'`\
      -I. -o mergevec mergevec.cpp  cvboost.cpp cvcommon.cpp cvsamples.cpp\
      cvhaarclassifier.cpp cvhaartraining.cpp cvsamplesoutput.cpp -lopencv_core\
      -lopencv_calib3d -lopencv_imgproc -lopencv_highgui -lopencv_objdetect
    

提交回复
热议问题