cannot compile tesseract on mac

1,018 views
Skip to first unread message

Kyle Foley

unread,
Jan 19, 2022, 2:22:06 AM1/19/22
to tesseract-ocr
I was able to go through all of the steps installing tesseract 5.0 with Homebrew as listed here

# Packages which are always needed.
brew install automake autoconf libtool
brew install pkgconfig
brew install icu4c
brew install leptonica
# Packages required for training tools.
brew install pango
# Optional packages for extra features.
brew install libarchive
# Optional package for builds using g++.
brew install gcc

I then completed the following steps:

git clone https://github.com/tesseract-ocr/tesseract/
cd tesseract
./autogen.sh
mkdir build
cd build

I then ran into problems:

(venv3) Admins-MacBook-Pro-4:build kylefoley$ sudo make install
make: *** No rule to make target `install'.  Stop.
(venv3) Admins-MacBook-Pro-4:build kylefoley$ make training
make: *** No rule to make target `training'.  Stop.
(venv3) Admins-MacBook-Pro-4:build kylefoley$ sudo make training-install
make: *** No rule to make target `training-install'.  Stop.
(venv3) Admins-MacBook-Pro-4:build kylefoley$ ../configure PKG_CONFIG_PATH=/usr/local/opt/icu4c/lib/pkgconfig:/usr/local/opt/libarchive/lib/pkgconfig
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... configure: error: in `/volumes/googledrive/my drive/laptop/documents/pcode/tesseract/build':
configure: error: cannot run C++ compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
(venv3) Admins-MacBook-Pro-4:build kylefoley$ configure --disable-shared 'CXXFLAGS=-g -O2 -Wall' PKG_CONFIG_PATH=$(brew --prefix)/opt/icu4c/lib/pkgconfig:$(brew --prefix)/opt/libarchive/lib/pkgconfig:$(brew --prefix)/Library/Homebrew/os/mac/pkgconfig/11
-bash: configure: command not found
(venv3) Admins-MacBook-Pro-4:build kylefoley$ ../configure --disable-shared 'CXXFLAGS=-g -O2 -Wall' PKG_CONFIG_PATH=$(brew --prefix)/opt/icu4c/lib/pkgconfig:$(brew --prefix)/opt/libarchive/lib/pkgconfig:$(brew --prefix)/Library/Homebrew/os/mac/pkgconfig/11
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... configure: error: in `/volumes/googledrive/my drive/laptop/documents/pcode/tesseract/build':
configure: error: cannot run C++ compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

In the above I used a different order but that was after I had tried them in the recommended order.

I was also told "You should not install gcc, but use the default compiler on macOS."  but I don't know what this means.

Zdenko Podobny

unread,
Jan 20, 2022, 1:16:09 AM1/20/22
to tesser...@googlegroups.com
I have no Mac but:

  1. If you are really interested in help you should not ignore advice you received - https://github.com/tesseract-ocr/tessdoc/issues/69#issuecomment-1016133236
  2. Your problem is not tesseract related - as you see you are not able to run test procedures of autotools (./configure): error: cannot run C++ compiled programs.
  3. Do not hide details - provide full information for reproducing problems. E.g.  (venv3)  indicates that you are building a tesseract in a python virtual environment. Why???  tesseract is not a python package. Did you try it in the 'normal' environment?


Zdenko


st 19. 1. 2022 o 8:22 Kyle Foley <kylefo...@gmail.com> napísal(a):
--
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-oc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/d34b6aee-5a78-492d-a99e-495b36021879n%40googlegroups.com.

Kyle Foley

unread,
Jan 20, 2022, 3:49:27 AM1/20/22
to tesseract-ocr
Listen, I can't be an expert on everything.  Just because I can use pytesseract to OCR some images does not mean I know the first thing about image processing.  My specialty is Latin, metaphysics and logic.  I don't have time to know all of these details about software.  I can't know everything.  So if you would be kind enough to explain some things to me on my level and help me out rather than insulting me because I committed the unforgiveable sin of not understanding tesseract I would appreciate it.  I tried to compile the tesseract not in a python environment but I basically got the same result.

I had to start out in the virtual environment because that junk software google drive storage is messing up my files such that i can't cd into them.

(venv3) Admins-MacBook-Pro-4:pcode kylefoley$ cd tesseract
(venv3) Admins-MacBook-Pro-4:tesseract kylefoley$ de

now i'm out of the virtual environment.

Admins-MacBook-Pro-4:tesseract kylefoley$ ./autogen.sh
Running aclocal
Running /opt/local/bin/glibtoolize
glibtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'config'.
glibtoolize: copying file 'config/ltmain.sh'
glibtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
glibtoolize: copying file 'm4/libtool.m4'
glibtoolize: copying file 'm4/ltoptions.m4'
glibtoolize: copying file 'm4/ltsugar.m4'
glibtoolize: copying file 'm4/ltversion.m4'
glibtoolize: copying file 'm4/lt~obsolete.m4'
Running aclocal
Running autoconf
Running autoheader
Running automake --add-missing --copy
configure.ac:407: installing 'config/compile'
configure.ac:27: installing 'config/missing'
Makefile.am: installing 'config/depcomp'

All done.
To build the software now, do something like:

$ ./configure [--enable-debug] [...other options]
Admins-MacBook-Pro-4:tesseract kylefoley$ mkdir build
mkdir: build: File exists
Admins-MacBook-Pro-4:tesseract kylefoley$ cd build
Admins-MacBook-Pro-4:build kylefoley$ make -j
make: *** No targets specified and no makefile found.  Stop.

Admins-MacBook-Pro-4:build kylefoley$ make training
make: *** No rule to make target `training'.  Stop.
Admins-MacBook-Pro-4:build kylefoley$ sudo make training-install
Password:

