Re: PostgreSQL does not compile on macOS SDK 15.0

From: Stan Hu <stanhu(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: PostgreSQL does not compile on macOS SDK 15.0
Date: 2024-06-24 19:25:05
Message-ID: CAMBWrQ=F9SSPfsFtCv=JT51WGK2VcgLA+iiJJOmjN0zbbufOEA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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?

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2024-06-24 19:31:29 Re: Vacuum ERRORs out considering freezing dead tuples from before OldestXmin
Previous Message Melanie Plageman 2024-06-24 19:23:39 Re: Vacuum ERRORs out considering freezing dead tuples from before OldestXmin