Here's a patch that I was able to apply to the code base that allowed me to
cross-compile for Windows using the Autotools toolkit, and solved the
problem of the missing regex.h header in diatheke. I will also attach the
patch file to this email directly. I think the discrepancy happens because
glibc doesn't come along with most MinGW toolkits in the same way, and it's
lacking regex.h. It seems to be pretty standard to have that header in
Linux or Unix systems, so on those platforms the internal regex.h would not
commonly be used.

--- a/utilities/diatheke/Makefile.am
+++ b/utilities/diatheke/Makefile.am
@@ -1,5 +1,8 @@
AUTOMAKE_OPTIONS = 1.6

+if USE_INTERNAL_REGEX
+AM_CPPFLAGS = -I$(top_srcdir)/include/internal/regex
+endif
LDADD = $(top_builddir)/lib/libsword.la

bin_PROGRAMS = diatheke



On Thu, Oct 24, 2024 at 10:40 AM Greg Hellings <greg.helli...@gmail.com>
wrote:

> I'm trying to build SWORD in an environment without a system regex.h. The
> library build itself goes great, but diatheke fails to find the internal
> regex.h file, ending with this error.
>
> sword-x86_64-w64-mingw32> corediatheke.cpp:29:10: fatal error: regex.h: No
> such file or directory
> sword-x86_64-w64-mingw32>    29 | #include <regex.h>
> sword-x86_64-w64-mingw32>       |          ^~~~~~~~~
> sword-x86_64-w64-mingw32> compilation terminated.
>
> The offending invocation of the compiler is:
> x86_64-w64-mingw32-g++ -DHAVE_CONFIG_H -I. -I../../include    -Ofast -fPIC
> -D_ICU_ -DCURLAVAILABLE
> -I/nix/store/mkzj31p69kxrhar1b2l5vq7hkd1n45i4-curl-x86_64-w64-mingw32-8.9.1-dev/include
> -DCURLSFTPAVAILABLE -DUSEICUREGEX  -Wno-address -Wno-nonnull-compare
> -Wno-unused-but-set-variable -Wno-unknown-warning-option
> -DU_USING_ICU_NAMESPACE=1 -Wint-to-pointer-cast -fpermissive -D_ICUSWORD_
> -DCURL_STATICLIB -ftemplate-depth=100 -c -o corediatheke.o corediatheke.cpp
>
> I have tried this both with the -DUSEICUREGEX and with only the internal
> version, but that doesn't seem to affect this. It looks like the diatheke
> compile invocation needs to include -I../include/interna/regex when the
> internal regex.h is requested.
>
> Am I missing something to set that flag?
>
> --Greg
>
diff --git a/utilities/diatheke/Makefile.am b/utilities/diatheke/Makefile.am
index 8ba34e5..545af2c 100644
--- a/utilities/diatheke/Makefile.am
+++ b/utilities/diatheke/Makefile.am
@@ -1,5 +1,8 @@
 AUTOMAKE_OPTIONS = 1.6
 
+if USE_INTERNAL_REGEX
+AM_CPPFLAGS = -I$(top_srcdir)/include/internal/regex
+endif
 LDADD = $(top_builddir)/lib/libsword.la
 
 bin_PROGRAMS = diatheke
_______________________________________________
sword-devel mailing list: sword-devel@crosswire.org
http://crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page

Reply via email to