Bug 703884 - Tesseract not compiling with Xcode 12.5
Summary: Tesseract not compiling with Xcode 12.5
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Other Driver (show other bugs)
Version: 9.54.0
Hardware: Macintosh MacOS X
: P4 normal
Assignee: Chris Liddell (chrisl)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-26 14:06 UTC by Bruno Voisin
Modified: 2021-08-25 13:38 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
make output just before failure (20.30 KB, text/plain)
2021-05-26 14:06 UTC, Bruno Voisin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bruno Voisin 2021-05-26 14:06:38 UTC
Created attachment 21021 [details]
make output just before failure

Since version 12.5 of Xcode, Ghostscript 9.54.0 no longer compiles with the usual ./configure && make sequence (it did compile with Xcode 12.4). This occurs at the make stage, when Tesseract is dealt with, giving the attached console output. The bug is caused by changes in Xcode's built-in C++ compiler, together with the fact that macOS is case-insensitive. An analysis of the bug in another context, together with a proposed fix, is given at

    https://groups.google.com/g/tesseract-ocr/c/MpCZe5wRYQE

This fix does work for Ghostscript (and GhostPDL). It consists, inside ghostscript-9.54.0/tesseract/, in:

- Renaming the file VERSION to TESS_VERSION.

- Editing line 10 of configure.ac

    [m4_esyscmd_s([test -d .git && git describe --abbrev=4 || cat VERSION])], 

to replace VERSION by TESS_VERSION.
Comment 1 Chris Liddell (chrisl) 2021-08-20 08:49:21 UTC
I don't follow this: we don't run the tesseract configure script when building into Ghostscript, so changes to it shouldn't affect the Ghostscript build at all.

Building Ghostscript with the OCR devices, with XCode 12.5.1 seems to work just fine for me....
Comment 2 Bruno Voisin 2021-08-22 10:01:19 UTC
Unfortunately, my setup has changed somewhat compared with that for which the report was made. It's now macOS 12.0 and Xcode 13.0, both in Beta 5 version (on Apple Silicon chip). To compile Ghostscript 9.54.0, two changes now need to be made to the source:

- First, in configure, replace libstdc++ on line 7131 by libc++, giving

     cxxflags_to_try="-std=c++17 -stdlib=libc++"

Otherwise, at the make stage, when gcc processes base/tessocr.cpp, you get an error

clang: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]

- Second, rename tesseract/VERSION to anything other than "VERSION". Otherwise, again when gcc processes base/tessocr.cpp, you get the errors I reported initially. The name change prevents gcc from reading this tesseract/VERSION instead of the intended

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/version

for a full Xcode install, or

/Library/Developer/CommandLineTools/usr/include/c++/v1/version

in case only the Command Line Tools are installed.

The change in configure.ac plays no role here. It was for consistency, based on the analysis at

https://groups.google.com/g/tesseract-ocr/c/MpCZe5wRYQE/m/BBVgEtVhCAAJ

so that the configure script could be recreated by autoconf if need be.

As for your not experiencing the problem with Xcode 12.5.1, the only explanation I could think of is that your hard drive may be formatted as Case-sensitive instead of the (default) Case-insensitive. I just checked, to be sure, when formatting a hard drive in Disk Utility you have a choice between APFS and HFS+ (aka Mac OS Extended), either Default (= Case-insensitive) or Case-sensitive, with or without encryption. The disk on which I observed the reported behaviour is APFS Encrypted Case-insensitive.
Comment 3 Chris Liddell (chrisl) 2021-08-25 13:38:37 UTC
Fixed in:
https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=73c202e24e98