Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors building for arm-apple-darwin64 relating to AVX, SSE, and more #2334

Closed
hamchapman opened this issue Mar 17, 2019 · 22 comments
Closed

Comments

@hamchapman
Copy link

hamchapman commented Mar 17, 2019

Environment

  • Tesseract Version: 4.1.0-rc1~100
  • Commit Number: 87d0f71
  • Platform: Building using x86_64-apple-darwin for host target arm-apple-darwin64

Current Behavior:

All commits since d306552 lead to build errors when building for the arm-apple-darwin64 host.

I was able to find the most recent working commit (d306552) by reading up on this issue: #1113

Below is an example of the errors when building with 87d0f71:

Error output
export LIBS="-lz -lpng -ljpeg -ltiff" ; \
  export SDKROOT="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk" ; \
  export CFLAGS="-I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/x86_64-apple-darwin/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch x86_64 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min="10.0" -O2 -fembed-bitcode" ; \
  export CPPFLAGS=$CFLAGS ; \
  export CXXFLAGS="-I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/x86_64-apple-darwin/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch x86_64 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min="10.0" -O2 -Wno-deprecated-register"; \
  export LDFLAGS="-L$SDKROOT/usr/lib/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/x86_64-apple-darwin/src/.libs" ; \
  export LIBLEPT_HEADERSDIR=/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/x86_64-apple-darwin/ ; \
  export PKG_CONFIG_PATH=/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/x86_64-apple-darwin/ ; \
  mkdir -p /Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/x86_64-apple-darwin ; \
  cd /Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/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` --enable-shared=no --disable-graphics
checking for x86_64-apple-darwin-g++... no
checking for x86_64-apple-darwin-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... yes
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/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for x86_64-apple-darwin-strip... no
checking for strip... strip
configure: WARNING: using cross tools not prefixed with host triplet
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
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/local/opt/gnu-sed/libexec/gnubin/sed
checking Major version... 4
checking Minor version... 0
checking Point version... 0
checking build system type... x86_64-apple-darwin18.2.0
checking host system type... x86_64-apple-darwin
checking whether C++ compiler accepts -mavx... yes
checking whether C++ compiler accepts -mavx2... yes
checking whether C++ compiler accepts -msse4.1... yes
checking whether C++ compiler accepts -march=native... yes
checking --enable-graphics argument... no
checking --enable-legacy argument... 
checking --enable-embedded argument... 
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/local/bin/ggrep
checking for egrep... /usr/local/bin/ggrep -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 for OpenCL framework
checking if -framework OpenCL works... no
checking --enable-visibility argument... 
checking whether to use tessdata-prefix... yes
checking whether to enable debugging... 
checking whether byte ordering is bigendian... no
checking how to print strings... printf
checking for x86_64-apple-darwin-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/local/opt/gnu-sed/libexec/gnubin/sed
checking for fgrep... /usr/local/bin/ggrep -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 x86_64-apple-darwin-dumpbin... no
checking for x86_64-apple-darwin-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... 196608
checking how to convert x86_64-apple-darwin18.2.0 file names to x86_64-apple-darwin format... func_convert_file_noop
checking how to convert x86_64-apple-darwin18.2.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 x86_64-apple-darwin-objdump... no
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for x86_64-apple-darwin-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for x86_64-apple-darwin-ar... no
checking for ar... ar
checking for archiver @FILE support... no
checking for x86_64-apple-darwin-strip... strip
checking for x86_64-apple-darwin-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 x86_64-apple-darwin-mt... no
checking for mt... no
checking if : is a manifest tool... no
checking for x86_64-apple-darwin-dsymutil... no
checking for dsymutil... dsymutil
checking for x86_64-apple-darwin-nmedit... no
checking for nmedit... nmedit
checking for x86_64-apple-darwin-lipo... no
checking for lipo... lipo
checking for x86_64-apple-darwin-otool... no
checking for otool... otool
checking for x86_64-apple-darwin-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... darwin 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... darwin dyld
checking how to hardcode library paths into programs... immediate
checking if compiling with clang... yes
checking whether compiler supports C++11... yes
checking for snprintf... yes
checking for library containing sem_init... none required
checking for ANSI C header files... (cached) yes
checking whether time.h and sys/time.h may both be included... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking sys/ipc.h usability... yes
checking sys/ipc.h presence... yes
checking for sys/ipc.h... yes
checking sys/shm.h usability... yes
checking sys/shm.h presence... yes
checking for sys/shm.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking malloc.h usability... no
checking malloc.h presence... no
checking for malloc.h... no
checking for stdbool.h that conforms to C99... no
checking for _Bool... no
checking for asciidoc... false
checking for wchar_t... yes
checking for long long int... yes
checking for off_t... yes
checking for mbstate_t... yes
checking for x86_64-apple-darwin-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 lept >= 1.74... yes
checking for icu-uc >= 52.1... no
checking for icu-i18n >= 52.1... no
checking unicode/uchar.h usability... yes
checking unicode/uchar.h presence... yes
checking for unicode/uchar.h... yes
checking for pango >= 1.22.0... no
configure: WARNING: pango 1.22.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 that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating tesseract.pc
config.status: creating src/api/Makefile
config.status: creating src/api/tess_version.h
config.status: creating src/arch/Makefile
config.status: creating src/ccmain/Makefile
config.status: creating src/opencl/Makefile
config.status: creating src/ccstruct/Makefile
config.status: creating src/ccutil/Makefile
config.status: creating src/classify/Makefile
config.status: creating src/cutil/Makefile
config.status: creating src/dict/Makefile
config.status: creating src/lstm/Makefile
config.status: creating src/textord/Makefile
config.status: creating src/viewer/Makefile
config.status: creating src/wordrec/Makefile
config.status: creating tessdata/Makefile
config.status: creating tessdata/configs/Makefile
config.status: creating tessdata/tessconfigs/Makefile
config.status: creating unittest/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 doc/Makefile
config.status: creating 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

Documentation will not be built because asciidoc is missing.

You can not build training tools because of missing dependency.
Check configure output for details.

cd /Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64 && /Applications/Xcode.app/Contents/Developer/usr/bin/make -sj8 && /Applications/Xcode.app/Contents/Developer/usr/bin/make install
Making all in src/arch
cd ../../../.. && /bin/sh /Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/config/missing automake-1.16 --foreign src/arch/Makefile
cd ../.. && /bin/sh ./config.status src/arch/Makefile depfiles
config.status: creating src/arch/Makefile
config.status: executing depfiles commands
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../../src/arch -I../.. -DNDEBUG -I../../../../src/ccstruct -I../../../../src/ccutil -I../../../../src/viewer -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -fembed-bitcode -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/include/leptonica -O3 -ffast-math -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -Wno-deprecated-register -std=c++11 -MT libtesseract_native_la-dotproduct.lo -MD -MP -MF .deps/libtesseract_native_la-dotproduct.Tpo -c ../../../../src/arch/dotproduct.cpp -o libtesseract_native_la-dotproduct.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../../src/arch -I../.. -DNDEBUG -I../../../../src/ccstruct -I../../../../src/ccutil -I../../../../src/viewer -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -fembed-bitcode -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/include/leptonica -ffast-math -mavx -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -Wno-deprecated-register -std=c++11 -MT libtesseract_avx_la-dotproductavx.lo -MD -MP -MF .deps/libtesseract_avx_la-dotproductavx.Tpo -c ../../../../src/arch/dotproductavx.cpp -o libtesseract_avx_la-dotproductavx.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../../src/arch -I../.. -DNDEBUG -I../../../../src/ccstruct -I../../../../src/ccutil -I../../../../src/viewer -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -fembed-bitcode -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/include/leptonica -ffast-math -msse4.1 -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -Wno-deprecated-register -std=c++11 -MT libtesseract_sse_la-dotproductsse.lo -MD -MP -MF .deps/libtesseract_sse_la-dotproductsse.Tpo -c ../../../../src/arch/dotproductsse.cpp -o libtesseract_sse_la-dotproductsse.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../../src/arch -I../.. -DNDEBUG -I../../../../src/ccstruct -I../../../../src/ccutil -I../../../../src/viewer -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -fembed-bitcode -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/include/leptonica -ffast-math -msse4.1 -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -Wno-deprecated-register -std=c++11 -MT libtesseract_sse_la-intsimdmatrixsse.lo -MD -MP -MF .deps/libtesseract_sse_la-intsimdmatrixsse.Tpo -c ../../../../src/arch/intsimdmatrixsse.cpp -o libtesseract_sse_la-intsimdmatrixsse.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../../src/arch -I../.. -DNDEBUG -I../../../../src/ccstruct -I../../../../src/ccutil -I../../../../src/viewer -DAVX -DAVX2 -DSSE4_1 -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -fembed-bitcode -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/include/leptonica -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -Wno-deprecated-register -std=c++11 -MT libtesseract_arch_la-simddetect.lo -MD -MP -MF .deps/libtesseract_arch_la-simddetect.Tpo -c ../../../../src/arch/simddetect.cpp -o libtesseract_arch_la-simddetect.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../../src/arch -I../.. -DNDEBUG -I../../../../src/ccstruct -I../../../../src/ccutil -I../../../../src/viewer -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -fembed-bitcode -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/include/leptonica -ffast-math -mavx2 -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -Wno-deprecated-register -std=c++11 -MT libtesseract_avx2_la-intsimdmatrixavx2.lo -MD -MP -MF .deps/libtesseract_avx2_la-intsimdmatrixavx2.Tpo -c ../../../../src/arch/intsimdmatrixavx2.cpp -o libtesseract_avx2_la-intsimdmatrixavx2.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../../src/arch -I../.. -DNDEBUG -I../../../../src/ccstruct -I../../../../src/ccutil -I../../../../src/viewer -DAVX -DAVX2 -DSSE4_1 -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -fembed-bitcode -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/include/leptonica -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -Wno-deprecated-register -std=c++11 -MT libtesseract_arch_la-intsimdmatrix.lo -MD -MP -MF .deps/libtesseract_arch_la-intsimdmatrix.Tpo -c ../../../../src/arch/intsimdmatrix.cpp -o libtesseract_arch_la-intsimdmatrix.o
libtool: link: ar cru .libs/libtesseract_avx.a libtesseract_avx_la-dotproductavx.o
libtool: link: ar cru .libs/libtesseract_native.a libtesseract_native_la-dotproduct.o
libtool: link: ranlib .libs/libtesseract_avx.a
libtool: link: ranlib .libs/libtesseract_native.a
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: warning for library: .libs/libtesseract_avx.a the table of contents is empty (no object file members in the library define global symbols)
libtool: link: ( cd ".libs" && rm -f "libtesseract_avx.la" && ln -s "../libtesseract_avx.la" "libtesseract_avx.la" )
libtool: link: ( cd ".libs" && rm -f "libtesseract_native.la" && ln -s "../libtesseract_native.la" "libtesseract_native.la" )
In file included from ../../../../src/arch/simddetect.cpp:26:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/cpuid.h:25:2: error: this header is for x86 only
#error this header is for x86 only
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/cpuid.h:271:5: error: invalid output constraint '=a' in asm
__cpuid(__leaf, __eax, __ebx, __ecx, __edx);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/cpuid.h:236:11: note: expanded from macro '__cpuid'
: "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/cpuid.h:286:5: error: invalid output constraint '=a' in asm
__cpuid(__leaf, *__eax, *__ebx, *__ecx, *__edx);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/cpuid.h:236:11: note: expanded from macro '__cpuid'
: "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/cpuid.h:300:5: error: invalid output constraint '=a' in asm
__cpuid_count(__leaf, __subleaf, *__eax, *__ebx, *__ecx, *__edx);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/cpuid.h:243:11: note: expanded from macro '__cpuid_count'
: "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx)
^
../../../../src/arch/simddetect.cpp:92:7: error: invalid output constraint '=a' in asm
__cpuid_count(7, 0, eax, ebx, ecx, edx);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/cpuid.h:243:11: note: expanded from macro '__cpuid_count'
: "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx)
^
5 errors generated.
make[5]: *** [libtesseract_arch_la-simddetect.lo] Error 1
make[5]: *** Waiting for unfinished jobs....
libtool: link: ar cru .libs/libtesseract_sse.a libtesseract_sse_la-dotproductsse.o libtesseract_sse_la-intsimdmatrixsse.o
libtool: link: ar cru .libs/libtesseract_avx2.a libtesseract_avx2_la-intsimdmatrixavx2.o
libtool: link: ranlib .libs/libtesseract_sse.a
libtool: link: ranlib .libs/libtesseract_avx2.a
libtool: link: ( cd ".libs" && rm -f "libtesseract_sse.la" && ln -s "../libtesseract_sse.la" "libtesseract_sse.la" )
libtool: link: ( cd ".libs" && rm -f "libtesseract_avx2.la" && ln -s "../libtesseract_avx2.la" "libtesseract_avx2.la" )

This problem is still present with the most recent commits on master, and I wrote up a StackOverflow question about that here: https://stackoverflow.com/questions/55189214/unable-to-build-library-for-ios-arm-because-sse-avx-etc-flags-get-set-by-con

Expected Behavior:

It builds successfully for arm-apple-darwin64.

Suggested Fix:

Revert changes made to build process that relate to the various things that appear in the build errors shown above and in the linked-to StackOverflow question, e.g. SSE, AVX, simddetect, etc

@stweil
Copy link
Contributor

stweil commented Mar 17, 2019

Your build protocol shows that you are using the native compiler g++ which generates Intel code and supports AVX, AVX2 and SSE4.1:

checking for g++... g++
checking whether the C++ compiler works... yes
checking whether C++ compiler accepts -mavx... yes
checking whether C++ compiler accepts -mavx2... yes
checking whether C++ compiler accepts -msse4.1... yes

That's normal as you configured --host=x86_64-apple-darwin. So you are simply using the wrong compiler for the desired target arm-apple-darwin64. Try --host=arm-apple-darwin.

@Bleach665
Copy link

Same build error received on cross-compilation for android. I use ndk15 toolchain in Xubuntu host.
Error received:

expand make output
/home/bleach/Lib/tesseract/source/src/arch/dotproductavx.cpp:20:2: error: Implementation only for AVX capable architectures
#error Implementation only for AVX capable architectures
 ^
In file included from /home/bleach/Lib/tesseract/source/src/arch/dotproductavx.cpp:23:
In file included from /home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/immintrin.h:28:
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:47:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean
      '__builtin_isless'?
    __builtin_ia32_emms();
    ^
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:47:5: note: '__builtin_isless' declared here
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:47:25: error: too few arguments to function call, expected 2, have 0
    __builtin_ia32_emms();
                        ^
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:64:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
                  ^
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:81:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
    return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
           ^
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:143:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:173:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
    return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
                  ^
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:203:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
    return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:230:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
    return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:253:19: error: use of undeclared identifier '__builtin_ia32_punpckhwd'
    return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:274:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
    return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
                  ^
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:301:19: error: use of undeclared identifier '__builtin_ia32_punpcklbw'
    return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:324:19: error: use of undeclared identifier '__builtin_ia32_punpcklwd'
    return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:345:19: error: use of undeclared identifier '__builtin_ia32_punpckldq'
    return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
                  ^
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:366:19: error: use of undeclared identifier '__builtin_ia32_paddb'; did you mean
      '__builtin_arm_qadd'?
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:366:19: note: '__builtin_arm_qadd' declared here
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:366:40: error: cannot initialize a parameter of type 'int' with an rvalue of type
      '__v8qi' (vector of 8 'char' values)
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                                       ^~~~~~~~~~~~
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:387:19: error: use of undeclared identifier '__builtin_ia32_paddw'; did you mean
      '__builtin_arm_qadd'?
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                  ^
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:366:19: note: '__builtin_arm_qadd' declared here
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:387:40: error: cannot initialize a parameter of type 'int' with an rvalue of type
      '__v4hi' (vector of 4 'short' values)
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                                       ^~~~~~~~~~~~
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:408:19: error: use of undeclared identifier '__builtin_ia32_paddd'; did you mean
      '__builtin_arm_qadd'?
    return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
                  ^
/home/bleach/Lib/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/mmintrin.h:366:19: note: '__builtin_arm_qadd' declared here
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
CMakeFiles/libtesseract.dir/build.make:86: recipe for target 'CMakeFiles/libtesseract.dir/src/arch/dotproductavx.cpp.o' failed
make[2]: *** [CMakeFiles/libtesseract.dir/src/arch/dotproductavx.cpp.o] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/libtesseract.dir/all' failed
make[1]: *** [CMakeFiles/libtesseract.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

Please advise how to quickly remove AVX(2) support from the code or Cmake config. I tried

my changes
index ef5d1b47..3afc4275 100644
@@ -117,14 +117,14 @@ AM_CONDITIONAL([AVX2_OPT], false)
 AM_CONDITIONAL([SSE41_OPT], false)
 AM_CONDITIONAL([MARCH_NATIVE_OPT], false)
 
-AX_CHECK_COMPILE_FLAG([-mavx], [avx=true], [avx=false])
+AX_CHECK_COMPILE_FLAG([-mavx], [avx=false], [avx=false])
 if $avx; then
-    AM_CONDITIONAL([AVX_OPT], true)
+    AM_CONDITIONAL([AVX_OPT], false)
 fi
 
-AX_CHECK_COMPILE_FLAG([-mavx2], [avx2=true], [avx2=false])
+AX_CHECK_COMPILE_FLAG([-mavx2], [avx2=false], [avx2=false])
 if $avx2; then
-    AM_CONDITIONAL([AVX2_OPT], true)
+    AM_CONDITIONAL([AVX2_OPT], false)
 fi
 
 AX_CHECK_COMPILE_FLAG([-msse4.1], [sse41=true], [sse41=false])

---------------------------- src/arch/simddetect.h ----------------------------
index def66896..c137e118 100644
@@ -31,12 +31,12 @@ extern DotProductFunction DotProduct;
 class SIMDDetect {
  public:
   // Returns true if AVX is available on this system.
-  static inline bool IsAVXAvailable() { return detector.avx_available_; }
+  static inline bool IsAVXAvailable() { return false; }
   // Returns true if AVX2 (integer support) is available on this system.
-  static inline bool IsAVX2Available() { return detector.avx2_available_; }
+  static inline bool IsAVX2Available() { return false; }
   // Returns true if AVX512 Foundation (float) is available on this system.
   static inline bool IsAVX512FAvailable() {
-    return detector.avx512F_available_;
+    return false;
   }
   // Returns true if AVX512 integer is available on this system.
   static inline bool IsAVX512BWAvailable() {
, but it did not help. Thanks.

@zdenop
Copy link
Contributor

zdenop commented Mar 18, 2019

@Bleach665 : please do not hijack issue: your problem is different than original reporter (e.g. different compiling tools): create new issue including information how you run configuration, co we can try to reproduce it.

@hamchapman
Copy link
Author

@stweil sorry that was a copy-paste error on my part. Here's my output when actually trying to build for arm-apple-darwin64

Build output
export LIBS="-lz -lpng -ljpeg -ltiff" ; \
export SDKROOT="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk" ; \
export CFLAGS="-I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min="10.0" -O2 -fembed-bitcode" ; \
export CPPFLAGS=$CFLAGS ; \
export CXXFLAGS="-I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min="10.0" -O2 -Wno-deprecated-register"; \
export LDFLAGS="-L$SDKROOT/usr/lib/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/src/.libs" ; \
export LIBLEPT_HEADERSDIR=/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ ; \
export PKG_CONFIG_PATH=/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/ ; \
mkdir -p /Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64 ; \
cd /Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64 ; \
ln -s /Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/src/ leptonica ; \
../../configure --host=arm-apple-darwin64 --prefix=`pwd` --enable-shared=no --disable-graphics

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... yes
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/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for arm-apple-darwin64-strip... no
checking for strip... strip
configure: WARNING: using cross tools not prefixed with host triplet
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
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/local/opt/gnu-sed/libexec/gnubin/sed
checking Major version... 4
checking Minor version... 1
checking Point version... 0-rc1
checking build system type... x86_64-apple-darwin18.2.0
checking host system type... arm-apple-darwin64
checking whether C++ compiler accepts -mavx... yes
checking whether C++ compiler accepts -mavx2... yes
checking whether C++ compiler accepts -msse4.1... yes
checking whether C++ compiler accepts -march=native... no
checking --enable-graphics argument... no
checking --enable-legacy argument...
checking --enable-embedded argument...
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/local/bin/ggrep
checking for egrep... /usr/local/bin/ggrep -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 for OpenCL framework
checking if -framework OpenCL works... no
checking --enable-visibility argument...
checking whether to use tessdata-prefix... yes
checking whether to enable debugging...
checking whether byte ordering is bigendian... no
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/local/opt/gnu-sed/libexec/gnubin/sed
checking for fgrep... /usr/local/bin/ggrep -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... 196608
checking how to convert x86_64-apple-darwin18.2.0 file names to arm-apple-darwin64 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin18.2.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-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... 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 if compiling with clang... yes
checking whether C++ compiler accepts -std=c++11... yes
checking whether C++ compiler accepts -std=c++14... yes
checking for library containing sem_init... none required
checking for ANSI C header files... (cached) yes
checking whether time.h and sys/time.h may both be included... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking sys/ipc.h usability... yes
checking sys/ipc.h presence... yes
checking for sys/ipc.h... yes
checking sys/shm.h usability... yes
checking sys/shm.h presence... yes
checking for sys/shm.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking malloc.h usability... no
checking malloc.h presence... no
checking for malloc.h... no
checking for stdbool.h that conforms to C99... no
checking for _Bool... no
checking for asciidoc... false
checking for xsltproc... true
checking for wchar_t... yes
checking for long long int... yes
checking for off_t... yes
checking for mbstate_t... 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 lept >= 1.74... yes
checking for libarchive... no
checking for icu-uc >= 52.1... no
checking for icu-i18n >= 52.1... no
checking for pango >= 1.22.0... no
configure: WARNING: pango 1.22.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 that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating tesseract.pc
config.status: creating src/api/Makefile
config.status: creating src/api/tess_version.h
config.status: creating src/arch/Makefile
config.status: creating src/ccmain/Makefile
config.status: creating src/opencl/Makefile
config.status: creating src/ccstruct/Makefile
config.status: creating src/ccutil/Makefile
config.status: creating src/classify/Makefile
config.status: creating src/cutil/Makefile
config.status: creating src/dict/Makefile
config.status: creating src/lstm/Makefile
config.status: creating src/textord/Makefile
config.status: creating src/viewer/Makefile
config.status: creating src/wordrec/Makefile
config.status: creating tessdata/Makefile
config.status: creating tessdata/configs/Makefile
config.status: creating tessdata/tessconfigs/Makefile
config.status: creating unittest/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 doc/Makefile
config.status: creating 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

Documentation will not be built because asciidoc or xsltproc is missing.

You can not build training tools because of missing dependency.
Check configure output for details.

cd /Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64 && /Applications/Xcode.app/Contents/Developer/usr/bin/make -sj8 && /Applications/Xcode.app/Contents/Developer/usr/bin/make install
Making all in src/arch
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../../src/arch -I../.. -DNDEBUG -I../../../../src/ccstruct -I../../../../src/ccutil -I../../../../src/viewer -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -fembed-bitcode -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/include/leptonica -msse4.1 -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -Wno-deprecated-register -std=c++14 -MT libtesseract_sse_la-intsimdmatrixsse.lo -MD -MP -MF .deps/libtesseract_sse_la-intsimdmatrixsse.Tpo -c ../../../../src/arch/intsimdmatrixsse.cpp -o libtesseract_sse_la-intsimdmatrixsse.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../../src/arch -I../.. -DNDEBUG -I../../../../src/ccstruct -I../../../../src/ccutil -I../../../../src/viewer -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -fembed-bitcode -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/include/leptonica -mavx2 -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -Wno-deprecated-register -std=c++14 -MT libtesseract_avx2_la-intsimdmatrixavx2.lo -MD -MP -MF .deps/libtesseract_avx2_la-intsimdmatrixavx2.Tpo -c ../../../../src/arch/intsimdmatrixavx2.cpp -o libtesseract_avx2_la-intsimdmatrixavx2.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../../src/arch -I../.. -DNDEBUG -I../../../../src/ccstruct -I../../../../src/ccutil -I../../../../src/viewer -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -fembed-bitcode -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/include/leptonica -msse4.1 -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -Wno-deprecated-register -std=c++14 -MT libtesseract_sse_la-dotproductsse.lo -MD -MP -MF .deps/libtesseract_sse_la-dotproductsse.Tpo -c ../../../../src/arch/dotproductsse.cpp -o libtesseract_sse_la-dotproductsse.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../../src/arch -I../.. -DNDEBUG -I../../../../src/ccstruct -I../../../../src/ccutil -I../../../../src/viewer -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -fembed-bitcode -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/include/leptonica -mavx -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -Wno-deprecated-register -std=c++14 -MT libtesseract_avx_la-dotproductavx.lo -MD -MP -MF .deps/libtesseract_avx_la-dotproductavx.Tpo -c ../../../../src/arch/dotproductavx.cpp -o libtesseract_avx_la-dotproductavx.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../../src/arch -I../.. -DNDEBUG -I../../../../src/ccstruct -I../../../../src/ccutil -I../../../../src/viewer -DAVX -DAVX2 -DSSE4_1 -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -fembed-bitcode -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/include/leptonica -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -Wno-deprecated-register -std=c++14 -MT libtesseract_arch_la-intsimdmatrix.lo -MD -MP -MF .deps/libtesseract_arch_la-intsimdmatrix.Tpo -c ../../../../src/arch/intsimdmatrix.cpp -o libtesseract_arch_la-intsimdmatrix.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../../src/arch -I../.. -DNDEBUG -I../../../../src/ccstruct -I../../../../src/ccutil -I../../../../src/viewer -DAVX -DAVX2 -DSSE4_1 -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -fembed-bitcode -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/include/leptonica -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -Wno-deprecated-register -std=c++14 -MT libtesseract_arch_la-simddetect.lo -MD -MP -MF .deps/libtesseract_arch_la-simddetect.Tpo -c ../../../../src/arch/simddetect.cpp -o libtesseract_arch_la-simddetect.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../../src/arch -I../.. -DNDEBUG -I../../../../src/ccstruct -I../../../../src/ccutil -I../../../../src/viewer -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -fembed-bitcode -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/include/leptonica -O3 -ffast-math -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -Wno-deprecated-register -std=c++14 -MT libtesseract_native_la-dotproduct.lo -MD -MP -MF .deps/libtesseract_native_la-dotproduct.Tpo -c ../../../../src/arch/dotproduct.cpp -o libtesseract_native_la-dotproduct.o
../../../../src/arch/intsimdmatrixsse.cpp:19:2: error: Implementation../../../../src/arch/intsimdmatrixavx2.cpp :only for20 :SSE2 :4.1 capable errorarchitectures:
Implementation only for AVX2 capable architectures
#error Implementation only for SSE 4.1 capable architectures
^
#error Implementation only for AVX2 capable architectures
^
../../../../src/arch/dotproductavx.cpp:20:2: error: Implementation only for AVX capable architectures
#error Implementation only for AVX capable architectures
^
../../../../src/arch/dotproductsse.cpp:19:2: error: Implementation only for SSE 4.1 capable architectures
#error Implementation only for SSE 4.1 capable architectures
^
In file included from ../../../../src/arch/dotproductavx.cpp:23:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/immintrin.h:28:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
__builtin_ia32_emms();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:5: note: '__builtin_isless' declared here
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:25: error: too few arguments to function call, expected 2, have 0
__builtin_ia32_emms();
^
In file included from ../../../../src/arch/dotproductsse.cpp:22:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/emmintrin.h:27:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/xmmintrin.h:27:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
__builtin_ia32_emms();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:5: note: '__builtin_isless' declared here
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:25: error: too few arguments to function call, expected 2, have 0
__builtin_ia32_emms();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:64:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:64:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:81:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:81:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:143:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:143:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:173:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:173:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:203:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:203:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:230:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:230:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:253:19:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h :253:error19: : use errorof: undeclared useidentifier of'__builtin_ia32_punpckhwd' undeclared
identifier '__builtin_ia32_punpckhwd'
return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
^
return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:274:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:274:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:301:19: error: use of undeclared identifier '__builtin_ia32_punpcklbw'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:301:19: error: use of undeclared return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
identifier ^'__builtin_ia32_punpcklbw'

return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
              ^

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:324:19: error: use of undeclared identifier '__builtin_ia32_punpcklwd'
return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:324:19: error: use of undeclared identifier '__builtin_ia32_punpcklwd'
return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:345:19: error: use of undeclared identifier '__builtin_ia32_punpckldq'
return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:345:19: error: use of undeclared identifier '__builtin_ia32_punpckldq'
return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:366:19: error: use of undeclared identifier '__builtin_ia32_paddb'
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:366:19: error: use of undeclared identifier '__builtin_ia32_paddb'
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:387:19: error: use of undeclared identifier '__builtin_ia32_paddw'
return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:387:19: error: use of undeclared identifier '__builtin_ia32_paddw'
return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:408:19: error: use of undeclared identifier '__builtin_ia32_paddd'
return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:408:19: error: use of undeclared identifier '__builtin_ia32_paddd'
return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:430:19: error: use of undeclared identifier '__builtin_ia32_paddsb'
return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:430:19: error: use of undeclared identifier '__builtin_ia32_paddsb'
return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:453:19: error: use of undeclared identifier '__builtin_ia32_paddsw'
return (__m64)__builtin_ia32_paddsw((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:453:19: error: use of undeclared identifier '__builtin_ia32_paddsw'
return (__m64)__builtin_ia32_paddsw((__v4hi)__m1, (__v4hi)__m2);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[5]: *** [libtesseract_sse_la-dotproductsse.lo] Error 1
make[5]: *** Waiting for unfinished jobs....
In file included from ../../../../src/arch/intsimdmatrixsse.cpp:25:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/emmintrin.h:27:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/xmmintrin.h:27:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
__builtin_ia32_emms();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:5: note: '__builtin_isless' declared here
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:25: error: too few arguments to function call, expected 2, have 0
__builtin_ia32_emms();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:64:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
^
In file included from ../../../../src/arch/intsimdmatrixavx2.cpp:25:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/immintrin.h:28:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
__builtin_ia32_emms();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:5: note: '__builtin_isless' declared here
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:25: error: too few arguments to function call, expected 2, have 0
__builtin_ia32_emms();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:81:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:64:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:143:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:81:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:173:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:143:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:173:19: error: use of undeclared identifier '__builtin_ia32_packssdw'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:
203:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
^
return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:203:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:230:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:230:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:253:19: error: use of undeclared identifier '__builtin_ia32_punpckhwd'
return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:253:19: error: use of undeclared identifier '__builtin_ia32_punpckhwd'
return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:274:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:274:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:301:19: error: use of undeclared identifier '__builtin_ia32_punpcklbw'
return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:324:19: error: use of undeclared identifier '__builtin_ia32_punpcklwd'
return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:301:19: error: use of undeclared identifier '__builtin_ia32_punpcklbw'
return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:345:19: error: use of undeclared identifier '__builtin_ia32_punpckldq'
return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
^
20 errors generated.
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:324:19: error: use of undeclared identifier '__builtin_ia32_punpcklwd'
return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:366:19: error: use of undeclared identifier '__builtin_ia32_paddb'
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:345:19: error: use of undeclared identifier '__builtin_ia32_punpckldq'
return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:387:19: error: use of undeclared identifier '__builtin_ia32_paddw'
return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:366:19: error: use of undeclared identifier '__builtin_ia32_paddb'
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:408:19: error: use of undeclared identifier '__builtin_ia32_paddd'
return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
^
make[5]: *** [libtesseract_avx_la-dotproductavx.lo] Error 1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:430:19: error: use of undeclared identifier '__builtin_ia32_paddsb'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:387:19: error: use of undeclared return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2);
identifier ^'__builtin_ia32_paddw'

return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
              ^

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:408:19: error: use of undeclared identifier '__builtin_ia32_paddd'
return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:453:19: error: use of undeclared identifier '__builtin_ia32_paddsw'
return (__m64)__builtin_ia32_paddsw((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:430:19: error: use of undeclared identifier '__builtin_ia32_paddsb'
return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:453:19: error: use of undeclared identifier '__builtin_ia32_paddsw'
return (__m64)__builtin_ia32_paddsw((__v4hi)__m1, (__v4hi)__m2);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[5]: *** [libtesseract_sse_la-intsimdmatrixsse.lo] Error 1
libtool: link: ar cru .libs/libtesseract_native.a libtesseract_native_la-dotproduct.o
libtool: link: ranlib .libs/libtesseract_native.a
libtool: link: ( cd ".libs" && rm -f "libtesseract_native.la" && ln -s "../libtesseract_native.la" "libtesseract_native.la" )
In file included from ../../../../src/arch/simddetect.cpp:32:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/cpuid.h:25:2: error: this header is for x86 only
#error this header is for x86 only
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/cpuid.h:271:5: error: invalid output constraint '=a' in asm
__cpuid(__leaf, __eax, __ebx, __ecx, __edx);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/cpuid.h:236:11: note: expanded from macro '__cpuid'
: "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/cpuid.h:286:5: error: invalid output constraint '=a' in asm
__cpuid(__leaf, *__eax, *__ebx, *__ecx, *__edx);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/cpuid.h:236:11: note: expanded from macro '__cpuid'
: "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/cpuid.h:300:5: error: invalid output constraint '=a' in asm
__cpuid_count(__leaf, __subleaf, *__eax, *__ebx, *__ecx, *__edx);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/cpuid.h:243:11: note: expanded from macro '__cpuid_count'
: "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx)
^
../../../../src/arch/simddetect.cpp:101:7: error: invalid output constraint '=a' in asm
__cpuid_count(7, 0, eax, ebx, ecx, edx);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/cpuid.h:243:11: note: expanded from macro '__cpuid_count'
: "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx)
^
5 errors generated.
20 errors generated.
make[5]: *** [libtesseract_arch_la-simddetect.lo] Error 1
make[5]: *** [libtesseract_avx2_la-intsimdmatrixavx2.lo] Error 1
make[4]: *** [all-recursive] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2

@stweil
Copy link
Contributor

stweil commented Mar 20, 2019

The build did not find an ARM compiler and used the native compiler for Intel:

`configure: WARNING: using cross tools not prefixed with host triplet

