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
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