Comments (18)
Hey there. Which version of OpenCV did you use? Which version of the source code? I'll try to reproduce this issue. My guess at the moment is that something in the recipes of OpenCV and/or libtbb changed.
from opencv-haar-classifier-training.
Good thought, yes, you might be right. When installing OpenCV from homebrew it downloaded the lastest version 2.4.9 together with tbb42_20140122.
When downloading the source i got v2.4.5 as you specified. Also tried v2.4.9 just to be sure.
from opencv-haar-classifier-training.
It seems like the pkg-config metadata files for OpenCV contain the wrong linker information about tbb. The tbb lib files are here (at least on my system):
/usr/local/Cellar/tbb/4.2.3/lib/libtbb.dylib
/usr/local/lib/libtbb.dylib
The second one is a symlink to the first file. Now, /usr/local/lib
should be one of the standard paths the linker looks for libraries, which means it should find it. But the problem is that -llibtbb.dylib
is passed to the linker. The convention is to drop the lib
when passing stuff to the linker.
If we open /usr/local/lib/pkgconfig/opencv.pc
(which provides the meta-information for pkg-config
) and change -llibtbb.dylib
to -ltbb
our g++
command line works flawlessly.
from opencv-haar-classifier-training.
Seems like the problem is with the OpenCV build system, which generates the opencv.pc
file and includes the wrong linking information:
# Package Information for pkg-config
prefix=/usr/local
exec_prefix=${prefix}
libdir=
includedir_old=${prefix}/include/opencv
includedir_new=${prefix}/include
Name: OpenCV
Description: Open Source Computer Vision Library
Version: 2.4.9
Libs: ${exec_prefix}/lib/libopencv_calib3d.dylib ${exec_prefix}/lib/libopencv_contrib.dylib ${exec_prefix}/lib/libopencv_core.dylib ${exec_prefix}/lib/libopencv_features2d.dylib ${exec_prefix}/lib/libopencv_flann.dylib ${exec_prefix}/lib/libopencv_gpu.dylib ${exec_prefix}/lib/libopencv_highgui.dylib ${exec_prefix}/lib/libopencv_imgproc.dylib ${exec_prefix}/lib/libopencv_legacy.dylib ${exec_prefix}/lib/libopencv_ml.dylib ${exec_prefix}/lib/libopencv_nonfree.dylib ${exec_prefix}/lib/libopencv_objdetect.dylib ${exec_prefix}/lib/libopencv_ocl.dylib ${exec_prefix}/lib/libopencv_photo.dylib ${exec_prefix}/lib/libopencv_stitching.dylib ${exec_prefix}/lib/libopencv_superres.dylib ${exec_prefix}/lib/libopencv_ts.a ${exec_prefix}/lib/libopencv_video.dylib ${exec_prefix}/lib/libopencv_videostab.dylib -llibtbb.dylib
Cflags: -I${includedir_old} -I${includedir_new}
Now, this is hacky, but it should fix the problems for this tutorial here:
g++ `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\
-lopencv_core -lopencv_calib3d -lopencv_imgproc -lopencv_highgui -lopencv_objdetect
Can you give me feedback if that works for you?
from opencv-haar-classifier-training.
I also opened an issue on the OpenCV bug tracker: http://code.opencv.org/issues/3691
Let's see what they have to say. Maybe it's not a problem with OpenCV but with Homebrew.
from opencv-haar-classifier-training.
Yes, the updated commands work right out of the box together with the source for v2.4.5 and v2.4.9.
Seems like the following thread on StackOverflow is referencing the same error:
http://stackoverflow.com/questions/23363678/ld-library-not-found-for-llibtbb-dylib
Seems like you are right :)
from opencv-haar-classifier-training.
Cool. Then I'll update the readme to use 2.4.9 and the new command.
On Wednesday, May 14, 2014, moezzie [email protected] wrote:
Yes, the updated commands work right out of the box together with the
source for v2.4.5 and v2.4.9.
Seems like the following thread on StackOverflow is referencing the same
error:http://stackoverflow.com/questions/23363678/ld-library-not-found-for-llibtbb-dylib
Seems like you are right :)
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-43056036
.
from opencv-haar-classifier-training.
I've come across this error now, and I'm getting the same problem. However, I've tried everything you suggested, but it's still returning the same error or a similar one: I.E: "ld: library not found for -ltbb" or "ld: library not found for -libtbb.dylib". I've checked through and the actual libraries exist and are symlinked, but it's not wanting to find them.
from opencv-haar-classifier-training.
@JamEngulfer Is tbb installed on your system? What does brew info opencv
and brew info tbb
say?
(Sorry for the delay, I was on vacation)
from opencv-haar-classifier-training.
I've checked the installations and both packages are installed. The versions are 'opencv-2.4.9' and 'tbb-4.3-20140724'. Under the info for openCV, it has tab ticked as an option.
from opencv-haar-classifier-training.
Okay. What's the output of pkg-config --libs --cflags opencv
?
from opencv-haar-classifier-training.
The complete output is this:
-I/usr/local/Cellar/opencv/2.4.9/include/opencv -I/usr/local/Cellar/opencv/2.4.9/include /usr/local/Cellar/opencv/2.4.9/lib/libopencv_calib3d.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_contrib.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_core.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_features2d.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_flann.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_gpu.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_highgui.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_imgproc.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_legacy.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_ml.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_nonfree.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_objdetect.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_ocl.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_photo.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_stitching.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_superres.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_ts.a /usr/local/Cellar/opencv/2.4.9/lib/libopencv_video.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_videostab.dylib
from opencv-haar-classifier-training.
Did you install opencv with the --with-tbb
Option?
from opencv-haar-classifier-training.
Indeed I did
from opencv-haar-classifier-training.
I actually don't have any more ideas as to how to fix your issue. But here is the output on my system with the relevant information:
$ brew info opencv
opencv: stable 2.4.9, HEAD
http://opencv.org/
/usr/local/Cellar/opencv/2.4.9 (219 files, 38M) *
Built from source with: --with-tbb
From: https://github.com/homebrew/homebrew-science/blob/master/opencv.rb
==> Dependencies
Build: cmake ✔, pkg-config ✔
Required: jpeg ✔, libpng ✔, libtiff ✔
Recommended: openexr ✘
Optional: eigen ✔, gstreamer ✘, jasper ✔, libdc1394 ✘, openni ✘, qt ✔, tbb ✔, ffmpeg ✘
==> Options
--32-bit
Build 32-bit only
--c++11
Build using C++11 mode
--with-cuda
Build with CUDA support
--with-eigen
Build with eigen support
--with-ffmpeg
Build with ffmpeg support
--with-gstreamer
Build with gstreamer support
--with-jasper
Build with jasper support
--with-java
Build with Java support
--with-libdc1394
Build with libdc1394 support
--with-openni
Build with openni support
--with-qt
Build the Qt4 backend to HighGUI
--with-quicktime
Use QuickTime for Video I/O insted of QTKit
--with-tbb
Enable parallel code in OpenCV using Intel TBB
--with-tests
Build with accuracy & performance tests
--without-opencl
Disable GPU code in OpenCV using OpenCL
--without-openexr
Build without openexr support
--HEAD
install HEAD version
==> Caveats
If you need Python to find the installed site-packages:
mkdir -p ~/Library/Python/2.7/lib/python/site-packages
echo '/usr/local/lib/python2.7/site-packages' > ~/Library/Python/2.7/lib/python/site-packages/homebrew.pth
$ pkg-config --libs --cflags opencv
-I/usr/local/Cellar/opencv/2.4.9/include/opencv -I/usr/local/Cellar/opencv/2.4.9/include /usr/local/Cellar/opencv/2.4.9/lib/libopencv_calib3d.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_contrib.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_core.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_features2d.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_flann.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_gpu.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_highgui.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_imgproc.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_legacy.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_ml.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_nonfree.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_objdetect.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_ocl.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_photo.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_stitching.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_superres.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_ts.a /usr/local/Cellar/opencv/2.4.9/lib/libopencv_video.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_videostab.dylib -llibtbb.dylib
$ brew info tbb
tbb: stable 4.3-20140724 (bottled)
http://www.threadingbuildingblocks.org/
/usr/local/Cellar/tbb/4.3-20140724 (104 files, 1.9M) *
Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/tbb.rb
==> Options
--c++11
Build using C++11 mode
As you can see, the pkg-config
output shows tbb, in the wrong format, but it's there.
from opencv-haar-classifier-training.
Oh :/ Well, I'll do a complete clean reinstall and see if that fixes anything
from opencv-haar-classifier-training.
This resolved the ld: library not found for -llibtbb.dylib
issue for me: http://stackoverflow.com/a/23582975/2578205
Suppose libtbb.dylib is in /usr/local/lib/libtbb.dylib and opencv.pc is in /usr/local/lib/pkgconfig (The location may vary depending on where you install tbb and pkg-config)
Then edit /usr/local/lib/pkgconfig/opencv.pc, change -llibtbb.dylib to /usr/local/lib/libtbb.dylib
from opencv-haar-classifier-training.
@Glavin001 For whatever reason, your solution isn't working for me.
Compilation Error
[ 16%] Built target compressed_depth_image_transport_gencfg
[ 33%] Linking CXX shared library /Users/Jackson/ros_catkin_ws/devel_isolated/compressed_depth_image_transport/lib/libcompressed_depth_image_transport.dylib
ld: library not found for -ltbb
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [/Users/Jackson/ros_catkin_ws/devel_isolated/compressed_depth_image_transport/lib/libcompressed_depth_image_transport.dylib] Error 1
make[1]: *** [CMakeFiles/compressed_depth_image_transport.dir/all] Error 2
make: *** [all] Error 2
Modified /usr/local/lib/pkgconfig/opencv.pc
# Package Information for pkg-config
prefix=/usr/local/Cellar/opencv/2.4.12_2
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir_old=${prefix}/include/opencv
includedir_new=${prefix}/include
Name: OpenCV
Description: Open Source Computer Vision Library
Version: 2.4.12
Libs: -L${exec_prefix}/lib -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 /usr/local/lib/libtbb.dylib
Cflags: -I${includedir_old} -I${includedir_new}
Am I missing something?
from opencv-haar-classifier-training.
Related Issues (20)
- hi, i'm getting like this while creating my own harr-cascade classifier, please let me correct if anything wrong, and please tell the reason for why classifier cant be trained? and thanks in advance HOT 3
- Illegal division by zero at bin/createsamples.pl line 45. HOT 3
- OpenCV error : Bad Arguement - Can not get new Positive Sample
- no vec files
- Can not see finished_classifier.xml file HOT 15
- unable to create .vec files with create samples file HOT 1
- how createsamples.pl will works? HOT 1
- Error when create samples HOT 1
- Cannot create sample.vec HOT 14
- opencv_createsamples not creating anything inside the 'samples' folder HOT 1
- not able to create final classifier HOT 1
- File not found - '*.jpg' HOT 1
- Please Help
- std::logic_error
- opencv error assertion failed
- sh: 1: Syntax error: Unterminated quoted string HOT 1
- opencv_traincascade assertion error HOT 2
- vec files can't be created HOT 1
- mergevec.py error
- 'opencv_createsamples' is not recognized as an internal or external command, HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opencv-haar-classifier-training.