So that result was to be expected.

@hamchapman
Copy link
Author

hamchapman commented Mar 20, 2019

Hmmm, I'm not sure how to get an ARM-specific compiler, at least not based on the output of these commands:

$ xcrun -sdk iphoneos -find g++
/Applications/Xcode.app/Contents/Developer/usr/bin/g++

$ xcrun -sdk iphoneos -find clang
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang


$ xcrun -sdk iphonesimulator -find g++
/Applications/Xcode.app/Contents/Developer/usr/bin/g++

$ xcrun -sdk iphonesimulator -find clang
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang

You can see that the same output is provided when passing either iphoneos (arm-apple-darwin64) or iphonesimulator (x86_64-apple-darwin), so I'm not sure how to get an ARM-specific compiler.

Furthermore, as noted in the original issue description, my current setup seemed to be working without issue before the code changes in the commit I mentioned. So compilation has worked in the past, and now either I need to change what I'm doing to get it building again, or tesseract is making some assumptions that don't work for building for iOS.

Any insights you've got are much appreciated!

@hamchapman
Copy link
Author

I think this boils down to the AX_CHECK_COMPILE_FLAG checks in configure.ac not being able to correctly work out whether or not AVX, SSE etc are supported.

If I run a command to list the macros defined when using the g++ compiler (described above) with a target of x86_64-apple-darwin64, it gives the following output:

