I've successfully built Tesseract for macOS (x86_64-apple-darwin) when using many versions of Xcode. However, the most recent version (12.5) is giving me issues when building.
I'm using the commit tagged *5.0.0-alpha-20210401 * (bfe1616b4eef525e4fc30405fc41260f40ffee5e) Here's the configure command I'm running (sorry for all the long paths): export LIBS="-lz -lpng -ljpeg -ltiff -lwebp" ; \ export SDKROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk" ; \ export CFLAGS="-I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/macos/x86_64-apple-darwin/include -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/macos/lib -Qunused-arguments -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -mmacosx-version-min="10.13" -O2 -fembed-bitcode" ; \ export CPPFLAGS="-I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/macos/x86_64-apple-darwin/include -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/macos/lib -Qunused-arguments -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -mmacosx-version-min=10.13 -O2 -fembed-bitcode -std=c++11 -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/macos/x86_64-apple-darwin/include/leptonica" ; \ export CXXFLAGS="-I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/macos/x86_64-apple-darwin/include -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/macos/lib -Qunused-arguments -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -mmacosx-version-min="10.13" -O2 -Wno-deprecated-register -std=c++11"; \ export LDFLAGS="-L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/lib/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/macos/x86_64-apple-darwin/src/.libs" ; \ export LIBLEPT_HEADERSDIR=/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/macos/x86_64-apple-darwin/ ; \ export PKG_CONFIG_PATH=/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/macos/x86_64-apple-darwin/ ; \ export CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ ; \ mkdir -p /Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/macos/x86_64-apple-darwin ; \ cd /Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/macos/x86_64-apple-darwin ; \ ln -s /Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/src/ leptonica ; \ ../../configure --host=x86_64-apple-darwin --prefix=`pwd`/output --enable-shared=no --disable-graphics --with-curl=no This all works fine and I try and run the make command to build things and I end up with tons of errors. Here is a sample of them: In file included from ../../src/arch/intsimdmatrixsse.cpp:24: In file included from ../../src/arch/intsimdmatrix.h:24: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/vector:276: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/__bit_reference:14: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/bit:58: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/limits:105: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/type_traits:417: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/cstddef:37: ../../version:1:1: error: expected unqualified-id 5.0.0-alpha-20210401 ^ In file included from ../../src/arch/intsimdmatrixavx2.cpp:24: In file included from ../../src/arch/intsimdmatrix.h:24: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/vector:276: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/__bit_reference:14: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/bit:58: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/limits:105: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/type_traits:417: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/incIn file included from ../../src/arch/intsimdmatrixsse.cpp:24: In file included from ../../src/arch/intsimdmatrix.h:24: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/vector:276: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/__bit_reference:14: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/bit:58: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/limits:105: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/type_traits:418: ../../version:1:1: error: expected unqualified-id 5.0.0-alpha-20210401 ^ lude/c++/v1/cstddef:37: ../../version:1:1: error: expected unqualified-id 5.0.0-alpha-20210401 ^ In file included from ../../include/tesseract/unichar.h:26: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/string:506: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/string_view:175: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/__string:57: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/algorithm:639: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/initializer_list:46: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/cstddef:49:9: error: no member named 'ptrdiff_t' in the global namespace using ::ptrdiff_t; ~~^ In file included from ../../src/api/altorenderer.cpp:20: In file included from ../../include/tesseract/baseapi.h:29: In file included from ../../include/tesseract/resultiterator.h:25: In file included from ../../include/tesseract/ltrresultiterator.h:26: In file included from ../../include/tesseract/unichar.h:26: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/string:506: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/string_view:175: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/__string:57: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/algorithm:643: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/memory:674: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/iterator:562:13: error: unknown type name 'ptrdiff_t' typedef ptrdiff_t difference_type; ^ In file included from ../../src/api/baseapi.cpp:26: In file included from ../../src/ccstruct/boxword.h:22: In file included from ../../src/ccstruct/rect.h:22: In file included from ../../src/ccstruct/points.h:22: In file included from ../../src/ccutil/elst.h:24: In file included from ../../src/ccutil/serialis.h:22: In file included from ../../include/tesseract/baseapi.h:29: In file included from ../../include/tesseract/resultiterator.h:25: In file included from ../../include/tesseract/ltrresultiterator.h:26: In file included from ../../include/tesseract/unichar.h:26: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/string:506: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/string_view:175: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/__string:57: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/algorithm:643: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/memory:674: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/iterator:562:13: error: unknown type name 'ptrdiff_t' typedef ptrdiff_t difference_type; This exact setup works fine if I change the version of Xcode I have active to be 12.4 (the previous version). As far as I can tell the only difference between the two build setups is the value that gets set for SDKROOT. For Xcode 12.5: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk For Xcode 12.4: /Applications/Xcode- 12.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk In terms of differences inside those directories, they look incredibly similar,. apart from the fact that inside the Xcode 12.5 SDK root's /usr/include directory there is a c++/v1 directory that contains a load of C++ headers, listed here: __bit_reference, __tree, clocale, cwctype, istream, regex, system_error, __bsd_locale_defaults.h__tuple, cmath, cxxabi.h, iterator, scoped_allocator, tgmath.h, __bsd_locale_fallbacks.h__undef_macros, codecvt, deque, latch, semaphore, thread, __config, algorithm, compare, errno.h, limits, set, tuple, __cxxabi_config.hany, complex, exception, limits.h, setjmp.h, type_traits, __debug, array, complex.h, execution, list, shared_mutex, typeindex, __errc, atomic, concepts, experimental, locale, span, typeinfo, __functional_03, barrier, condition_variableext, locale.h, sstream, unordered_map, __functional_basebit, csetjmp, fenv.h, map, stack, unordered_set, __functional_base_03bitset, csignal, filesystem, math.h, stdbool.h, utility, __hash_table, cassert, cstdarg, float.h, memory, stddef.h, valarray, __libcpp_version, ccomplex, cstdbool, forward_list, module.modulemapstd, except, variant, __locale, cctype, cstddef, fstream, mutex, stdint.h, vector, __mutex_base, cerrno, cstdint, functional, new, stdio.h, version, __node_handle, cfenv, cstdio, future, numbers, stdlib.h, wchar.h, __nullptr, cfloat, cstdlib, initializer_listnumeric, streambuf, wctype.h, __split_buffer, charconv, cstring, inttypes.h, optional, string, __sso_allocator, chrono, ctgmath, iomanip, ostream, string.h, __std_stream, cinttypes, ctime, ios, queue, string_view, __string, ciso646, ctype.h, iosfwd, random, strstream, __threading_support, climits, cwchar, iostream, ratio, support Has anyone run into errors like this and knows how to fix them? They look like I might be running into a C++ version mismatch or something similar but I've tried editing the Makefile to explicitly set -std=c++11, -std=c++14, -std=c++17, and -std=c++20, and none seem to make things work. Thanks! -- You received this message because you are subscribed to the Google Groups "tesseract-ocr" group. To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-ocr+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/3517dca6-4fa5-4019-b00e-b1af71394157n%40googlegroups.com.