Our application needs a universal build of both the leptonic and tesseract libraries. After trying for days to try and coerce the build tools and methods to cough up a universal (arm64/x86_64) binary, I gave up and built both libraries on an M1 Mac mini and then again on an Intel iMac. after that I copied the x86_64 libs to the M1 and used lipo to manually combine them. I build static libs to link with our document management app because I don't want to create complicated installers that have to worry about checking for and installing dynamic libraries in addition to simply dragging the signed and notarized app to the Applications folder. In any case, building on two different macs that used the two different CPUs I need to support and then combining them was the only way I was able to get this done.
On Thursday, June 22, 2023 at 12:48:27 PM UTC-4 tigr...@gmail.com wrote: > If I run without host but only with this target, the make succeeds, but > when using the library in Xcode iOS framework project, I'm getting > > ld: in /Users/XX/XX/XX/libtesseract.a(libtesseract_la-baseapi.o), building > for iOS, but linking in object file built for macOS, file > '/Users/XX/XX/XX/libtesseract.a' for architecture arm64 > > clang: error: linker command failed with exit code 1 (use -v to see > invocation) > > On Thursday, June 22, 2023 at 7:19:32 PM UTC+3 Maria Vilensky wrote: > >> @zdenop >> >> I've checked all the related posts in the group and it git but no luck >> with solutions... >> I'm now running this on M2 machine, this is the script (I want to get >> arm64 library for iOS, so I understand "host" is required and not only >> target) >> >> export SDKROOT= >> "$DEVROOT/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk" >> export CFLAGS="-arch arm64 -pipe -no-cpp-precomp -isysroot $SDKROOT >> -miphoneos-version-min=10.0 -O2 -fembed-bitcode" >> sudo ../configure --target=arm-apple-darwin64 --host=arm-apple-darwin64 >> --enable-static=yes --enable-shared=no --disable-graphics >> --disable-legacy --without-curl >> >> This is the configure output: >> >> 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 the compiler supports GNU C++... yes >> >> checking whether g++ accepts -g... yes >> checking for g++ option to enable C++11 features... none needed >> >> checking for a BSD-compatible install... /usr/bin/install -c >> checking whether build environment is sane... yes >> checking for a race-free 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... aarch64-apple-darwin22.3.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 for stdio.h... yes >> >> checking for stdlib.h... yes >> checking for string.h... yes >> checking for inttypes.h... yes >> checking for stdint.h... yes >> checking for strings.h... yes >> checking for sys/stat.h... yes >> checking for sys/types.h... yes >> checking for unistd.h... yes >> >> checking for tiffio.h... no >> checking --enable-opencl argument... >> 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 the compiler supports GNU C... yes >> >> checking whether gcc accepts -g... yes >> checking for gcc option to enable C11 features... 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 grep that handles long lines and -e... /usr/bin/grep >> checking for egrep... /usr/bin/grep -E >> checking for fgrep... /usr/bin/grep -F >> checking for ld used by gcc... >> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld >> checking if the linker >> (/Applications/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 aarch64-apple-darwin22.3.0 file names to >> arm-apple-darwin64 format... func_convert_file_noop >> checking how to convert aarch64-apple-darwin22.3.0 file names to >> toolchain format... func_convert_file_noop >> checking for >> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld >> >> option to reload object files... -r >> checking for arm-apple-darwin64-file... no >> checking for file... file >> >> 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 >> (/Applications/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++... >> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld >> checking if the linker >> (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) >> >> is GNU ld... no >> checking whether the g++ linker >> (/Applications/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 >> (/Applications/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... /opt/homebrew/bin/pkg-config >> >> checking pkg-config is at least version 0.9.0... yes >> checking for lept >= 1.74... yes >> checking for libarchive... no >> checking for icu-uc >= 52.1... no >> checking for icu-i18n >= 52.1... no >> configure: WARNING: icu 52.1 or higher is required, but was not found. >> >> configure: WARNING: Training tools WILL NOT be built. >> configure: WARNING: Try to install libicu-dev package. >> >> 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 >> >> Configuration is done. >> You can now build and install tesseract by running: >> >> $ make >> $ sudo make install >> $ sudo ldconfig >> >> >> This is the make output: >> >> sudo make -sj8 >> Making all in . >> CXX src/tesseract-tesseract.o >> CXX src/api/libtesseract_la-baseapi.lo >> CXX src/api/libtesseract_la-altorenderer.lo >> CXX src/api/libtesseract_la-capi.lo >> CXX src/api/libtesseract_la-lstmboxrenderer.lo >> CXX src/api/libtesseract_la-hocrrenderer.lo >> CXX src/api/libtesseract_la-pdfrenderer.lo >> CXX src/api/libtesseract_la-renderer.lo >> CXX src/api/libtesseract_la-wordstrboxrenderer.lo >> CXX src/arch/libtesseract_la-intsimdmatrix.lo >> CXX src/arch/libtesseract_la-simddetect.lo >> CXX src/ccmain/libtesseract_la-applybox.lo >> CXX src/ccmain/libtesseract_la-control.lo >> CXX src/ccmain/libtesseract_la-linerec.lo >> CXX src/ccmain/libtesseract_la-ltrresultiterator.lo >> CXX src/ccmain/libtesseract_la-output.lo >> CXX src/ccmain/libtesseract_la-pageiterator.lo >> CXX src/ccmain/libtesseract_la-pagesegmain.lo >> CXX src/ccmain/libtesseract_la-pagewalk.lo >> CXX src/ccmain/libtesseract_la-paragraphs.lo >> CXX src/ccmain/libtesseract_la-reject.lo >> CXX src/ccmain/libtesseract_la-resultiterator.lo >> CXX src/ccmain/libtesseract_la-tessedit.lo >> CXX src/ccmain/libtesseract_la-tesseractclass.lo >> CXX src/ccmain/libtesseract_la-thresholder.lo >> CXX src/ccmain/libtesseract_la-werdit.lo >> CXX src/ccstruct/libtesseract_la-blamer.lo >> CXX src/ccstruct/libtesseract_la-blobbox.lo >> CXX src/ccstruct/libtesseract_la-blobs.lo >> CXX src/ccstruct/libtesseract_la-blread.lo >> CXX src/ccstruct/libtesseract_la-boxread.lo >> CXX src/ccstruct/libtesseract_la-boxword.lo >> CXX src/ccstruct/libtesseract_la-ccstruct.lo >> CXX src/ccstruct/libtesseract_la-coutln.lo >> CXX src/ccstruct/libtesseract_la-detlinefit.lo >> CXX src/ccstruct/libtesseract_la-image.lo >> CXX src/ccstruct/libtesseract_la-imagedata.lo >> CXX src/ccstruct/libtesseract_la-linlsq.lo >> CXX src/ccstruct/libtesseract_la-matrix.lo >> CXX src/ccstruct/libtesseract_la-mod128.lo >> CXX src/ccstruct/libtesseract_la-normalis.lo >> CXX src/ccstruct/libtesseract_la-ocrblock.lo >> CXX src/ccstruct/libtesseract_la-ocrpara.lo >> CXX src/ccstruct/libtesseract_la-ocrrow.lo >> CXX src/ccstruct/libtesseract_la-otsuthr.lo >> CXX src/ccstruct/libtesseract_la-pageres.lo >> CXX src/ccstruct/libtesseract_la-pdblock.lo >> CXX src/ccstruct/libtesseract_la-points.lo >> CXX src/ccstruct/libtesseract_la-polyaprx.lo >> CXX src/ccstruct/libtesseract_la-polyblk.lo >> CXX src/ccstruct/libtesseract_la-quadlsq.lo >> CXX src/ccstruct/libtesseract_la-quspline.lo >> CXX src/ccstruct/libtesseract_la-ratngs.lo >> CXX src/ccstruct/libtesseract_la-rect.lo >> CXX src/ccstruct/libtesseract_la-seam.lo >> CXX src/ccstruct/libtesseract_la-split.lo >> CXX src/ccstruct/libtesseract_la-statistc.lo >> CXX src/ccstruct/libtesseract_la-stepblob.lo >> CXX src/ccstruct/libtesseract_la-werd.lo >> CXX src/classify/libtesseract_la-classify.lo >> CXX src/dict/libtesseract_la-context.lo >> CXX src/dict/libtesseract_la-dawg.lo >> CXX src/dict/libtesseract_la-dawg_cache.lo >> CXX src/dict/libtesseract_la-dict.lo >> CXX src/dict/libtesseract_la-stopper.lo >> CXX src/dict/libtesseract_la-trie.lo >> CXX src/textord/libtesseract_la-alignedblob.lo >> CXX src/textord/libtesseract_la-baselinedetect.lo >> CXX src/textord/libtesseract_la-bbgrid.lo >> CXX src/textord/libtesseract_la-blkocc.lo >> CXX src/textord/libtesseract_la-blobgrid.lo >> CXX src/textord/libtesseract_la-ccnontextdetect.lo >> CXX src/textord/libtesseract_la-cjkpitch.lo >> CXX src/textord/libtesseract_la-colfind.lo >> CXX src/textord/libtesseract_la-colpartition.lo >> CXX src/textord/libtesseract_la-colpartitionset.lo >> CXX src/textord/libtesseract_la-colpartitiongrid.lo >> CXX src/textord/libtesseract_la-devanagari_processing.lo >> CXX src/textord/libtesseract_la-drawtord.lo >> CXX src/textord/libtesseract_la-edgblob.lo >> CXX src/textord/libtesseract_la-edgloop.lo >> CXX src/textord/libtesseract_la-fpchop.lo >> CXX src/textord/libtesseract_la-gap_map.lo >> CXX src/textord/libtesseract_la-imagefind.lo >> CXX src/textord/libtesseract_la-linefind.lo >> CXX src/textord/libtesseract_la-makerow.lo >> CXX src/textord/libtesseract_la-oldbasel.lo >> CXX src/textord/libtesseract_la-pithsync.lo >> CXX src/textord/libtesseract_la-pitsync1.lo >> CXX src/textord/libtesseract_la-scanedg.lo >> CXX src/textord/libtesseract_la-sortflts.lo >> CXX src/textord/libtesseract_la-strokewidth.lo >> CXX src/textord/libtesseract_la-tabfind.lo >> CXX src/textord/libtesseract_la-tablefind.lo >> CXX src/textord/libtesseract_la-tabvector.lo >> CXX src/textord/libtesseract_la-tablerecog.lo >> CXX src/textord/libtesseract_la-textlineprojection.lo >> CXX src/textord/libtesseract_la-textord.lo >> CXX src/textord/libtesseract_la-topitch.lo >> CXX src/textord/libtesseract_la-tordmain.lo >> CXX src/textord/libtesseract_la-tospace.lo >> CXX src/textord/libtesseract_la-underlin.lo >> CXX src/textord/libtesseract_la-wordseg.lo >> CXX src/textord/libtesseract_la-workingpartset.lo >> CXX src/wordrec/libtesseract_la-tface.lo >> CXX src/wordrec/libtesseract_la-wordrec.lo >> CXX src/ccutil/libtesseract_ccutil_la-ccutil.lo >> CXX src/ccutil/libtesseract_ccutil_la-clst.lo >> CXX src/ccutil/libtesseract_ccutil_la-elst2.lo >> CXX src/ccutil/libtesseract_ccutil_la-elst.lo >> CXX src/ccutil/libtesseract_ccutil_la-serialis.lo >> CXX src/ccutil/libtesseract_ccutil_la-scanutils.lo >> CXX src/ccutil/libtesseract_ccutil_la-tessdatamanager.lo >> CXX src/ccutil/libtesseract_ccutil_la-tprintf.lo >> CXX src/ccutil/libtesseract_ccutil_la-unicharcompress.lo >> CXX src/ccutil/libtesseract_ccutil_la-unicharset.lo >> CXX src/ccutil/libtesseract_ccutil_la-params.lo >> CXX src/lstm/libtesseract_lstm_la-convolve.lo >> CXX src/lstm/libtesseract_lstm_la-fullyconnected.lo >> CXX src/lstm/libtesseract_lstm_la-functions.lo >> CXX src/lstm/libtesseract_lstm_la-input.lo >> CXX src/lstm/libtesseract_lstm_la-lstm.lo >> CXX src/lstm/libtesseract_lstm_la-lstmrecognizer.lo >> CXX src/lstm/libtesseract_lstm_la-maxpool.lo >> CXX src/lstm/libtesseract_lstm_la-network.lo >> CXX src/lstm/libtesseract_lstm_la-networkio.lo >> CXX src/lstm/libtesseract_lstm_la-parallel.lo >> CXX src/lstm/libtesseract_lstm_la-plumbing.lo >> CXX src/lstm/libtesseract_lstm_la-recodebeam.lo >> CXX src/lstm/libtesseract_lstm_la-reconfig.lo >> CXX src/lstm/libtesseract_lstm_la-reversed.lo >> CXX src/lstm/libtesseract_lstm_la-series.lo >> CXX src/lstm/libtesseract_lstm_la-weightmatrix.lo >> CXX src/arch/libtesseract_native_la-dotproduct.lo >> CXXLD libtesseract_ccutil.la >> CXXLD libtesseract_native.la >> >> CXXLD libtesseract_lstm.la >> CXXLD libtesseract.la >> CXXLD tesseract >> >> >> >> >> >> >> >> >> *Undefined symbols for architecture arm64: >> "tesseract::IntSimdMatrix::intSimdMatrixNEON", referenced from: >> tesseract::SIMDDetect::SIMDDetect() in >> libtesseract.a(libtesseract_la-simddetect.o) >> tesseract::SIMDDetect::Update() in >> libtesseract.a(libtesseract_la-simddetect.o) >> "tesseract::DotProductNEON(float const*, float const*, int)", referenced >> from: tesseract::SIMDDetect::SIMDDetect() in >> libtesseract.a(libtesseract_la-simddetect.o) >> tesseract::SIMDDetect::Update() in >> libtesseract.a(libtesseract_la-simddetect.o)ld: symbol(s) not found for >> architecture arm64clang: error: linker command failed with exit code 1 (use >> -v to see invocation)* >> make[1]: *** [tesseract] Error 1 >> make: *** [all-recursive] Error 1 >> >> >> On Tuesday, June 20, 2023 at 9:47:46 PM UTC+3 zdenop wrote: >> >>> Please do not post only the last error - usually, there is a problem >>> before and e,g, configure output could indicate a lot of... >>> >>> Make sure you check the issue tracker where are already some hints on >>> what to check e.g. >>> https://github.com/tesseract-ocr/tesseract/issues/3980 >>> https://github.com/tesseract-ocr/tesseract/issues/3746 >>> https://github.com/tesseract-ocr/tesseract/issues/3286 >>> >>> >>> Zdenko >>> >>> >>> ut 20. 6. 2023 o 15:16 Maria Vilensky <tigr...@gmail.com> napísal(a): >>> >>>> We now tried the same script on M1 based machine, and the error is as >>>> follows: >>>> >>>> CXXLD libtesseract_native.la >>>> CXXLD libtesseract_ccutil.la >>>> CXXLD libtesseract_lstm.la >>>> CXXLD libtesseract.la >>>> CXXLD tesseract >>>> Undefined symbols for architecture arm64: >>>> "tesseract::IntSimdMatrix::intSimdMatrixNEON", referenced from: >>>> tesseract::SIMDDetect::SIMDDetect() in >>>> libtesseract.a(libtesseract_la-simddetect.o) >>>> tesseract::SIMDDetect::Update() in >>>> libtesseract.a(libtesseract_la-simddetect.o) >>>> "tesseract::DotProductNEON(float const*, float const*, int)", >>>> referenced from: >>>> tesseract::SIMDDetect::SIMDDetect() in >>>> libtesseract.a(libtesseract_la-simddetect.o) >>>> tesseract::SIMDDetect::Update() in >>>> libtesseract.a(libtesseract_la-simddetect.o) >>>> ld: symbol(s) not found for architecture arm64 >>>> clang: error: linker command failed with exit code 1 (use -v to see >>>> invocation) >>>> >>>> On Tuesday, June 20, 2023 at 9:39:28 AM UTC+3 Maria Vilensky wrote: >>>> >>>>> Thanks for your reply, after many more googling and build attempts, I >>>>> am not even sure if this is supposed to work - compling arm64 library on >>>>> an >>>>> Intel-based mac? Can anyone who tried this confirm this or give a >>>>> suggestion how to deal with it? >>>>> Thanks! >>>>> >>>>> On Sunday, June 18, 2023 at 5:02:10 PM UTC+3 zdenop wrote: >>>>> >>>>>> Hello, >>>>>> >>>>>> I am not Mac user, but the following output indicates that autotools >>>>>> are not able to use g++ for arm-64: >>>>>> >>>>>> checking for arm-apple-darwin64-g++... no >>>>>> checking for arm-apple-darwin64-clang++... no >>>>>> >>>>>> Also, you try to force linking LIBS="-lz -lpng -ljpeg -ltiff", but >>>>>> configure claims tiffio.h (tiff header file) is not present: >>>>>> checking tiffio.h usability... no >>>>>> checking tiffio.h presence... no >>>>>> checking for tiffio.h... no >>>>>> It does not make sense to me... >>>>>> >>>>>> Also >>>>>> checking for arm-apple-darwin64-pkg-config... no >>>>>> checking for pkg-config... /usr/local/bin/pkg-config >>>>>> IMO you should use pkg-config within $DEVROOT/ tree, right? >>>>>> >>>>>> There is a lot of "checking for arm-apple-darwin64-xyz... no". You >>>>>> need to fix this first. As this is not tesseract specific, try to use >>>>>> some >>>>>> Max arm forum for solving it. >>>>>> >>>>>> Zdenko >>>>>> >>>>>> >>>>>> ne 18. 6. 2023 o 14:07 Maria Vilensky <tigr...@gmail.com> napísal(a): >>>>>> >>>>>>> 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-oc...@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 >>>>>>> >>>>>>> <https://groups.google.com/d/msgid/tesseract-ocr/dcdf433a-1332-405e-b97d-b5a2e42ad6d1n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>>> . >>>>>>> >>>>>> -- >>>> 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-oc...@googlegroups.com. >>>> >>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/tesseract-ocr/31a204ca-695c-4ed0-8393-8ce544a66c4cn%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/tesseract-ocr/31a204ca-695c-4ed0-8393-8ce544a66c4cn%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- 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/7bd6019e-d25e-4b13-b049-c378b488f982n%40googlegroups.com.