$ /Applications/Xcode.app/Contents/Developer/usr/bin/g++ --target=x86_64-apple-darwin64 -mavx2 -dM -E - < /dev/null | egrep "SSE|AVX" | sort

#define __AVX2__ 1
#define __AVX__ 1
#define __SSE2_MATH__ 1
#define __SSE2__ 1
#define __SSE3__ 1
#define __SSE4_1__ 1
#define __SSE4_2__ 1
#define __SSE_MATH__ 1
#define __SSE__ 1
#define __SSSE3__ 1

If I run the same command but for the arm-apple-darwin64 target, I get no output other than a warning about the -mavx2 flag being unused in compilation:

$ /Applications/Xcode.app/Contents/Developer/usr/bin/g++ --target=arm-apple-darwin64 -mavx2 -dM -E - < /dev/null | egrep "SSE|AVX" | sort

clang: warning: argument unused during compilation: '-mavx2' [-Wunused-command-line-argument]

With a program like this (which is similar to what configure is doing, as far as I can tell):

int
main ()
{

  ;
  return 0;
}

when using the compiler to try and compile for x86_64-apple-darwin I can successfully run:

/Applications/Xcode.app/Contents/Developer/usr/bin/g++ --target=x86_64-apple-darwin64 -mavx2 test.cpp

and a.out is output.

Similarly, when compiling for arm-apple-darwin64 with:

/Applications/Xcode.app/Contents/Developer/usr/bin/g++ --target=arm-apple-darwin64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk -arch arm64 -mavx2 test.cpp

a.out is again successfully generated but again there's a clang warning output:

clang: warning: argument unused during compilation: '-mavx2' [-Wunused-command-line-argument]

So the only indication that things won't work is the warning, but I don't believe that configure is taking that into consideration.

All of this combined makes me think that the way that compiler flags are being tested for isn't appropriate for building for (at least) arm-apple-darwin64.

@Shreeshrii
Copy link
Collaborator

Shreeshrii commented Mar 27, 2019 via email

@hamchapman
Copy link
Author

That definitely looks promising! I'll be able to try it out later today and will report back here with the results.

Thanks for the info!

@stweil
Copy link
Contributor

stweil commented Mar 27, 2019

g++ on macOS is by default not the GNU compiler but clang, so I think that the latest code from Git master will work and detect the right compiler options.

@hamchapman
Copy link
Author

I kicked off a build in the background and it still seems to running into the same issue.

I'm using 4ccbb9f and this is the (familiar) output I got just a moment ago:

export LIBS="-lz -lpng -ljpeg -ltiff" ; \
export SDKROOT="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk" ; \
export CFLAGS="-I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min="10.0" -O2 -fembed-bitcode" ; \
export CPPFLAGS=$CFLAGS ; \
export CXXFLAGS="-I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min="10.0" -O2 -Wno-deprecated-register"; \
export LDFLAGS="-L$SDKROOT/usr/lib/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/src/.libs" ; \
export LIBLEPT_HEADERSDIR=/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ ; \
export PKG_CONFIG_PATH=/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/ ; \
./configure --host=arm-apple-darwin64 --prefix=`pwd` --enable-shared=no --disable-graphics
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... yes
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/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for arm-apple-darwin64-strip... no
checking for strip... strip
configure: WARNING: using cross tools not prefixed with host triplet
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
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/local/opt/gnu-sed/libexec/gnubin/sed
checking Major version... 4
checking Minor version... 1
checking Point version... 0-rc1
checking build system type... x86_64-apple-darwin18.5.0
checking host system type... arm-apple-darwin64
checking whether C++ compiler accepts -mavx... yes
checking whether C++ compiler accepts -mavx2... yes
checking whether C++ compiler accepts -msse4.1... yes
checking whether C++ compiler accepts -march=native... no
...
Implementation only for AVX2 capable architectures
#error Implementation only for AVX capable architectures
#error Implementation only for SSE 4.1 capable architectures
#error Implementation only for SSE 4.1 capable architectures
#error Implementation only for AVX2 capable architectures
...

