Commit 692d3993 for tesseract
commit 692d3993d6a478f068ca530a1cdd314b5089fa52
Author: Stefan Weil <sw@weilnetz.de>
Date: Sun Nov 15 10:49:14 2026 +0100
CI: use GCC for the cmake build with GCC on macOS
The job used the compiler g++, which is Apple Clang on macOS:
-- The CXX compiler identification is AppleClang 17.0.0.17000013
-- Check for working CXX compiler: /usr/bin/g++ - skipped
So it was a second build with Clang. The runner images provide GCC
only with versioned names. Use g++-15 to get a build with GCC.
That build needs curl from Homebrew. Otherwise CMake finds curl in the
SDK and adds the include path of the SDK. That path also has the ICU
headers from Apple, which only provide the C API, and for GCC it comes
before the path for ICU from Homebrew, so the training tools failed
to compile:
icuerrorcode.h:45:44: error: expected class-name before '{' token
45 | class IcuErrorCode : public icu::ErrorCode {
Clang is not affected because the path is one of its default paths.
Set CMAKE_PREFIX_PATH, which is searched before the paths of the
system and of the SDK.
Assisted-by: Claude Fable 5.2 (Anthropic)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml
index e1d03b63..43ecc8d0 100644
--- a/.github/workflows/cmake.yml
+++ b/.github/workflows/cmake.yml
@@ -23,7 +23,7 @@ jobs:
matrix:
config:
- { name: macos-15-clang-cmake, os: macos-15, cxx: clang++ } # default
- - { name: macos-latest-gcc-cmake, os: macos-latest, cxx: g++ } #installed
+ - { name: macos-latest-gcc-15-cmake, os: macos-latest, cxx: g++-15 } #installed
- { name: macos-latest-clang-cmake, os: macos-latest, cxx: clang++ } # default
- { name: ubuntu-22.04-clang-15-cmake, os: ubuntu-22.04, cxx: clang++-15 } #installed
@@ -93,6 +93,9 @@ jobs:
set -e
mkdir build
mkdir inst
+ # Use curl and ICU from Homebrew. Otherwise curl is found in the SDK,
+ # and the include path for the SDK hides the C++ headers of ICU when
+ # the compiler is GCC.
cmake \
-S . \
-B build \
@@ -101,6 +104,7 @@ jobs:
-DOPENMP_BUILD=OFF \
-DENABLE_UNITY_BUILD=ON \
-DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \
+ -DCMAKE_PREFIX_PATH="$(brew --prefix curl);$(brew --prefix icu4c)" \
-DCMAKE_INSTALL_PREFIX:PATH=inst
if: runner.os == 'macOS'