Repository: opencv
Issue: Undefined symbol: tesseract::TessBaseAPI::GetIterator()
Labels: category: build/install,category: contrib,platform: ios/osx,category: 3rdparty

- OpenCV => 4.6
- Operating System / Platform => macOS 12.4
- Compiler => Apple clang version 13.1.6 (clang-1316.0.21.2.5)

Hi, I got openCV compiled to xcframework using the folloing command
`python platforms/apple/build_xcframework.py --out out/apple/build_xcframework --iphoneos-archs arm64 -iphonesimulator_archs arm64 --macos_archs arm64 --contrib ../opencv_contrib --build_only_specified_archs`

When attempting to add opencv2_xcframework to the "link binary with libraries" phase, of an macOS app, the linker fails with the following errors:

```
Ld /Applications/buildfolder/Debug/FooBar.app/Contents/MacOS/FooBar normal (in target 'FooBar' from project 'FooFooBar')
    cd /Users/yonathan/workspace/FTVBar/FooFooBar
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target arm64-apple-macos12.3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -L/Applications/buildfolder/Debug -F/Applications/buildfolder/Debug -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/appsflyer-ios-sdk -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/avro-ios -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/aws-ios-sdk -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/Foobook-ios-sdk-binaries -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/firebase-ios-sdk/FirebaseAnalytics -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/firebase-ios-sdk/FirebaseCrashlytics -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/firebase-ios-sdk/FirebasePerformance -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/leanplum-ios-sdk-binaries -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/opencv -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/surveymonkey-ios-sdk -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/grdb-binaries -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/joseswift-binaries -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/protobuf -filelist /Applications/buildfolder/FooFooBar.build/Debug/FooBar.build/Objects-normal/arm64/FooBar.LinkFileList -Xlinker -rpath -Xlinker @loader_path/Frameworks -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @executable_path/../Frameworks -Xlinker -object_path_lto -Xlinker /Applications/buildfolder/FooFooBar.build/Debug/FooBar.build/Objects-normal/arm64/FooBar_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -L/usr/lib/swift -Xlinker -add_ast_path -Xlinker /Applications/buildfolder/FooFooBar.build/Debug/FooBar.build/Objects-normal/arm64/FooBar.swiftmodule -ObjC -lc++ -v -framework opencv2 -framework OpenCL -lcompression /Applications/buildfolder/Debug/libLTKit.a -framework CoreGraphics -framework MetalPerformanceShaders -framework Accelerate -framework MetalKit -framework Metal -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Applications/buildfolder/FooFooBar.build/Debug/FooBar.build/Objects-normal/arm64/FooBar_dependency_info.dat -o /Applications/buildfolder/Debug/FooBar.app/Contents/MacOS/FooBar -Xlinker -add_ast_path -Xlinker /Applications/buildfolder/LTKit.build/Debug/LTKit.build/Objects-normal/arm64/LTKit.swiftmodule


Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Target: arm64-apple-macos12.3
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch arm64 -platform_version macos 12.3.0 12.3 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -ObjC -o /Applications/buildfolder/Debug/FooBar.app/Contents/MacOS/FooBar -L/Applications/buildfolder/Debug -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -L/usr/lib/swift -filelist /Applications/buildfolder/FooFooBar.build/Debug/FooBar.build/Objects-normal/arm64/FooBar.LinkFileList -rpath @loader_path/Frameworks -rpath @executable_path/Frameworks -rpath @executable_path/../Frameworks -object_path_lto /Applications/buildfolder/FooFooBar.build/Debug/FooBar.build/Objects-normal/arm64/FooBar_lto.o -export_dynamic -no_deduplicate -add_ast_path /Applications/buildfolder/FooFooBar.build/Debug/FooBar.build/Objects-normal/arm64/FooBar.swiftmodule -lc++ -framework opencv2 -framework OpenCL -lcompression /Applications/buildfolder/Debug/libLTKit.a -framework CoreGraphics -framework MetalPerformanceShaders -framework Accelerate -framework MetalKit -framework Metal -no_adhoc_codesign -dependency_info /Applications/buildfolder/FooFooBar.build/Debug/FooBar.build/Objects-normal/arm64/FooBar_dependency_info.dat -add_ast_path /Applications/buildfolder/LTKit.build/Debug/LTKit.build/Objects-normal/arm64/LTKit.swiftmodule -framework Foundation -lobjc -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/lib/darwin/libclang_rt.osx.a -F/Applications/buildfolder/Debug -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/appsflyer-ios-sdk -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/avro-ios -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/aws-ios-sdk -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/Foobook-ios-sdk-binaries -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/firebase-ios-sdk/FirebaseAnalytics -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/firebase-ios-sdk/FirebaseCrashlytics -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/firebase-ios-sdk/FirebasePerformance -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/leanplum-ios-sdk-binaries -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/opencv -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/surveymonkey-ios-sdk -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/grdb-binaries -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/joseswift-binaries -F/Users/yonathan/workspace/FTVBar/FooFooBar/../Foundations/third_party/protobuf
Undefined symbols for architecture arm64:
  "tesseract::TessBaseAPI::GetIterator()", referenced from:
      cv::text::OCRTesseractImpl::run(cv::Mat&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::vector<cv::Rect_<int>, std::__1::allocator<cv::Rect_<int> > >*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*, std::__1::vector<float, std::__1::allocator<float> >*, int) in opencv2(ocr_tesseract.o)
  "tesseract::TessBaseAPI::GetUTF8Text()", referenced from:
      cv::text::OCRTesseractImpl::run(cv::Mat&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::vector<cv::Rect_<int>, std::__1::allocator<cv::Rect_<int> > >*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*, std::__1::vector<float, std::__1::allocator<float> >*, int) in opencv2(ocr_tesseract.o)
  "tesseract::TessBaseAPI::SetVariable(char const*, char const*)", referenced from:
      cv::text::OCRTesseractImpl::OCRTesseractImpl(char const*, char const*, char const*, int, int) in opencv2(ocr_tesseract.o)
      cv::text::OCRTesseractImpl::setWhiteList(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in opencv2(ocr_tesseract.o)
  "tesseract::TessBaseAPI::SetPageSegMode(tesseract::PageSegMode)", referenced from:
      cv::text::OCRTesseractImpl::OCRTesseractImpl(char const*, char const*, char const*, int, int) in opencv2(ocr_tesseract.o)
  "tesseract::TessBaseAPI::End()", referenced from:
      std::__1::__shared_ptr_emplace<cv::text::OCRTesseractImpl, std::__1::allocator<cv::text::OCRTesseractImpl> >::__on_zero_shared() in opencv2(ocr_tesseract.o)
      cv::text::OCRTesseractImpl::~OCRTesseractImpl() in opencv2(ocr_tesseract.o)
      cv::text::OCRTesseractImpl::~OCRTesseractImpl() in opencv2(ocr_tesseract.o)
  "tesseract::TessBaseAPI::Init(char const*, char const*, tesseract::OcrEngineMode, char**, int, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const*, bool)", referenced from:
      cv::text::OCRTesseractImpl::OCRTesseractImpl(char const*, char const*, char const*, int, int) in opencv2(ocr_tesseract.o)
  "tesseract::TessBaseAPI::Clear()", referenced from:
      cv::text::OCRTesseractImpl::run(cv::Mat&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::vector<cv::Rect_<int>, std::__1::allocator<cv::Rect_<int> > >*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*, std::__1::vector<float, std::__1::allocator<float> >*, int) in opencv2(ocr_tesseract.o)
  "tesseract::TessBaseAPI::SetImage(unsigned char const*, int, int, int, int)", referenced from:
      cv::text::OCRTesseractImpl::run(cv::Mat&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::vector<cv::Rect_<int>, std::__1::allocator<cv::Rect_<int> > >*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*, std::__1::vector<float, std::__1::allocator<float> >*, int) in opencv2(ocr_tesseract.o)
  "tesseract::TessBaseAPI::Recognize(tesseract::ETEXT_DESC*)", referenced from:
      cv::text::OCRTesseractImpl::run(cv::Mat&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::vector<cv::Rect_<int>, std::__1::allocator<cv::Rect_<int> > >*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*, std::__1::vector<float, std::__1::allocator<float> >*, int) in opencv2(ocr_tesseract.o)
  "tesseract::TessBaseAPI::TessBaseAPI()", referenced from:
      cv::text::OCRTesseractImpl::OCRTesseractImpl(char const*, char const*, char const*, int, int) in opencv2(ocr_tesseract.o)
  "tesseract::TessBaseAPI::~TessBaseAPI()", referenced from:
      std::__1::__shared_ptr_emplace<cv::text::OCRTesseractImpl, std::__1::allocator<cv::text::OCRTesseractImpl> >::__on_zero_shared() in opencv2(ocr_tesseract.o)
      cv::text::OCRTesseractImpl::OCRTesseractImpl(char const*, char const*, char const*, int, int) in opencv2(ocr_tesseract.o)
      cv::text::OCRTesseractImpl::~OCRTesseractImpl() in opencv2(ocr_tesseract.o)
      cv::text::OCRTesseractImpl::~OCRTesseractImpl() in opencv2(ocr_tesseract.o)
  "tesseract::PageIterator::BoundingBox(tesseract::PageIteratorLevel, int*, int*, int*, int*) const", referenced from:
      cv::text::OCRTesseractImpl::run(cv::Mat&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::vector<cv::Rect_<int>, std::__1::allocator<cv::Rect_<int> > >*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*, std::__1::vector<float, std::__1::allocator<float> >*, int) in opencv2(ocr_tesseract.o)
  "tesseract::LTRResultIterator::Confidence(tesseract::PageIteratorLevel) const", referenced from:
      cv::text::OCRTesseractImpl::run(cv::Mat&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::vector<cv::Rect_<int>, std::__1::allocator<cv::Rect_<int> > >*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*, std::__1::vector<float, std::__1::allocator<float> >*, int) in opencv2(ocr_tesseract.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```