Paul Eggert wrote:
> In the regex code, use the char32_t functions instead of the
> wchar_t functions
Very nice! This finally implements support for all of Unicode
in GNU grep for Cygwin.
I had planned to do this change, but — since I'm not familiar with the
regex code — I wanted to have a good test coverage in regex-tests first;
and that project is only 10% done.
The patch introduces a link error on macOS and FreeBSD:
/Users/runner/work/ci-testdir-check/ci-testdir-check/macos-compile clang
-std=gnu23 -Wno-error -Wno-error -g -O2 -L/Users/runner/lib
-L/opt/homebrew/opt/gettext/lib -L/opt/homebrew/opt/libiconv/lib -o test-regex
test-regex.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a
libtests.a -lintl -Wl,-framework -Wl,CoreFoundation -Wl,-framework
-Wl,CoreServices -lbacktrace
ld: warning: ignoring duplicate libraries: '../gllib/libgnu.a', 'libtests.a'
Undefined symbols for architecture arm64:
"_libiconv", referenced from:
_locale_encoding_to_unicode in libgnu.a[614](lc-charset-unicode.o)
_unicode_to_locale_encoding in libgnu.a[614](lc-charset-unicode.o)
"_libiconv_close", referenced from:
_get_converters in libgnu.a[614](lc-charset-unicode.o)
_get_converters in libgnu.a[614](lc-charset-unicode.o)
_get_converters in libgnu.a[614](lc-charset-unicode.o)
_get_converters in libgnu.a[614](lc-charset-unicode.o)
_get_converters in libgnu.a[614](lc-charset-unicode.o)
_get_converters in libgnu.a[614](lc-charset-unicode.o)
_free_converters in libgnu.a[614](lc-charset-unicode.o)
_free_converters in libgnu.a[614](lc-charset-unicode.o)
...
"_libiconv_open", referenced from:
_get_converters in libgnu.a[614](lc-charset-unicode.o)
_get_converters in libgnu.a[614](lc-charset-unicode.o)
_get_converters in libgnu.a[614](lc-charset-unicode.o)
_get_converters in libgnu.a[614](lc-charset-unicode.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[4]: *** [test-regex] Error 1
This patch fixes it.
2026-04-25 Bruno Haible <[email protected]>
regex: Fix link error on macOS and FreeBSD (regression yesterday).
* modules/regex (Link): Add $(LIBUNISTRING), $(LIBC32CONV).
* modules/regex-tests (Makefile.am): Link test-regex with
$(LIBUNISTRING) and $(LIBC32CONV).
diff --git a/modules/regex b/modules/regex
index 9cb277618b..d3e3ad326d 100644
--- a/modules/regex
+++ b/modules/regex
@@ -70,7 +70,9 @@ Include:
<regex.h>
Link:
+$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
$(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
$(LIBTHREAD)
$(LTLIBINTL) when linking with libtool, $(LIBINTL) otherwise
diff --git a/modules/regex-tests b/modules/regex-tests
index 79a0ec04f6..1eea754c5c 100644
--- a/modules/regex-tests
+++ b/modules/regex-tests
@@ -14,4 +14,4 @@ AC_CHECK_DECLS_ONCE([alarm])
Makefile.am:
TESTS += test-regex
check_PROGRAMS += test-regex
-test_regex_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) @LIBINTL@
$(LIBTHREAD)
+test_regex_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
@LIBINTL@ $(LIBC32CONV) $(LIBTHREAD)