Hi, I'm trying to build tessract-ocr (latest version) on Mac Ventura for arch arm-64 to link in ios project.
I'm using this script: export DEVROOT=/Applications/Xcode.app/Contents/Developer export SDKROOT= "$DEVROOT/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.2.sdk" export CFLAGS="-I$SDKROOT/usr/include/ -I/desktop/projects/tesseract/include/ -arch arm64 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=10.0 -O2 -fembed-bitcode" export CPPFLAGS=$CFLAGS export CXXFLAGS="-I/desktop/projects/tesseract/arm-apple-darwin64/ -arch arm64 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=10.0 -O2 -Wno-deprecated-register" export LDFLAGS="-L$SDKROOT/usr/lib/" export LIBS="-lz -lpng -ljpeg -ltiff" export LD="$DEVROOT/usr/bin/ld" export CC="$DEVROOT/usr/bin/gcc --target=arm-apple-darwin64" export CXX="$DEVROOT/usr/bin/g++ --target=arm-apple-darwin64" #export CXX="$DEVROOT/usr/bin/clang++ --target=arm-apple-darwin64 export LEPTONICA_LIBS="-llept" export AR= "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar" export RANLIB= "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib" sudo ../configure --host=arm-apple-darwin64 --enable-static=yes --enable-shared=no --disable-graphics --disable-legacy --without-cur # sudo ../configure --target=arm-apple-darwin64 --enable-static=yes --enable-shared=no --disable-graphics --disable-legacy --without-curl The configuration and make are successful, however, when I run *lipo ./.libs/libtesseract.a -info* on the produced file I get: *Non-fat file: ./.libs/libtesseract.a is architecture: x86_64* And linking the library in xcode produces build error: *Ignoring file ./libtesseract.a, building for iOS-arm64 but attempting to link with file built for macOS-x86_64* Undefined symbol: tesseract::TessBaseAPI::GetUTF8Text() Undefined symbol: tesseract::TessBaseAPI::SetVariable(char const*, char const*) Undefined symbol: tesseract::TessBaseAPI::SetPageSegMode(tesseract::PageSegMode) Undefined symbol: 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)Undefined symbol: tesseract::TessBaseAPI::Version() Undefined symbol: tesseract::TessBaseAPI::SetImage(unsigned char const*, int, int, int, int) Undefined symbol: tesseract::TessBaseAPI::TessBaseAPI() Here is the output of configure: configure: WARNING: unrecognized options: --without-cur checking for arm-apple-darwin64-g++... no checking for arm-apple-darwin64-clang++... no checking for g++... g++ checking whether the C++ compiler works... yes checking for C++ compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... ../config/install-sh -c -d checking for gawk... no checking for mawk... no checking for nawk... no checking for awk... awk checking whether make sets $(MAKE)... yes checking whether make supports the include directive... yes (GNU style) checking whether make supports nested variables... yes checking dependency style of g++... gcc3 checking for a sed that does not truncate output... /usr/bin/sed checking Major version... 5 checking Minor version... 3 checking Point version... 1-22-g24da4 checking whether make supports nested variables... (cached) yes checking build system type... x86_64-apple-darwin22.5.0 checking host system type... arm-apple-darwin64 checking whether C++ compiler accepts -Werror=unused-command-line-argument... yes checking whether C++ compiler accepts -mfpu=neon... no checking for feenableexcept... no checking whether C++ compiler accepts -fopenmp-simd... yes checking --enable-float32 argument... checking --enable-graphics argument... no checking --enable-legacy argument... no checking for g++ option to support OpenMP... unsupported checking how to run the C++ preprocessor... g++ -E checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking tiffio.h usability... no checking tiffio.h presence... no checking for tiffio.h... no checking --enable-opencl argument... checking tensorflow/core/framework/graph.pb.h usability... no checking tensorflow/core/framework/graph.pb.h presence... no checking for tensorflow/core/framework/graph.pb.h... no checking if -framework Accelerate works... yes checking if -framework OpenCL works... yes checking --enable-visibility argument... checking whether to use tessdata-prefix... yes checking if compiling with clang... yes checking whether to enable debugging... checking how to print strings... printf checking for arm-apple-darwin64-gcc... no checking for gcc... gcc checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking whether gcc understands -c and -o together... yes checking dependency style of gcc... gcc3 checking for a sed that does not truncate output... (cached) /usr/bin/sed checking for fgrep... /usr/bin/grep -F checking for ld used by gcc... /Users/Tnova/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld checking if the linker (/Users/Tnova/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no checking for BSD- or MS-compatible name lister (nm)... no checking for arm-apple-darwin64-dumpbin... no checking for arm-apple-darwin64-link... no checking for dumpbin... no checking for link... link -dump checking the name lister (nm) interface... BSD nm checking whether ln -s works... yes checking the maximum length of command line arguments... 786432 checking how to convert x86_64-apple-darwin22.5.0 file names to arm-apple-darwin64 format... func_convert_file_noop checking how to convert x86_64-apple-darwin22.5.0 file names to toolchain format... func_convert_file_noop checking for /Users/Tnova/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r checking for arm-apple-darwin64-objdump... no checking for objdump... objdump checking how to recognize dependent libraries... pass_all checking for arm-apple-darwin64-dlltool... no checking for dlltool... no checking how to associate runtime and link libraries... printf %s\n checking for arm-apple-darwin64-ar... no checking for ar... ar checking for archiver @FILE support... no checking for arm-apple-darwin64-strip... no checking for strip... strip checking for arm-apple-darwin64-ranlib... no checking for ranlib... ranlib checking command to parse nm output from gcc object... ok checking for sysroot... no checking for a working dd... /bin/dd checking how to truncate binary pipes... /bin/dd bs=4096 count=1 checking for arm-apple-darwin64-mt... no checking for mt... no checking if : is a manifest tool... no checking for arm-apple-darwin64-dsymutil... no checking for dsymutil... dsymutil checking for arm-apple-darwin64-nmedit... no checking for nmedit... nmedit checking for arm-apple-darwin64-lipo... no checking for lipo... lipo checking for arm-apple-darwin64-otool... no checking for otool... otool checking for arm-apple-darwin64-otool64... no checking for otool64... no checking for -single_module linker flag... yes checking for -exported_symbols_list linker flag... yes checking for -force_load linker flag... yes checking for dlfcn.h... yes checking for objdir... .libs checking if gcc supports -fno-rtti -fno-exceptions... yes checking for gcc option to produce PIC... -fno-common -DPIC checking if gcc PIC flag -fno-common -DPIC works... yes checking if gcc static flag -static works... no checking if gcc supports -c -o file.o... yes checking if gcc supports -c -o file.o... (cached) yes checking whether the gcc linker (/Users/Tnova/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... darwin64 dyld checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... no checking whether to build static libraries... yes checking how to run the C++ preprocessor... g++ -E checking for ld used by g++... /Users/Tnova/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld checking if the linker (/Users/Tnova/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no checking whether the g++ linker (/Users/Tnova/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes checking for g++ option to produce PIC... -fno-common -DPIC checking if g++ PIC flag -fno-common -DPIC works... yes checking if g++ static flag -static works... no checking if g++ supports -c -o file.o... yes checking if g++ supports -c -o file.o... (cached) yes checking whether the g++ linker (/Users/Tnova/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... darwin64 dyld checking how to hardcode library paths into programs... immediate checking whether C++ compiler accepts -std=c++17... yes checking whether C++ compiler accepts -std=c++20... yes checking for library containing pthread_create... none required checking for brew... true checking for asciidoc... false checking for xsltproc... true checking for wchar_t... yes checking for long long int... yes checking for arm-apple-darwin64-pkg-config... no checking for pkg-config... /usr/local/bin/pkg-config checking pkg-config is at least version 0.9.0... yes checking for libcurl... yes checking for lept >= 1.74... yes checking for libarchive... yes checking for icu-uc >= 52.1... yes checking for icu-i18n >= 52.1... yes checking for pango >= 1.38.0... no configure: WARNING: pango 1.38.0 or higher is required, but was not found. configure: WARNING: Training tools WILL NOT be built. configure: WARNING: Try to install libpango1.0-dev package. checking for cairo... no configure: WARNING: Training tools WILL NOT be built because of missing cairo library. configure: WARNING: Try to install libcairo-dev?? package. checking for pangocairo... no checking for pangoft2... no checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating include/tesseract/version.h config.status: creating Makefile config.status: creating tesseract.pc config.status: creating tessdata/Makefile config.status: creating tessdata/configs/Makefile config.status: creating tessdata/tessconfigs/Makefile config.status: creating java/Makefile config.status: creating java/com/Makefile config.status: creating java/com/google/Makefile config.status: creating java/com/google/scrollview/Makefile config.status: creating java/com/google/scrollview/events/Makefile config.status: creating java/com/google/scrollview/ui/Makefile config.status: creating include/config_auto.h config.status: executing depfiles commands config.status: executing libtool commands configure: WARNING: unrecognized options: --without-cur Configuration is done. You can now build and install tesseract by running: $ make $ sudo make install $ sudo ldconfig -- 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/dcdf433a-1332-405e-b97d-b5a2e42ad6d1n%40googlegroups.com.