Skip to content

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

@hamchapman

Description

@hamchapman

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions