From: "René Scharfe" <l.s.r@web•de>
To: Johannes Schindelin <Johannes.Schindelin@gmx•de>
Cc: Junio C Hamano <gitster@pobox•com>, git@vger•kernel.org
Subject: Re: [PATCH] regex: not all macOS platforms seem to have REG_ENHANCED
Date: Fri, 20 Mar 2026 16:59:23 +0100 [thread overview]
Message-ID: <2e0df4c6-552c-4293-9d56-46917343ac78@web.de> (raw)
In-Reply-To: <58f3c772-6d38-0807-29c5-75e26c229c1d@gmx.de>
On 3/20/26 4:12 PM, Johannes Schindelin wrote:
> Hi René,
>
> On Fri, 20 Mar 2026, René Scharfe wrote:
>
>> On 3/20/26 9:55 AM, Johannes Schindelin wrote:
>>
>>> Homebrew's LLVM clang uses different include paths from Apple's clang.
>>> In particular, the `regex.h` it sees does not define `REG_ENHANCED`,
>>> which is an Apple-specific extension present in the macOS SDK headers
>>> since at least macOS 10.12. The Makefile unconditionally sets
>>> `USE_ENHANCED_BASIC_REGULAR_EXPRESSIONS` for all Darwin builds via
>>> `config.mak.uname`, which pulls in `compat/regcomp_enhanced.c`, which
>>> references `REG_ENHANCED`, hence the build failure.
>>
>> I suspect it uses the same regex.h. The definition of REG_ENHANCED is
>> gated by a __MAC_OS_X_VERSION_MIN_REQUIRED check, though, and that fails
>> because __MAC_OS_X_VERSION_MIN_REQUIRED is defined as
>> __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ and that one in turn is not
>> defined by the Homebrew version of clang in the runner.
>
> That makes sense! I couldn't investigate this because I do not have a
> local macOS setup to test with, and I did not want to abuse GitHub
> Actions' runners (nor did I want to spend more of my own time on the
> investigation).
>
>> I can't reproduce this locally, by the way.
>> /opt/homebrew/Cellar/llvm/22.1.1/bin/clang is not linked to
>> /opt/homebrew/bin on my machine and also provides a sensible definition
>> of __MAC_OS_X_VERSION_MIN_REQUIRED.
>
> Hmm. I am convinced, though, that if it hits CI, it hits human users as
> well. Maybe the difference is that you upgraded from an existing setup
> while the runners (I think) are built from scratch every time.
Here's an experiment: This command:
printf "%s\n" "#include <regex.h>" __MAC_OS_X_VERSION_MIN_REQUIRED REG_ENHANCED | clang -E -
... prints the preprocessed regex.h on a macos-14 runner (from the macOS
SDK, good) as well as the resolved values of the two macros (140000 and
0400).
Calling make instead of ci/run-build-and-tests.sh lets the build succeed,
including compat/regcomp_enhanced.o.
So the plain runner is doing fine?
>>> The `osx-gcc` job (CC=gcc-13) is unaffected because Homebrew GCC is
>>> configured to use Apple's SDK sysroot, so it still picks up Apple's
>>> `regex.h` which defines `REG_ENHANCED`. The `osx-meson` job is
>>> unaffected because Meson does a compile-time test for `REG_ENHANCED`
>>> (via `compiler.get_define`) and simply skips the feature when it is
>>> absent.
>>>
>>> Work around this by setting `NO_REGEX` when `CC=clang` on Darwin, which
>>> makes the build use Git's bundled regex implementation instead of the
>>> system one. This sidesteps the missing `REG_ENHANCED` define entirely.
>>
>> Or how about using /usr/bin/clang explicitly on macOS instead of any old
>> clang from $PATH? That would avoid user-visible changes.
>
> That would fix our CI runs, but it would expose users who set their `CC =
> clang` to the same problem that broke our CI builds...
I still don't get it, but below are two fixes; either works (i.e. only
one of the two files needs to be changed). But why? $CUSTOM_PATH only
contains p4 and p4d. My observations don't make much sense, I must be
looking at it wrong. :-|
René
.github/workflows/main.yml | 6 +++---
ci/lib.sh | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 826f2f5d3a..f8c6e034ee 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -322,16 +322,16 @@ jobs:
matrix:
vector:
- jobname: osx-clang
- cc: clang
+ cc: /usr/bin/clang
pool: macos-14
- jobname: osx-reftable
- cc: clang
+ cc: /usr/bin/clang
pool: macos-14
- jobname: osx-gcc
cc: gcc-13
pool: macos-14
- jobname: osx-meson
- cc: clang
+ cc: /usr/bin/clang
pool: macos-14
env:
CC: ${{matrix.vector.cc}}
diff --git a/ci/lib.sh b/ci/lib.sh
index 42a2b6a318..6310c16b7a 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -346,7 +346,7 @@ macos-*)
esac
CUSTOM_PATH="${CUSTOM_PATH:-$HOME/path}"
-export PATH="$CUSTOM_PATH:$PATH"
+export PATH="$PATH:$CUSTOM_PATH"
case "$jobname" in
linux32)
next prev parent reply other threads:[~2026-03-20 15:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 22:37 [PATCH] regex: not all macOS platforms seem to have REG_ENHANCED Junio C Hamano
2026-03-19 23:11 ` René Scharfe
2026-03-20 1:30 ` Junio C Hamano
2026-03-20 7:34 ` Johannes Schindelin
2026-03-20 7:48 ` Johannes Schindelin
2026-03-20 7:55 ` Johannes Schindelin
2026-03-20 8:06 ` Johannes Schindelin
2026-03-20 8:55 ` Johannes Schindelin
2026-03-20 11:12 ` René Scharfe
2026-03-20 15:12 ` Johannes Schindelin
2026-03-20 15:59 ` René Scharfe [this message]
2026-03-20 16:33 ` Junio C Hamano
2026-03-20 16:57 ` Junio C Hamano
2026-03-20 16:50 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2e0df4c6-552c-4293-9d56-46917343ac78@web.de \
--to=l.s.r@web$(echo .)de \
--cc=Johannes.Schindelin@gmx$(echo .)de \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox