Missing symbols for cv::rectangle with two points, works fine when using a rect (Bug #4239)
Description
Master 361eb63 of OpenCV 3 has missing symbols when calling the cv::rectangle function with two points.
When calling the void rectangle(Mat&, Point, Point, const Scalar&, int, int, int)
signature, the linker reports an undefined symbol for cv::_InputArray::getMatVector
This doesn't occur when using the void rectangle(Mat&, Rect, const Scalar&, int, int, int)
variation.
Related issues
related to Bug #4416: Missing symbols for cv::rectangle with two points, works ... | Open | 2015-06-16 |
Associated revisions
Merge pull request #4239 from apavlenko:android_ocl_sample2
History
Updated by Ilya Lavrenov almost 10 years ago
Hi Stephen,
Could you provide a simple program to reproduce the issue?
Updated by Stephen Pegoraro almost 10 years ago
Here's a simple example extracted from my application, it simply lets you draw a bounding box in the first frame returned from the default camera. I have included the two different function calls with the failing one commented out for evaluation. The build is achieved with cmake 3.1 and is successfully finding the opencv libs and linking them.
#include <opencv2/opencv.hpp> #include <iostream> #define MAIN_WIN "main" using namespace cv; static bool drawing; static Rect bbox; void on_mouse(int ev, int x, int y, int flags, void *data) { static Point tl, br; if (ev == EVENT_LBUTTONDOWN) { drawing = true; tl = Point(x, y); } else if (ev == EVENT_LBUTTONUP) { drawing = false; } else if (ev == EVENT_MOUSEMOVE) { br = Point(x, y); bbox = Rect(tl, br); } } int main(int argc, char *argv[]) { namedWindow(MAIN_WIN, WINDOW_AUTOSIZE); setMouseCallback(MAIN_WIN, on_mouse); VideoCapture cam(0); if (!cam.isOpened()) { std::cout << "Failed to open camera!" << std::endl; return -1; } Mat frame; cam >> frame; imshow(MAIN_WIN, frame); for (;;) { if (drawing) { Mat temp; frame.copyTo(temp); //--------------------------------------------------------------------------------- //rectangle(temp, bbox.tl(), bbox.br(), Scalar(0, 255, 0)); // This Fails! rectangle(temp, bbox, Scalar(0, 255, 0)); // This Succeeds! //--------------------------------------------------------------------------------- imshow(MAIN_WIN, temp); } if (waitKey(30) > 0) { break; } } return 0; }
Updated by Stephen Pegoraro almost 10 years ago
As an added update, the same missing symbols occur when using circle(InputOutputArray, Point, int, Scalar)
Undefined symbols for architecture x86_64:
"cv::_InputArray::getMatVector(std::__1::vector<cv::Mat, std::__1::allocator<cv::Mat> >&) const", referenced from:
vtable for cv::_InputOutputArray in example.cpp.o
"cv::_InputArray::getUMatVector(std::__1::vector<cv::UMat, std::__1::allocator<cv::UMat> >&) const", referenced from:
vtable for cv::_InputOutputArray in example.cpp.o
ld: symbol(s) not found for architecture x86_64
Updated by Stephen Pegoraro almost 10 years ago
Update:
It turns out that this is my fault, it's an incompatibility between the C++ libraries used to build OpenCV and my application.
OpenCV must be built on OS X using libstdc++. My application was using libc++ and upon changing it to libstdc++ it would also fail due to some missing headers (stdint.h, in the tr1/ directory). This was due to having the C++11 standard flag on for my build.
I am cancelling the issue however note that CUDA 7.0 now links nicely with libc++, removing this issue completely.
- Status changed from New to Cancelled
Updated by Marco Marchesi over 9 years ago
Hi,
sorry if I re-open this issue but it's not clear how to fix the missing symbols:
Undefined symbols for architecture x86_64:
"cv::_InputArray::getMatVector(std::__1::vector<cv::Mat, std::__1::allocator<cv::Mat> >&) const", referenced from:
vtable for cv::_InputOutputArray in example.cpp.o
"cv::_InputArray::getUMatVector(std::__1::vector<cv::UMat, std::__1::allocator<cv::UMat> >&) const", referenced from:
vtable for cv::_InputOutputArray in example.cpp.o
ld: symbol(s) not found for architecture x86_64
I have built OpenCV 3.0 with CUDA 7.0 and default compiler (Mac OS X 10.10). Why does the issue still appear?
Thanks
Marco
- Status changed from Cancelled to Open
Updated by Marco Marchesi over 9 years ago
Marco Marchesi wrote:
Hi,
sorry if I re-open this issue but it's not clear how to fix the missing symbols:Undefined symbols for architecture x86_64:
"cv::_InputArray::getMatVector(std::__1::vector<cv::Mat, std::__1::allocator<cv::Mat> >&) const", referenced from:
vtable for cv::_InputOutputArray in example.cpp.o
"cv::_InputArray::getUMatVector(std::__1::vector<cv::UMat, std::__1::allocator<cv::UMat> >&) const", referenced from:
vtable for cv::_InputOutputArray in example.cpp.o
ld: symbol(s) not found for architecture x86_64I have built OpenCV 3.0 with CUDA 7.0 and default compiler (Mac OS X 10.10). Why does the issue still appear?
Thanks
Marco
- Status changed from Open to Done