@Shreeshrii
Copy link
Collaborator

@stweil Would adding Werror to check for configure: WARNING: using cross tools not prefixed with host triplet help?

@stweil
Copy link
Contributor

stweil commented Mar 27, 2019

Yes and no. The build process would then fail earlier.

@hamchapman, I am afraid that the cross tools needed for ARM builds are missing in your installation. configure tries a build using g++. What is the output from g++ --version? If that is a compiler for Intel, it will never build for ARM, and the failures which you see are normal.

@stweil
Copy link
Contributor

stweil commented Mar 27, 2019

@hamchapman, you can also look how Leptonica was built. If it also was compiled using gcc or g++, then I expect that the resulting .o files and libraries are for Intel architecture (not for ARM), too. Please check that using the file command.

@hamchapman
Copy link
Author

Here's the output of g++ --version:

$ `xcrun -sdk iphoneos -find g++` --version

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.3)
Target: x86_64-apple-darwin18.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

and if you pass --target=arm-apple-darwin64 you get:

$ `xcrun -sdk iphoneos -find g++` --target=arm-apple-darwin64 --version

Apple LLVM version 10.0.1 (clang-1001.0.46.3)
Target: arm-apple-darwin64
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Running file on liblept.a didn't seem to work for me, but running the following works and seems to suggest that building for ARM has worked okay there, as far as I can tell.

