Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using custom built OpenCV for iOS on XCode produces ___sincos_stret undefined symbol

I'm trying to use a C++ static library into my iPhone app which uses a modified version of OpenCV for iOS and I'm stuck with this issue at linking time:

Undefined symbols for architecture armv7:
  "___sincos_stret", referenced from:
      cv::initInterTab2D(int, bool) in opencv2(imgwarp.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I really do not understand what I'm missing, that function does not seem to be present in OpenCV and I do not find anything meaningful on the web; I'm wondering if it's in some mathematical library, but I haven't found anything yet.

I've compiled OpenCV with Clang and using the default libc++ library.

The libmylibrary.a and the OpenCV2 framework are correctly in the list of linked libraries.

I'm new to XCode, therefore I could have missed something trivial in the compilation of the static library and/or in the linking of it into my project.

I haven't changed the source code of that object as my changes were related to another part of the imgproc module of OpenCV, therefore I guess that this could have happen even using the default version.

Do you have any clues?

like image 340
Marco Bonifazi Avatar asked Jan 18 '26 10:01

Marco Bonifazi


1 Answers

For fixing this problem with the Xcode 5 toolchain I specified the minimum supported iOS version as a compiler option to match the configuration in Xcode. For example:

-miphoneos-version-min=5.0

You can add this to the C and CXX flags in the makefile

CFLAGS += -miphoneos-version-min=5.0
CXXFLAGS += -miphoneos-version-min=5.0
like image 185
ulcica Avatar answered Jan 21 '26 01:01

ulcica



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!