Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to invoke opencv static library

I have built a static opencv library using cmake, and after that I want to invoke the static opencv library for my application. However, it seems that the application program cannot link the static opencv library, and it gives me the following warnings:

ld: warning: ignoring file /usr/local/lib/libopencv_core.a, file was built for archive which is not the architecture being linked (i386): /usr/local/lib/libopencv_core.a
ld: warning: ignoring file /usr/local/lib/libopencv_highgui.a, file was built for archive which is not the architecture being linked (i386): /usr/local/lib/libopencv_highgui.a
ld: warning: ignoring file /usr/local/lib/libopencv_imgproc.a, file was built for archive which is not the architecture being linked (i386): /usr/local/lib/libopencv_imgproc.a
ld: warning: ignoring file /usr/local/lib/liblibjasper.a, file was built for archive which is not the architecture being linked (i386): /usr/local/lib/liblibjasper.a
ld: warning: ignoring file /usr/local/lib/liblibjpeg.a, file was built for archive which is not the architecture being linked (i386): /usr/local/lib/liblibjpeg.a
ld: warning: ignoring file /usr/local/lib/liblibpng.a, file was built for archive which is not the architecture being linked (i386): /usr/local/lib/liblibpng.a
ld: warning: ignoring file /usr/local/lib/liblibtiff.a, file was built for archive which is not the architecture being linked (i386): /usr/local/lib/liblibtiff.a
ld: warning: ignoring file /usr/local/lib/libzlib.a, file was built for archive which is not the architecture being linked (i386): /usr/local/lib/libzlib.a
ld: warning: ignoring file /usr/local/lib/libIlmImf.a, file was built for archive which is not the architecture being linked (i386): /usr/local/lib/libIlmImf.a

It seems to me that the application program is trying to invoke the dynamic opencv library, and a simple application program that just invokes cv::Mat test will give me the following errors:

Undefined symbols for architecture i386:
  "cv::Mat::deallocate()", referenced from:
      cv::Mat::release() in main.o
  "cv::fastFree(void*)", referenced from:
      cv::Mat::~Mat() in main.o