$ lipo -info /Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/lib/liblept.a

Non-fat file: /Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/lib/liblept.a is architecture: arm64

And using otool:

$ otool -hv /Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/lib/liblept.a

Archive : /Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/lib/liblept.a
Mach header
      magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
MH_MAGIC_64   ARM64        ALL  0x00      OBJECT     5        928 SUBSECTIONS_VIA_SYMBOLS
Mach header
      magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
MH_MAGIC_64   ARM64        ALL  0x00      OBJECT     6        784 SUBSECTIONS_VIA_SYMBOLS
Mach header
      magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
MH_MAGIC_64   ARM64        ALL  0x00      OBJECT     5        688 SUBSECTIONS_VIA_SYMBOLS
...

@stweil
Copy link
Contributor

stweil commented Mar 27, 2019

Obviously your compiler builds code for x86_64 by default, but can also produce code for ARM if the option --target=arm-apple-darwin64 was given. The build process cannot guess that, so add CXX="g++ --target=arm-apple-darwin64" to the options for configure. Maybe CC="gcc --target=arm-apple-darwin64" is needed, too.

@hamchapman
Copy link
Author

Thank you! I've got something working now. Setting the values for CXX and CC explicitly did the job for me, once I'd ironed out a few other things (like removing -Qunused-arguments 🤦‍♂️)

I'm happy for this to be considered closed but perhaps I should add something to some documentation somewhere, or a wiki, detailing how to get this to work reliably?

@stweil
Copy link
Contributor

stweil commented Mar 28, 2019

Adding documentation would be excellent. I suggest to add a new section to the Wiki article.

@zdenop
Copy link
Contributor

zdenop commented May 25, 2019

@hamchapman: can you provide instruction how did you compiled tesseract for arm-apple-darwin64?

@stweil
Copy link
Contributor

stweil commented May 26, 2019

@hamchapman, the latest configure.ac has some improvements for clang++ based compilers, especially to detect the right compiler options. It should now work without local hacks. Please try it.

@zdenop
Copy link
Contributor

zdenop commented Oct 20, 2019

I put remark to wiki. Feel free to improve.

@albertbuchard
Copy link

albertbuchard commented Jan 2, 2022

Anyone banging their head on this, using clang++ seemed to work for me - result is very fast:

../configure CXX=clang++ CC=clang CFLAGS="--disable-asm-optimizations" PKG_CONFIG_PATH=/usr/local/opt/icu4c/lib/pkgconfig:/usr/local/opt/libarchive/lib/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants