Documenting my resolution to a build error caused when the brew update process upgraded me from libgccjit 11.3 to 12.1.

Error message from configure
============================

  ,----
  | checking for gcc_jit_context_acquire in -lgccjit... no
  | configure: error: ELisp native compiler was requested, but libgccjit was not found.
  | Please try installing libgccjit or a similar package.
  | If you are sure you want Emacs be compiled without ELisp native compiler,
  | pass the --without-native-compilation option to configure.
  | make: *** [config.status] Error 1
  `----


config.log section showing linker can't map file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  ,----
  | configure:19555: checking for gcc_jit_context_acquire in -lgccjit
  | configure:19578: gcc -o conftest -g3 -O2 -isystem /usr/local/Cellar/libffi/3.4.2/include -isystem /usr/local/Cellar/librsvg/2.54.4/include/librsvg-2.0 -isystem /usr/local/Cellar/gdk-pixbuf/2.42.8_1/include/gdk-pixbuf-2.0 -isystem /usr/local/Cellar/jpeg/9e/include -isystem /usr/local/Cellar/libtiff/4.4.0_1/include -isystem /usr/local/Cellar/glib/2.72.3/include -isystem /usr/local/Cellar/cairo/1.16.0_5/include/cairo -isystem /usr/local/Cellar/glib/2.72.3/include -isystem /usr/local/Cellar/glib/2.72.3/include/glib-2.0 -isystem /usr/local/Cellar/glib/2.72.3/lib/glib-2.0/include -isystem /usr/local/opt/gettext/include -isystem /usr/local/Cellar/pcre/8.45/include -isystem /usr/local/Cellar/pixman/0.40.0/include/pixman-1 -isystem /usr/local/Cellar/fontconfig/2.14.0/include -isystem /usr/local/opt/freetype/include/freetype2 -isystem /usr/local/Cellar/libpng/1.6.37/include/libpng16 -isystem /usr/local/Cellar/libxcb/1.15/include -isystem /usr/local/Cellar/libxrender/0.9.10/include -isystem /usr/local/Cellar/libxext/1.3.4/include -isystem /usr/local/Cellar/libx11/1.8.1/include -isystem /usr/local/Cellar/libxcb/1.15/include -isystem /usr/local/Cellar/libxau/1.0.9/include -isystem /usr/local/Cellar/libxdmcp/1.1.3/include -isystem /usr/local/Cellar/xorgproto/2022.1/include -isystem /usr/local/Cellar/webp/1.2.3_1/include -I/usr/local/Cellar/libgccjit/12.1.0/include     conftest.c -lgccjit  -lsqlite3   -L/usr/local/Cellar/libgccjit/12.1.0/lib/gcc/current
  | /usr/local/Cellar/libgccjit/12.1.0/lib/gcc/12 >&5
  | ld: warning: dylib (/usr/local/Cellar/libgccjit/12.1.0/lib/gcc/current/libgccjit.dylib) was built for newer macOS version (12.4) than being linked (12.0)
  | ld: can't map file, errno=22 file '/usr/local/Cellar/libgccjit/12.1.0/lib/gcc/12' for architecture x86_64
  | clang: error: linker command failed with exit code 1 (use -v to see invocation)
  | configure:19578: $? = 1
  `----


configure.ac test for brew installed libgccjit
==============================================

  In the example below the test in configure.ac returns two lines and
  this appears to be the cause of the linker can't map file error.
  ,----
  | (python_training) bartm002@C02FM1E2MD6T ~ % brew ls -v libgccjit | grep -E 'libgccjit\.(so|dylib)$'
  | /usr/local/Cellar/libgccjit/12.1.0/lib/gcc/current/libgccjit.dylib
  | /usr/local/Cellar/libgccjit/12.1.0/lib/gcc/12/libgccjit.dylib
  `----

  Here is the listing to show that both paths are really the same with
  symbolic links.
  ,----
  |   /usr/local/Cellar/libgccjit/12.1.0/lib/gcc:
  |   drwxr-xr-x 4 bartm002 admin 128 May  6 00:53 .
  |   drwxr-xr-x 3 bartm002 admin  96 May  6 00:53 ..
  |   drwxr-xr-x 4 bartm002 admin 128 May  6 00:53 12
  |     lrwxr-xr-x 1 bartm002 admin  28 May  6 00:53 libgccjit.0.dylib -> ../current/libgccjit.0.dylib
  |     lrwxr-xr-x 1 bartm002 admin  26 May  6 00:53 libgccjit.dylib -> ../current/libgccjit.dylib
  |   drwxr-xr-x 4 bartm002 admin 128 May  6 00:53 current
  |     -rw-r--r-- 1 bartm002 admin 41M Aug  6 18:47 libgccjit.0.dylib
  |     lrwxr-xr-x 1 bartm002 admin  17 May  6 00:53 libgccjit.dylib -> libgccjit.0.dylib
  `----

  Here I modify the test to return only the first line and the build
  succeeds after this change.
  ,----
  | (python_training) bartm002@C02FM1E2MD6T ~ % brew ls -v libgccjit | grep -E 'libgccjit\.(so|dylib)$' | head -n 1
  | /usr/local/Cellar/libgccjit/12.1.0/lib/gcc/current/libgccjit.dylib
  `----

  ,----
  | diff --git a/configure.ac b/configure.ac
  | index 1a264275bd..2d88d0ac15 100644
  | --- a/configure.ac
  | +++ b/configure.ac
  | @@ -4241,7 +4241,8 @@ AC_DEFUN
  |            MAC_CFLAGS="-I$(dirname $($BREW ls -v libgccjit | \
  |                                                  grep libgccjit.h))"
  |            MAC_LIBS="-L$(dirname $($BREW ls -v libgccjit| \
  | -                                            grep -E 'libgccjit\.(so|dylib)$'))"
  | +                                            grep -E 'libgccjit\.(so|dylib)$'| \
  | +    head -n 1))"
  |          fi
  |        fi
  |  
  `----