make: *** No rule to make target `training-install'.  Stop.

I have tesseract 4.0 installed and working but I installed it years ago and have no idea how I did it back then. What I would really like to know is what folder I should be when I run.


as for
>If you are really interested in help you should not ignore advice you received - https://github.com/tesseract-ocr/tessdoc/issues/69#issuecomment-1016133236

you cannot ignore advice you don't understand.  If I were to tell you in an obscure American indian language 'ju mani tank owachi' and you failed to carry out my advice, you would not be ignoring me.  When he wrote: "You should not install gcc, but use the default compiler on macOS."  he really wrongly assumed that I know how to do that.  You don't have to compile things in Pythong which is the only language that I really understand so I don't know what that means, nor what to do with it.  Like more than 90% of software writers he wrongly understands that everyone understands computers just like he does.

as for
>our problem is not tesseract related - as you see you are not able to run test procedures of autotools (./configure): error: cannot run C++ compiled programs.

again, I don't know what that means.  I can't be an expert on everything.  If you're really here to help people then please do not assume that they understand everything as well as you do, otherwise they wouldn't be here asking for help.

Kyle Foley

unread,
Jan 20, 2022, 4:42:09 AM1/20/22
to tesseract-ocr
i've made some more progress, but please bear in mind that I have almost no experience with c++ or c, so I do not really know what it means to compile a program.

I'm able to do this step:

Admins-MacBook-Pro-4:tesseract kylefoley$ ./autogen.sh
Running aclocal
Running /opt/local/bin/glibtoolize
glibtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'config'.
glibtoolize: copying file 'config/ltmain.sh'
glibtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
glibtoolize: copying file 'm4/libtool.m4'
glibtoolize: copying file 'm4/ltoptions.m4'
glibtoolize: copying file 'm4/ltsugar.m4'
glibtoolize: copying file 'm4/ltversion.m4'
glibtoolize: copying file 'm4/lt~obsolete.m4'
Running aclocal
Running autoconf
Running autoheader
Running automake --add-missing --copy
configure.ac:407: installing 'config/compile'
configure.ac:27: installing 'config/missing'
Makefile.am: installing 'config/depcomp'

All done.
To build the software now, do something like:

$ ./configure [--enable-debug] [...other options]

Now I run into errors and I have no idea what is going on.  None of the above means anything to me.  The only thing that has remotely come close to succeeding is

Admins-MacBook-Pro-4:tesseract kylefoley$ ./configure

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... configure: error: in `/volumes/googledrive/my drive/laptop/documents/pcode/tesseract':

configure: error: cannot run C++ compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

So I check the config.log which again I have no understanding of

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by tesseract configure 5.0.1-9-g31a968, which was
generated by GNU Autoconf 2.71.  Invocation command line was

  $ ./configure 'CXX=g++ --target=arm-apple-darwin64'

## --------- ##
## Platform. ##
## --------- ##

hostname = Admins-MacBook-Pro-4.local
uname -m = x86_64
uname -r = 18.5.0
uname -s = Darwin
uname -v = Darwin Kernel Version 18.5.0: Mon Mar 11 20:40:32 PDT 2019; root:xnu-4903.251.3~3/RELEASE_X86_64

/usr/bin/uname -p = i386
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = Mach kernel version:
         Darwin Kernel Version 18.5.0: Mon Mar 11 20:40:32 PDT 2019; root:xnu-4903.251.3~3/RELEASE_X86_64
Kernel configured for up to 8 processors.
4 processors are physically available.
8 processors are logically available.
Processor type: x86_64h (Intel x86-64h Haswell)
Processors active: 0 1 2 3 4 5 6 7
Primary memory available: 16.00 gigabytes
Default processor set: 413 tasks, 2578 threads, 8 processors
Load average: 2.64, Mach factor: 5.35
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /opt/local/bin/
PATH: /opt/local/sbin/
PATH: /usr/local/opt/tcl-tk/bin/
PATH: /Users/kylefoley/Applications/miniconda3/condabin/
PATH: /Users/kylefoley/.pyenv/shims/
PATH: /Library/Frameworks/Python.framework/Versions/3.7/bin/
PATH: /applications/google-cloud-sdk/bin/
PATH: /usr/local/opt/openssl/bin/
PATH: /usr/local/bin/
PATH: /usr/bin/
PATH: /bin/
PATH: /usr/sbin/
PATH: /sbin/
PATH: ~/PycharmProjects/book/superlists/chromedriver/
PATH: /usr/local/share/dotnet/
PATH: /opt/X11/bin/
PATH: ~/.dotnet/tools/
PATH: /Library/Frameworks/Mono.framework/Versions/Current/Commands/


## ----------- ##
## Core tests. ##
## ----------- ##

configure:3040: looking for aux files: compile ltmain.sh config.guess config.sub missing install-sh
configure:3053:  trying ./config/
configure:3082:   ./config/compile found
configure:3082:   ./config/ltmain.sh found
configure:3082:   ./config/config.guess found
configure:3082:   ./config/config.sub found
configure:3082:   ./config/missing found
configure:3064:   ./config/install-sh found
configure:3324: checking for C++ compiler version
configure:3333: g++ --target=arm-apple-darwin64 --version >&5
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: arm-apple-darwin64
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
configure:3344: $? = 0
configure:3333: g++ --target=arm-apple-darwin64 -v >&5
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: arm-apple-darwin64
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
configure:3344: $? = 0
configure:3333: g++ --target=arm-apple-darwin64 -V >&5
clang: error: unsupported option '-V -Wno-atomic-implicit-seq-cst'
clang: error: no input files
configure:3344: $? = 1
configure:3333: g++ --target=arm-apple-darwin64 -qversion >&5
clang: error: unknown argument '-qversion', did you mean '--version'?
clang: error: no input files
configure:3344: $? = 1
configure:3364: checking whether the C++ compiler works
configure:3386: g++ --target=arm-apple-darwin64    conftest.cpp  >&5
ld: unknown/unsupported architecture name for: -arch armv4t
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:3390: $? = 1
configure:3430: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "tesseract"
| #define PACKAGE_TARNAME "tesseract"
| #define PACKAGE_VERSION "5.0.1-9-g31a968"
| #define PACKAGE_STRING "tesseract 5.0.1-9-g31a968"
| #define PACKAGE_BUGREPORT "https://github.com/tesseract-ocr/tesseract/issues"
| #define PACKAGE_URL "https://github.com/tesseract-ocr/tesseract/"
| /* end confdefs.h.  */
|
| int
| main (void)
| {
|
|   ;
|   return 0;
| }
configure:3435: error: in `/volumes/googledrive/my drive/laptop/documents/pcode/tesseract':
configure:3437: error: C++ compiler cannot create executables

See `config.log' for more details

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CXXCPP_set=
ac_cv_env_CXXCPP_value=
ac_cv_env_CXXFLAGS_set=
ac_cv_env_CXXFLAGS_value=
ac_cv_env_CXX_set=set
ac_cv_env_CXX_value='g++ --target=arm-apple-darwin64'
ac_cv_env_ICU_I18N_CFLAGS_set=
ac_cv_env_ICU_I18N_CFLAGS_value=
ac_cv_env_ICU_I18N_LIBS_set=
ac_cv_env_ICU_I18N_LIBS_value=
ac_cv_env_ICU_UC_CFLAGS_set=
ac_cv_env_ICU_UC_CFLAGS_value=
ac_cv_env_ICU_UC_LIBS_set=
ac_cv_env_ICU_UC_LIBS_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LEPTONICA_CFLAGS_set=
ac_cv_env_LEPTONICA_CFLAGS_value=
ac_cv_env_LEPTONICA_LIBS_set=
ac_cv_env_LEPTONICA_LIBS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_LT_SYS_LIBRARY_PATH_set=
ac_cv_env_LT_SYS_LIBRARY_PATH_value=
ac_cv_env_PKG_CONFIG_LIBDIR_set=
ac_cv_env_PKG_CONFIG_LIBDIR_value=
ac_cv_env_PKG_CONFIG_PATH_set=
ac_cv_env_PKG_CONFIG_PATH_value=
ac_cv_env_PKG_CONFIG_set=
ac_cv_env_PKG_CONFIG_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_cairo_CFLAGS_set=
ac_cv_env_cairo_CFLAGS_value=
ac_cv_env_cairo_LIBS_set=
ac_cv_env_cairo_LIBS_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_libarchive_CFLAGS_set=
ac_cv_env_libarchive_CFLAGS_value=
ac_cv_env_libarchive_LIBS_set=
ac_cv_env_libarchive_LIBS_value=
ac_cv_env_libcurl_CFLAGS_set=
ac_cv_env_libcurl_CFLAGS_value=
ac_cv_env_libcurl_LIBS_set=
ac_cv_env_libcurl_LIBS_value=
ac_cv_env_pango_CFLAGS_set=
ac_cv_env_pango_CFLAGS_value=
ac_cv_env_pango_LIBS_set=
ac_cv_env_pango_LIBS_value=
ac_cv_env_pangocairo_CFLAGS_set=
ac_cv_env_pangocairo_CFLAGS_value=
ac_cv_env_pangocairo_LIBS_set=
ac_cv_env_pangocairo_LIBS_value=
ac_cv_env_pangoft2_CFLAGS_set=
ac_cv_env_pangoft2_CFLAGS_value=
ac_cv_env_pangoft2_LIBS_set=
ac_cv_env_pangoft2_LIBS_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=

## ----------------- ##
## Output variables. ##
## ----------------- ##

ACLOCAL=''
ADD_RT_FALSE=''
ADD_RT_TRUE=''
AMDEPBACKSLASH=''
AMDEP_FALSE=''
AMDEP_TRUE=''
AMTAR=''
AM_BACKSLASH=''
AM_CPPFLAGS=''
AM_DEFAULT_V=''
AM_DEFAULT_VERBOSITY=''
AM_LDFLAGS=''
AM_V=''
AR=''
ASCIIDOC_FALSE=''
ASCIIDOC_TRUE=''
AUTOCONF=''
AUTOHEADER=''
AUTOMAKE=''
AWK=''
CC=''
CCDEPMODE=''
CFLAGS=''
CPPFLAGS=''
CSCOPE=''
CTAGS=''
CXX='g++ --target=arm-apple-darwin64'
CXXCPP=''
CXXDEPMODE=''
CXXFLAGS=''
CYGPATH_W=''
DEFS=''
DEPDIR=''
DISABLED_LEGACY_ENGINE_FALSE=''
DISABLED_LEGACY_ENGINE_TRUE=''
DLLTOOL=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C='\c'
ECHO_N=''
ECHO_T=''
EGREP=''
ENABLE_TRAINING_FALSE=''
ENABLE_TRAINING_TRUE=''
ETAGS=''
EXEEXT=''
FGREP=''
FRAMEWORK_ACCELERATE=''
FRAMEWORK_OPENCL=''
GENERIC_API_VERSION=''
GENERIC_LIBRARY_NAME=''
GENERIC_LIBRARY_VERSION=''
GENERIC_MAJOR_VERSION=''
GENERIC_MICRO_VERSION=''
GENERIC_MINOR_VERSION=''
GENERIC_RELEASE=''
GENERIC_VERSION=''
GRAPHICS_DISABLED_FALSE=''
GRAPHICS_DISABLED_TRUE=''
GREP=''
HAVE_AVX2_FALSE=''
HAVE_AVX2_TRUE=''
HAVE_AVX_FALSE=''
HAVE_AVX_TRUE=''
HAVE_FMA_FALSE=''
HAVE_FMA_TRUE=''
HAVE_LIBARCHIVE_FALSE=''
HAVE_LIBARCHIVE_TRUE=''
HAVE_LIBCURL_FALSE=''
HAVE_LIBCURL_TRUE=''
HAVE_NEON_FALSE=''
HAVE_NEON_TRUE=''
HAVE_SSE4_1_FALSE=''
HAVE_SSE4_1_TRUE=''
HAVE_XML_CATALOG_FILES_FALSE=''
HAVE_XML_CATALOG_FILES_TRUE=''
ICU_I18N_CFLAGS=''
ICU_I18N_LIBS=''
ICU_UC_CFLAGS=''
ICU_UC_LIBS=''
INSTALL_DATA=''
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
INSTALL_STRIP_PROGRAM=''
LD=''
LDFLAGS=''
LEPTONICA_CFLAGS=''
LEPTONICA_LIBS=''
LIBOBJS=''
LIBS=''
LIBTOOL=''
LIPO=''
LN_S=''
LTLIBOBJS=''
LT_SYS_LIBRARY_PATH=''
MAKEINFO=''
MANIFEST_TOOL=''
MKDIR_P=''
NEON_CXXFLAGS=''
NM=''
NMEDIT=''
NOUNDEFINED=''
NO_TESSDATA_PREFIX_FALSE=''
NO_TESSDATA_PREFIX_TRUE=''
OBJDUMP=''
OBJEXT=''
OPENCL_CPPFLAGS=''
OPENCL_FALSE=''
OPENCL_LDFLAGS=''
OPENCL_TRUE=''
OPENMP_CXXFLAGS=''
OPENMP_SIMD_FALSE=''
OPENMP_SIMD_TRUE=''
OTOOL64=''
OTOOL=''
PACKAGE=''
PACKAGE_BUGREPORT='https://github.com/tesseract-ocr/tesseract/issues'
PACKAGE_DATE=''
PACKAGE_NAME='tesseract'
PACKAGE_STRING='tesseract 5.0.1-9-g31a968'
PACKAGE_TARNAME='tesseract'
PACKAGE_URL='https://github.com/tesseract-ocr/tesseract/'
PACKAGE_VERSION='5.0.1-9-g31a968'
PACKAGE_YEAR=''
PATH_SEPARATOR=':'
PKG_CONFIG=''
PKG_CONFIG_LIBDIR=''
PKG_CONFIG_PATH=''
RANLIB=''
SED=''
SET_MAKE=''
SHELL='/bin/sh'
STRIP=''
TENSORFLOW_FALSE=''
TENSORFLOW_LIBS=''
TENSORFLOW_TRUE=''
T_WIN_FALSE=''
T_WIN_TRUE=''
VERSION=''
VISIBILITY_FALSE=''
VISIBILITY_TRUE=''
XML_CATALOG_FILES=''
ac_ct_AR=''
ac_ct_CC=''
ac_ct_CXX=''
ac_ct_DUMPBIN=''
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE=''
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__fastdepCXX_FALSE=''
am__fastdepCXX_TRUE=''
am__include=''
am__isrc=''
am__leading_dot=''
am__nodep=''
am__quote=''
am__tar=''
am__untar=''
bindir='${exec_prefix}/bin'
build=''
build_alias=''
build_cpu=''
build_os=''
build_vendor=''
cairo_CFLAGS=''
cairo_LIBS=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
have_asciidoc=''
have_brew=''
have_xsltproc=''
host=''
host_alias=''
host_cpu=''
host_os=''
host_vendor=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh=''
libarchive_CFLAGS=''
libarchive_LIBS=''
libcurl_CFLAGS=''
libcurl_LIBS=''
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
mkdir_p=''
oldincludedir='/usr/include'
pango_CFLAGS=''
pango_LIBS=''
pangocairo_CFLAGS=''
pangocairo_LIBS=''
pangoft2_CFLAGS=''
pangoft2_LIBS=''
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
runstatedir='${localstatedir}/run'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME "tesseract"
#define PACKAGE_TARNAME "tesseract"
#define PACKAGE_VERSION "5.0.1-9-g31a968"
#define PACKAGE_STRING "tesseract 5.0.1-9-g31a968"
#define PACKAGE_BUGREPORT "https://github.com/tesseract-ocr/tesseract/issues"
#define PACKAGE_URL "https://github.com/tesseract-ocr/tesseract/"

configure: exit 77

One thing that I find strange.  When I click on the alias for tesseract in the /usr/local/bin/ folder it takes me to

/usr/local/cellar/tesseract/4.1.1/bin/tesseract

but tesseract 5 has no bin file.  why?

Ger Hobbelt

unread,
Jan 20, 2022, 10:33:42 AM1/20/22
to tesseract-ocr
L.S.,

Thanks for posting the configure log output like that. While it isn't always helpful to post logs (something about a forest and the difficulty of seeing a tree:-) )  in this case, plus your stated level of experience, it helps to do at least some degree of remote diagnostics on this. TL;DR: no nice conclusions here, but the diagnostics and analysis process should hopefully help you and others who come after. (I've seen this type of issue pass through the mailing list quite a few times while I've been quiet, lurking here for a couple of years.)

Let's start.

First: helicopter view and considerations resulting from it:

1- you state you are not an experienced developer.   Consequence: when you want to build (compile + link + ...) and use (a.k.a. 'run') a complex software like tesseract, generally speaking you can expect a *long* and *ardous* learning curve. That goes for all software, not just tesseract. With some it can be easier, with some it can be tough.

2- tesseract is at a disadvantage in that respect on OSX as I haven't seen an active collection of Apple-expert-knowledgeable developers around in a while. Combine this with my *personal experience* that Apple / OSX is maybe very user friendly, but it sure is hostile towards OSS developers on a budget (of time and money). Given past encounters, I personally do not do any Apple/OSX development unless significant funding is guaranteed up front and people are willing to wait and provide all the hardware. The repeat experience has been that bad.    Consequence: I can only help you with generic directions and possibly a few assumptions that may turn out to be correct, but I've got no hardware around to check or test any of this. Cave canem.

3- From the initial noises I get the feeling the trouble starts (very) early in the build process. Generally such early-onset problems hint at trouble in the local developer environment setup: either it's unusual, unexpected or otherwise off the assumed "normal". Hard to say what will be wrong exactly without deep analysis (more later), but a `configure` error like that indicates at least 3 potential major investigative routes: 

(a) the developer environment is "off" (wrong compiler and/or tools installs, broken installs of same); what we call "b0rked".   Consequence: almost nothing works as one would expect.
(b) while the tools setup may be okay, some or all of the required *libraries* are "off" (same options: not installed, installed elsewhere, unexpected/too-old/too-new versions/anything-else-you-can-imagine-to-go-wrong-with-this)   Consequence: weird compile and/or link-time errors; crazy run-time failures of the application, if building it was reported as "successful". All kinds of crazy shit.
(c) the project build setup/configuration scripts have a bug themselves (here that would be the 'configure' script, for example)   Consequence: "but it works at my place." All kinds of crazy shit. Hard to tell.

Consequence of trouble with *any* item in number 3: if you're not experienced with the specifics of those areas, you're in a world of hurt and will need to do a lot of digging on the internet, in manuals and probably a lot of trial&error too before you get moving again.

--

On with the show: analysis of what you got here.

Took me two rounds of reading your logs before I noticed, because my own assumptions made me blind for an important first bit:

(a) what machine are you running on, exactly?
(b) assuming you're intent on building the software for use on that same machine, the question then is: does your current development environment on your machine support this?

(The shortened to jargon version of this question is: are you cross-compiling or not? Assumed answer: no, I'm *not* cross-compiling. What's built here is meant to run on the same box.)

Your machine is reported here:

hostname = Admins-MacBook-Pro-4.local
uname -m = x86_64
uname -r = 18.5.0
uname -s = Darwin
uname -v = Darwin Kernel Version 18.5.0: Mon Mar 11 20:40:32 PDT 2019; root:xnu-4903.251.3~3/RELEASE_X86_64

/usr/bin/uname -p = i386
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = Mach kernel version:
         Darwin Kernel Version 18.5.0: Mon Mar 11 20:40:32 PDT 2019; root:xnu-4903.251.3~3/RELEASE_X86_64
Kernel configured for up to 8 processors.
4 processors are physically available.
8 processors are logically available.
Processor type: x86_64h (Intel x86-64h Haswell)


which reads as "Intel processor or suchlike; 64-bit; "X86_64" being the magic word here.

Your compiler (which is an important part of your dev environment) is reported here:

