Re: PostgreSQL does not compile on macOS SDK 15.0
Stan Hu <stanhu@gmail.com>
From: Stan Hu <stanhu@gmail.com>
To: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-06-24T19:25:05Z
Lists: pgsql-hackers
It appears in macOS SDK 14.5, there were include guards in
$SDK_ROOT/usr/include/xlocale/_regex.h:
#ifndef _XLOCALE__REGEX_H_
#define _XLOCALE__REGEX_H_
#ifndef _REGEX_H_
#include <_regex.h>
#endif // _REGEX_H_
#include <_xlocale.h>
In macOS SDK 15.5, these include guards are gone:
#ifndef _XLOCALE__REGEX_H_
#define _XLOCALE__REGEX_H_
#include <_regex.h>
#include <__xlocale.h>
Since _REGEX_H_ was defined locally in PostgreSQL's version of
src/include/regex/regex.h, these include guards prevented duplicate
definitions from /usr/include/_regex.h (not to be confused with
/usr/include/xlocale/_regex.h).
If I hack the PostgreSQL src/include/regex/regex.h to include the double
underscore include guard of __REGEX_H_, the build succeeds:
```
diff --git a/src/include/regex/regex.h b/src/include/regex/regex.h
index d08113724f..734172167a 100644
--- a/src/include/regex/regex.h
+++ b/src/include/regex/regex.h
@@ -1,3 +1,6 @@
+#ifndef __REGEX_H_
+#define __REGEX_H_ /* never again */
+
#ifndef _REGEX_H_
#define _REGEX_H_ /* never again */
/*
@@ -187,3 +190,5 @@ extern bool RE_compile_and_execute(text *text_re, char
*dat, int dat_len,
int nmatch, regmatch_t *pmatch);
#endif /* _REGEX_H_ */
+
+#endif /* __REGEX_H_ */
```
Any better ideas here?
Commits
-
Cope with <regex.h> name clashes.
- 9c273679b36b 17.0 landed
- 31423bc4489d 16.4 landed
- 467d77bb1634 15.8 landed
- c2342a925b70 14.13 landed
- 440aedc0fb18 13.16 landed
- 274a8195d479 12.20 landed
- 2a5ef0983040 18.0 landed