configure:3324: checking for C++ compiler version
configure:3333: g++ --target=arm-apple-darwin64 --version >&5
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: arm-apple-darwin64
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
configure:3344: $? = 0
configure:3333: g++ --target=arm-apple-darwin64 -v >&5
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: arm-apple-darwin64
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

which I initially read as "Apple-made clang/gcc (LLVM backend), so okay, *probably*... I glossed over the "arm" bit there, which I only consciously noted during the second round. Oops? More later.

Then here is the bit of info telling us what your *compiler* says its supported target platforms are [supposed to be]
which' list should include the platform you're currently running on as (assumption) you want to run the built software on that same box:

configure:3364: checking whether the C++ compiler works
configure:3386: g++ --target=arm-apple-darwin64    conftest.cpp  >&5
ld: unknown/unsupported architecture name for: -arch armv4t
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:3390: $? = 1
configure:3430: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "tesseract"
| #define PACKAGE_TARNAME "tesseract"
| #define PACKAGE_VERSION "5.0.1-9-g31a968"
| #define PACKAGE_STRING "tesseract 5.0.1-9-g31a968"
| /* end confdefs.h.  */
|
| int
| main (void)
| {
|
|   ;
|   return 0;
| }

at which point the shit hits the fan.

The code shown (generated by the configure script to test the compiler's proper behaviour) is a minimal amount of work to see if a development environment *MIGHT* work as expected, and this fails. Why?
Where does the "armv4t" architecture suddenly come from?

So I looked again and noticed the DETAILS of the reported compiler version:

configure:3324: checking for C++ compiler version
configure:3333: g++ --target=arm-apple-darwin64 --version >&5
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: arm-apple-darwin64
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
configure:3344: $? = 0
configure:3333: g++ --target=arm-apple-darwin64 -v >&5
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: arm-apple-darwin64
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Apple? check.
Darwin? check.
arm? Uh-oh! WRONG. Should have that magic x86 bit in it somewhere, or "86" at least to give us hope.

As the compiler in your current development environment reports it's meant to produce executables ("apps") for ARM-processor based hardware, *nothing* it produces will be able to fly on Intel/x86_64.

Granted, that's just 3-6 characters in a torrent of lines, but it's critical: *somehow* (I don't know how this happened) you've got a ARM targeting development Xcode(?) setup installed on your machine. That would be okay if you were, say, *cross-compiling* to iPhone or somesuch (which, IIRC, is ARM-based), but not for anything that's got to run on the machine itself.

What to do?

First off, make sure this development environment is removed / uninstalled entirely (while one CAN have multiple development environments on a single developer machine, that's for experienced people who do both NATIVE and CROSS-COMPILE development work only (as it's pretty hairy to get right, sometimes) and you've mentioned you're not in this biome so my advice is then: get rid of it, for it can only confuse and cause havoc.

Then, if you want to retry, seek a x86/64 ("64-bit AMD/Intel x86 compatible" or words of that order) development environment installer from Apple's developer centre -- it's where I got pointed at during a quick google search and I immediately remembered why I don't like Apple, so I'll stop myself right there and then. ;-) 

When you've got it all set up again for x86/64, try the configure script again and see if it gets past that initial compile+run attempt above:

configure:3364: checking whether the C++ compiler works
configure:3386: g++ --target=arm-apple-darwin64    conftest.cpp  >&5
ld: unknown/unsupported architecture name for: -arch armv4t
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:3390: $? = 1
configure:3430: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "tesseract"
| #define PACKAGE_TARNAME "tesseract"
| #define PACKAGE_VERSION "5.0.1-9-g31a968"
| #define PACKAGE_STRING "tesseract 5.0.1-9-g31a968"
| /* end confdefs.h.  */
|
| int
| main (void)
| {
|
|   ;
|   return 0;
| }
configure:3435: error: in `/volumes/googledrive/my drive/laptop/documents/pcode/tesseract':
configure:3437: error: C++ compiler cannot create executables

IMPORTANT: only when you do get past this stage without having to mess around to get NO ERRORS WHAT-SO-EVER UP TO AND INCLUDING THIS PART, can you be *reasonably certain*;  no guarantees yet!! You've only touched on (3a) of the "helicopter view list" just yet, (3b) and (3c) are still valid (as in: unverified, thus still potential suspect) problems you may encounter along the way as the 'configure' script continues and you work towards a working application.


--

Thoughts on the matter

(i) I hope this will help not just you but also others who come after. One of the key take-aways here is: remote debugging development issues is a damn hard business as you may have seen we've only started and already the number of error-inducing variables is large and the diagnostic tree exploding. This gets worse as you progress.

(ii) I have not addressed your own stated struggle with the google drive software, but that's another worry hidden in the background noise level: usually development environments assume you're working on direct access disks or a very thorough simulation thereof: Virtual Machines or such-like, e.g. Docker. While you CAN often get away with other storage use, this can often cause severe trauma down the road due to subtly different behaviours, e.g. non-atomicity of file locking, weird data/timestamp behaviour throwing off your build/make processes into (re-)compiling the wrong stuff or completely missing an edit change you just did, etc. This is why developers need different hardware and OS support than "office workers" and is often a cause for grief in corporate environments. Some types of development environments are ill-advised for single-person or small teams, where no dedicated expert admins are on call 24/7. My personal dev rig has a dedicated, second, built-in SSD for projects; Google Drive, Dropbox and their ilk don't get anywhere near it. When I need, I copy data between the two or automate that bit of process with a bit of script if I feel the need. The machine is single-user and git the tool used for managing and backing up those projects. It's a personal choice, which I made so I could minimize my time spent on tedious admin tasks.

(iii) Given that you've got quite a road ahead of you, you MAY consider the "let's-be-lazy-for-a-moment" potential work-around: I would consider it well-spent if I went hunting for pre-built tesseract binaries, done by someone else and ready for download and use on my particular machine. (Apple, Darwin, Intel/AMD CPU chip, OSX version 18.5.0 (as reported) or there-about.) Would take a few days for that myself to see if I could get that tract working for me, and consider a final failure with that path still time well-spent: I estimate this will take longer to get right, as in: a point where you are happy with the software working as you want it to)

(iv) writing a (hopefully helpful; you always have a degree of guesswork as you're not facing one another) response like this costs time. A few times I decide to chime in, but I'm not around like Zdenko is: I simply don't have the stamina for long term support like that, particularly on an unpaid volunteer basis as this, plus I'm no expert on tesseract. (I still do very much prefer open source myself as the alternative experience has been significantly worse, those times when it really mattered: with commercial (closed) software, I was technically and legally unable to help *myself* or my own teams, thus failing our customers.) The dark side of that coin is terse answers and a huge gap between the ones that stick around and the fresh folks entering, asking (ever so slightly) similar questions. It's okay to bite back when we get a bit curmudgeon, but I'm still very happy to have him around: his fingerprints are all over the available documentation and mailing list with helpful answers while I am only a quiet listener at the best of times.

Having said that, thank you for following up and continued reporting of your quest; while the conclusions thus far are not happy sunshine, I hope there's a path or two for progress to be achieved. While I don't think I can be of much further help (Apple and me ;-) ) let us know what you got next; continued reporting on any progress is also helpful for anyone who comes after and does a google search.



Met vriendelijke groeten / Best regards,

Ger Hobbelt

--------------------------------------------------
web:    http://www.hobbelt.com/
        http://www.hebbut.net/
mail:   g...@hobbelt.com
mobile: +31-6-11 120 978
--------------------------------------------------


Kyle Foley

unread,
Jan 21, 2022, 5:35:35 PM1/21/22
to tesseract-ocr
Thanks a lot for your help.  It will be a while before I have enough time to work on the problem.  But when I do I will certainly keep you abreast of my progress.

Qin Ba

unread,
Jul 22, 2022, 3:49:53 AM7/22/22
to tesseract-ocr
I am on macOS Monterey Apple M1 Pro. I just ran "brew install tesseract", see https://formulae.brew.sh/formula/tesseract. It seems to work. Ignore if you wish to build from source. 

Fish Money

unread,
Oct 2, 2023, 10:26:18 AM10/2/23
to tesseract-ocr
Just install ubuntu and use standard installation manual
namaste

пятница, 22 июля 2022 г. в 03:49:53 UTC-4, baqi...@gmail.com:

Alexey Pismenskiy

unread,
Oct 12, 2023, 11:28:41 AM10/12/23
to tesseract-ocr
Why do you choose to compile it? 
If you just want to run it with pytesseract on MacOS you just need "brew install tesseract" and then "brew install tesseract-lang". You may limit the languages you install if you are concerned about the space
Reply all
Reply to author
Forward
0 new messages