pganalyze / pg_query

Ruby extension to parse, deparse and normalize SQL queries using the PostgreSQL query parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot install on M1 Mac

chalmagean opened this issue · comments

Hi,

I'm trying to install pg_query on an Apple M1 Mac (OSX 12.6)

❯ ruby -v
ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [arm64-darwin21]

Here's the error I'm getting:

current directory: /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query
/Users/cezar/.rbenv/versions/2.7.6/bin/ruby -I /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/2.7.0 -r ./siteconf20221024-19799-7z9osf.rb extconf.rb
creating Makefile

current directory: /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query
make "DESTDIR=" clean

current directory: /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query
make "DESTDIR="
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_backend_utils_mmgr_mcxt.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_backend_utils_error_elog.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/pg_query_split.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_backend_utils_mmgr_aset.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/pg_query.pb-c.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_common_string.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_common_encnames.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_port_random.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_backend_nodes_value.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/pg_query_outfuncs_protobuf.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_backend_nodes_makefuncs.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_pl_plpgsql_src_pl_handler.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_common_stringinfo.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_backend_nodes_extensible.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_backend_utils_adt_format_type.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_backend_parser_parser.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_port_snprintf.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
/Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_port_snprintf.c:1028:11: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
        vallen = sprintf(convert, "%p", value);
                 ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
/Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_port_snprintf.c:1210:13: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
                        vallen = sprintf(convert, fmt, prec, value);
                                 ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
/Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_port_snprintf.c:1217:13: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
                        vallen = sprintf(convert, fmt, value);
                                 ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
5 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_backend_parser_parse_expr.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/pg_query_normalize.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/pg_query_fingerprint.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_backend_libpq_pqcomm.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_port_pgstrcasecmp.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_backend_postmaster_postmaster.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_common_wchar.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_port_strerror.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_pl_plpgsql_src_pl_scanner.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/pg_query.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/guc-file.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_backend_nodes_nodeFuncs.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/pg_query_ruby.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_backend_nodes_equalfuncs.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/xxhash.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
2 warnings generated.
compiling /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_backend_parser_gram.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
In file included from gram.y:46:
In file included from /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/include/postgres.h:46:
In file included from /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/include/c.h:1330:
In file included from /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/include/port.h:17:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/netdb.h:91:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/netinet/in.h:81:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/socket.h:425:1: error: expected ';' after top level declarator
__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct sockaddr, sockaddr);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:587:101: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPES'
#define __CCT_DECLARE_CONSTRAINED_PTR_TYPES(basetype, basetag)                                      \
                                                                                                    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:580:2: note: expanded from macro '\
__CCT_DECLARE_CONSTRAINED_PTR_TYPE'
        __CCT_DISPATCH(__CCT_DECLARE_CONSTRAINED_PTR_TYPE, basetype, basetag, __VA_ARGS__)
        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:548:2: note: expanded from macro '__CCT_DISPATCH'
        __CCT_DISPATCH1(base, __CCT_COUNT_ARGS(__VA_ARGS__), __VA_ARGS__)
        ^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:113:26: note: expanded from macro '__CONCAT'
#define __CONCAT(x, y)   x ## y
                         ^
<scratch space>:415:1: note: expanded from here
__CCT_DECLARE_CONSTRAINED_PTR_TYPE_3
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:563:14: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPE_3'
        __CCT_DEFER(__CONCAT, basetag,  __CCT_CONTRACT_LIST_TO_TAGGED_SUFFIX_1(kind))
                    ^
In file included from gram.y:46:
In file included from /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/include/postgres.h:46:
In file included from /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/include/c.h:1330:
In file included from /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/include/port.h:17:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/netdb.h:91:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/netinet/in.h:81:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/socket.h:425:1: error: expected ';' after top level declarator
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:588:101: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPES'
__CCT_DECLARE_CONSTRAINED_PTR_TYPE(basetype, basetag, REF);                                         \
                                                                                                    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:580:2: note: expanded from macro '\
__CCT_DECLARE_CONSTRAINED_PTR_TYPE'
        __CCT_DISPATCH(__CCT_DECLARE_CONSTRAINED_PTR_TYPE, basetype, basetag, __VA_ARGS__)
        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:548:2: note: expanded from macro '__CCT_DISPATCH'
        __CCT_DISPATCH1(base, __CCT_COUNT_ARGS(__VA_ARGS__), __VA_ARGS__)
        ^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:113:26: note: expanded from macro '__CONCAT'
#define __CONCAT(x, y)   x ## y
                         ^
<scratch space>:420:1: note: expanded from here
__CCT_DECLARE_CONSTRAINED_PTR_TYPE_4
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:567:11: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPE_4'
                 * __CCT_CONTRACT_TO_ATTR(kind2)                                                        \
                 ^
In file included from gram.y:46:
In file included from /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/include/postgres.h:46:
In file included from /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/include/c.h:1330:
In file included from /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/include/port.h:17:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/netdb.h:91:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/netinet/in.h:81:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/socket.h:471:1: error: typedef redefinition with different types ('struct sockaddr_storage *' vs 'struct sockaddr *')
__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct sockaddr_storage, sockaddr_storage);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:587:101: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPES'
#define __CCT_DECLARE_CONSTRAINED_PTR_TYPES(basetype, basetag)                                      \
                                                                                                    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:580:2: note: expanded from macro '\
__CCT_DECLARE_CONSTRAINED_PTR_TYPE'
        __CCT_DISPATCH(__CCT_DECLARE_CONSTRAINED_PTR_TYPE, basetype, basetag, __VA_ARGS__)
        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:548:2: note: expanded from macro '__CCT_DISPATCH'
        __CCT_DISPATCH1(base, __CCT_COUNT_ARGS(__VA_ARGS__), __VA_ARGS__)
        ^
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:540:38: note: expanded from macro '__CCT_CONTRACT_TO_ATTR'
#define __CCT_CONTRACT_TO_ATTR(kind) __CONCAT(__CCT_CONTRACT_ATTR_, kind)
                                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:113:26: note: expanded from macro '__CONCAT'
#define __CONCAT(x, y)   x ## y
                         ^
<scratch space>:429:1: note: expanded from here
__CCT_CONTRACT_ATTR_582
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/socket.h:425:1: note: previous definition is here
__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct sockaddr, sockaddr);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:588:101: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPES'
__CCT_DECLARE_CONSTRAINED_PTR_TYPE(basetype, basetag, REF);                                         \
                                                                                                    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:580:2: note: expanded from macro '\
__CCT_DECLARE_CONSTRAINED_PTR_TYPE'
        __CCT_DISPATCH(__CCT_DECLARE_CONSTRAINED_PTR_TYPE, basetype, basetag, __VA_ARGS__)
        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:548:2: note: expanded from macro '__CCT_DISPATCH'
        __CCT_DISPATCH1(base, __CCT_COUNT_ARGS(__VA_ARGS__), __VA_ARGS__)
        ^
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:540:38: note: expanded from macro '__CCT_CONTRACT_TO_ATTR'
#define __CCT_CONTRACT_TO_ATTR(kind) __CONCAT(__CCT_CONTRACT_ATTR_, kind)
                                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:113:26: note: expanded from macro '__CONCAT'
#define __CONCAT(x, y)   x ## y
                         ^
<scratch space>:421:1: note: expanded from here
__CCT_CONTRACT_ATTR_582
^
In file included from gram.y:46:
In file included from /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/include/postgres.h:46:
In file included from /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/include/c.h:1330:
In file included from /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/include/port.h:17:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/netdb.h:91:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/netinet/in.h:81:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/socket.h:471:1: error: expected ';' after top level declarator
__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct sockaddr_storage, sockaddr_storage);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:587:101: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPES'
#define __CCT_DECLARE_CONSTRAINED_PTR_TYPES(basetype, basetag)                                      \
                                                                                                    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:580:2: note: expanded from macro '\
__CCT_DECLARE_CONSTRAINED_PTR_TYPE'
        __CCT_DISPATCH(__CCT_DECLARE_CONSTRAINED_PTR_TYPE, basetype, basetag, __VA_ARGS__)
        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:548:2: note: expanded from macro '__CCT_DISPATCH'
        __CCT_DISPATCH1(base, __CCT_COUNT_ARGS(__VA_ARGS__), __VA_ARGS__)
        ^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:113:26: note: expanded from macro '__CONCAT'
#define __CONCAT(x, y)   x ## y
                         ^
<scratch space>:428:1: note: expanded from here
__CCT_DECLARE_CONSTRAINED_PTR_TYPE_3
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:563:14: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPE_3'
        __CCT_DEFER(__CONCAT, basetag,  __CCT_CONTRACT_LIST_TO_TAGGED_SUFFIX_1(kind))
                    ^
In file included from gram.y:46:
In file included from /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/include/postgres.h:46:
In file included from /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/include/c.h:1330:
In file included from /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/include/port.h:17:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/netdb.h:91:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/netinet/in.h:81:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/socket.h:471:1: error: typedef redefinition with different types ('struct sockaddr_storage *' vs 'struct sockaddr *')
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:588:101: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPES'
__CCT_DECLARE_CONSTRAINED_PTR_TYPE(basetype, basetag, REF);                                         \
                                                                                                    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:580:2: note: expanded from macro '\
__CCT_DECLARE_CONSTRAINED_PTR_TYPE'
        __CCT_DISPATCH(__CCT_DECLARE_CONSTRAINED_PTR_TYPE, basetype, basetag, __VA_ARGS__)
        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:548:2: note: expanded from macro '__CCT_DISPATCH'
        __CCT_DISPATCH1(base, __CCT_COUNT_ARGS(__VA_ARGS__), __VA_ARGS__)
        ^
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:540:38: note: expanded from macro '__CCT_CONTRACT_TO_ATTR'
#define __CCT_CONTRACT_TO_ATTR(kind) __CONCAT(__CCT_CONTRACT_ATTR_, kind)
                                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:113:26: note: expanded from macro '__CONCAT'
#define __CONCAT(x, y)   x ## y
                         ^
<scratch space>:6:1: note: expanded from here
__CCT_CONTRACT_ATTR_582
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/socket.h:425:1: note: previous definition is here
__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct sockaddr, sockaddr);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:588:101: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPES'
__CCT_DECLARE_CONSTRAINED_PTR_TYPE(basetype, basetag, REF);                                         \
                                                                                                    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:580:2: note: expanded from macro '\
__CCT_DECLARE_CONSTRAINED_PTR_TYPE'
        __CCT_DISPATCH(__CCT_DECLARE_CONSTRAINED_PTR_TYPE, basetype, basetag, __VA_ARGS__)
        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:548:2: note: expanded from macro '__CCT_DISPATCH'
        __CCT_DISPATCH1(base, __CCT_COUNT_ARGS(__VA_ARGS__), __VA_ARGS__)
        ^
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:540:38: note: expanded from macro '__CCT_CONTRACT_TO_ATTR'
#define __CCT_CONTRACT_TO_ATTR(kind) __CONCAT(__CCT_CONTRACT_ATTR_, kind)
                                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:113:26: note: expanded from macro '__CONCAT'
#define __CONCAT(x, y)   x ## y
                         ^
<scratch space>:421:1: note: expanded from here
__CCT_CONTRACT_ATTR_582
^
In file included from gram.y:46:
In file included from /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/include/postgres.h:46:
In file included from /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/include/c.h:1330:
In file included from /Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/include/port.h:17:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/netdb.h:91:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/netinet/in.h:81:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/socket.h:471:1: error: expected ';' after top level declarator
__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct sockaddr_storage, sockaddr_storage);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:588:101: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPES'
__CCT_DECLARE_CONSTRAINED_PTR_TYPE(basetype, basetag, REF);                                         \
                                                                                                    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:580:2: note: expanded from macro '\
__CCT_DECLARE_CONSTRAINED_PTR_TYPE'
        __CCT_DISPATCH(__CCT_DECLARE_CONSTRAINED_PTR_TYPE, basetype, basetag, __VA_ARGS__)
        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:548:2: note: expanded from macro '__CCT_DISPATCH'
        __CCT_DISPATCH1(base, __CCT_COUNT_ARGS(__VA_ARGS__), __VA_ARGS__)
        ^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:113:26: note: expanded from macro '__CONCAT'
#define __CONCAT(x, y)   x ## y
                         ^
<scratch space>:5:1: note: expanded from here
__CCT_DECLARE_CONSTRAINED_PTR_TYPE_4
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:567:11: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPE_4'
                 * __CCT_CONTRACT_TO_ATTR(kind2)                                                        \
                 ^
2 warnings and 6 errors generated.
make: *** [/Users/cezar/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/pg_query-2.1.4/ext/pg_query/src_backend_parser_gram.o] Error 1

make failed, exit code 2

Got it working with xcode-select --install.

Same issue for me today with pg_query 2.1.4 on an Apple M1 Mac (OSX 13) with xcode 14.1:


Building native extensions. This could take a while...
ERROR:  Error installing pg_query:
	ERROR: Failed to build gem native extension.

    current directory: /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query
/Users/arnaud/.rbenv/versions/3.1.2/bin/ruby -I /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/3.1.0 -r ./siteconf20221102-7575-bt8897.rb extconf.rb
creating Makefile

current directory: /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query
make DESTDIR\= clean

current directory: /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query
make DESTDIR\=
compiling /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query/guc-file.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
...
compiling /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query/src_backend_parser_gram.c
warning: unknown warning option '-Wno-clobbered' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-discarded-qualifiers'; did you mean '-Wno-ignored-qualifiers'? [-Wunknown-warning-option]
In file included from gram.y:46:
In file included from /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query/include/postgres.h:46:
In file included from /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query/include/c.h:1330:
In file included from /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query/include/port.h:17:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netdb.h:91:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/in.h:81:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/socket.h:425:1: error: expected ';' after top level declarator
__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct sockaddr, sockaddr);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:587:101: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPES'
#define __CCT_DECLARE_CONSTRAINED_PTR_TYPES(basetype, basetag)                                      \
                                                                                                    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:580:2: note: expanded from macro '\
__CCT_DECLARE_CONSTRAINED_PTR_TYPE'
        __CCT_DISPATCH(__CCT_DECLARE_CONSTRAINED_PTR_TYPE, basetype, basetag, __VA_ARGS__)
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:548:2: note: expanded from macro '__CCT_DISPATCH'
        __CCT_DISPATCH1(base, __CCT_COUNT_ARGS(__VA_ARGS__), __VA_ARGS__)
        ^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:113:26: note: expanded from macro '__CONCAT'
#define __CONCAT(x, y)   x ## y
                         ^
<scratch space>:415:1: note: expanded from here
__CCT_DECLARE_CONSTRAINED_PTR_TYPE_3
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:563:14: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPE_3'
        __CCT_DEFER(__CONCAT, basetag,  __CCT_CONTRACT_LIST_TO_TAGGED_SUFFIX_1(kind))
                    ^
In file included from gram.y:46:
In file included from /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query/include/postgres.h:46:
In file included from /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query/include/c.h:1330:
In file included from /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query/include/port.h:17:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netdb.h:91:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/in.h:81:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/socket.h:425:1: error: expected ';' after top level declarator
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:588:101: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPES'
__CCT_DECLARE_CONSTRAINED_PTR_TYPE(basetype, basetag, REF);                                         \
                                                                                                    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:580:2: note: expanded from macro '\
__CCT_DECLARE_CONSTRAINED_PTR_TYPE'
        __CCT_DISPATCH(__CCT_DECLARE_CONSTRAINED_PTR_TYPE, basetype, basetag, __VA_ARGS__)
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:548:2: note: expanded from macro '__CCT_DISPATCH'
        __CCT_DISPATCH1(base, __CCT_COUNT_ARGS(__VA_ARGS__), __VA_ARGS__)
        ^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:113:26: note: expanded from macro '__CONCAT'
#define __CONCAT(x, y)   x ## y
                         ^
<scratch space>:420:1: note: expanded from here
__CCT_DECLARE_CONSTRAINED_PTR_TYPE_4
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:567:11: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPE_4'
                 * __CCT_CONTRACT_TO_ATTR(kind2)                                                        \
                 ^
In file included from gram.y:46:
In file included from /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query/include/postgres.h:46:
In file included from /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query/include/c.h:1330:
In file included from /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query/include/port.h:17:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netdb.h:91:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/in.h:81:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/socket.h:471:1: error: typedef redefinition with different types ('struct sockaddr_storage *' vs 'struct sockaddr *')
__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct sockaddr_storage, sockaddr_storage);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:587:101: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPES'
#define __CCT_DECLARE_CONSTRAINED_PTR_TYPES(basetype, basetag)                                      \
                                                                                                    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:580:2: note: expanded from macro '\
__CCT_DECLARE_CONSTRAINED_PTR_TYPE'
        __CCT_DISPATCH(__CCT_DECLARE_CONSTRAINED_PTR_TYPE, basetype, basetag, __VA_ARGS__)
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:548:2: note: expanded from macro '__CCT_DISPATCH'
        __CCT_DISPATCH1(base, __CCT_COUNT_ARGS(__VA_ARGS__), __VA_ARGS__)
        ^
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:540:38: note: expanded from macro '__CCT_CONTRACT_TO_ATTR'
#define __CCT_CONTRACT_TO_ATTR(kind) __CONCAT(__CCT_CONTRACT_ATTR_, kind)
                                     ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:113:26: note: expanded from macro '__CONCAT'
#define __CONCAT(x, y)   x ## y
                         ^
<scratch space>:429:1: note: expanded from here
__CCT_CONTRACT_ATTR_582
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/socket.h:425:1: note: previous definition is here
__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct sockaddr, sockaddr);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:588:101: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPES'
__CCT_DECLARE_CONSTRAINED_PTR_TYPE(basetype, basetag, REF);                                         \
                                                                                                    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:580:2: note: expanded from macro '\
__CCT_DECLARE_CONSTRAINED_PTR_TYPE'
        __CCT_DISPATCH(__CCT_DECLARE_CONSTRAINED_PTR_TYPE, basetype, basetag, __VA_ARGS__)
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:548:2: note: expanded from macro '__CCT_DISPATCH'
        __CCT_DISPATCH1(base, __CCT_COUNT_ARGS(__VA_ARGS__), __VA_ARGS__)
        ^
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:540:38: note: expanded from macro '__CCT_CONTRACT_TO_ATTR'
#define __CCT_CONTRACT_TO_ATTR(kind) __CONCAT(__CCT_CONTRACT_ATTR_, kind)
                                     ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:113:26: note: expanded from macro '__CONCAT'
#define __CONCAT(x, y)   x ## y
                         ^
<scratch space>:421:1: note: expanded from here
__CCT_CONTRACT_ATTR_582
^
In file included from gram.y:46:
In file included from /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query/include/postgres.h:46:
In file included from /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query/include/c.h:1330:
In file included from /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query/include/port.h:17:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netdb.h:91:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/in.h:81:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/socket.h:471:1: error: expected ';' after top level declarator
__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct sockaddr_storage, sockaddr_storage);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:587:101: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPES'
#define __CCT_DECLARE_CONSTRAINED_PTR_TYPES(basetype, basetag)                                      \
                                                                                                    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:580:2: note: expanded from macro '\
__CCT_DECLARE_CONSTRAINED_PTR_TYPE'
        __CCT_DISPATCH(__CCT_DECLARE_CONSTRAINED_PTR_TYPE, basetype, basetag, __VA_ARGS__)
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:548:2: note: expanded from macro '__CCT_DISPATCH'
        __CCT_DISPATCH1(base, __CCT_COUNT_ARGS(__VA_ARGS__), __VA_ARGS__)
        ^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:113:26: note: expanded from macro '__CONCAT'
#define __CONCAT(x, y)   x ## y
                         ^
<scratch space>:428:1: note: expanded from here
__CCT_DECLARE_CONSTRAINED_PTR_TYPE_3
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:563:14: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPE_3'
        __CCT_DEFER(__CONCAT, basetag,  __CCT_CONTRACT_LIST_TO_TAGGED_SUFFIX_1(kind))
                    ^
In file included from gram.y:46:
In file included from /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query/include/postgres.h:46:
In file included from /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query/include/c.h:1330:
In file included from /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query/include/port.h:17:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netdb.h:91:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/in.h:81:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/socket.h:471:1: error: typedef redefinition with different types ('struct sockaddr_storage *' vs 'struct sockaddr *')
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:588:101: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPES'
__CCT_DECLARE_CONSTRAINED_PTR_TYPE(basetype, basetag, REF);                                         \
                                                                                                    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:580:2: note: expanded from macro '\
__CCT_DECLARE_CONSTRAINED_PTR_TYPE'
        __CCT_DISPATCH(__CCT_DECLARE_CONSTRAINED_PTR_TYPE, basetype, basetag, __VA_ARGS__)
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:548:2: note: expanded from macro '__CCT_DISPATCH'
        __CCT_DISPATCH1(base, __CCT_COUNT_ARGS(__VA_ARGS__), __VA_ARGS__)
        ^
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:540:38: note: expanded from macro '__CCT_CONTRACT_TO_ATTR'
#define __CCT_CONTRACT_TO_ATTR(kind) __CONCAT(__CCT_CONTRACT_ATTR_, kind)
                                     ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:113:26: note: expanded from macro '__CONCAT'
#define __CONCAT(x, y)   x ## y
                         ^
<scratch space>:6:1: note: expanded from here
__CCT_CONTRACT_ATTR_582
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/socket.h:425:1: note: previous definition is here
__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct sockaddr, sockaddr);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:588:101: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPES'
__CCT_DECLARE_CONSTRAINED_PTR_TYPE(basetype, basetag, REF);                                         \
                                                                                                    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:580:2: note: expanded from macro '\
__CCT_DECLARE_CONSTRAINED_PTR_TYPE'
        __CCT_DISPATCH(__CCT_DECLARE_CONSTRAINED_PTR_TYPE, basetype, basetag, __VA_ARGS__)
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:548:2: note: expanded from macro '__CCT_DISPATCH'
        __CCT_DISPATCH1(base, __CCT_COUNT_ARGS(__VA_ARGS__), __VA_ARGS__)
        ^
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:540:38: note: expanded from macro '__CCT_CONTRACT_TO_ATTR'
#define __CCT_CONTRACT_TO_ATTR(kind) __CONCAT(__CCT_CONTRACT_ATTR_, kind)
                                     ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:113:26: note: expanded from macro '__CONCAT'
#define __CONCAT(x, y)   x ## y
                         ^
<scratch space>:421:1: note: expanded from here
__CCT_CONTRACT_ATTR_582
^
In file included from gram.y:46:
In file included from /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query/include/postgres.h:46:
In file included from /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query/include/c.h:1330:
In file included from /Users/arnaud/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg_query-2.1.4/ext/pg_query/include/port.h:17:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netdb.h:91:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/in.h:81:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/socket.h:471:1: error: expected ';' after top level declarator
__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct sockaddr_storage, sockaddr_storage);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:588:101: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPES'
__CCT_DECLARE_CONSTRAINED_PTR_TYPE(basetype, basetag, REF);                                         \
                                                                                                    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:580:2: note: expanded from macro '\
__CCT_DECLARE_CONSTRAINED_PTR_TYPE'
        __CCT_DISPATCH(__CCT_DECLARE_CONSTRAINED_PTR_TYPE, basetype, basetag, __VA_ARGS__)
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:548:2: note: expanded from macro '__CCT_DISPATCH'
        __CCT_DISPATCH1(base, __CCT_COUNT_ARGS(__VA_ARGS__), __VA_ARGS__)
        ^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:113:26: note: expanded from macro '__CONCAT'
#define __CONCAT(x, y)   x ## y
                         ^
<scratch space>:5:1: note: expanded from here
__CCT_DECLARE_CONSTRAINED_PTR_TYPE_4
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/constrained_ctypes.h:567:11: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPE_4'
                 * __CCT_CONTRACT_TO_ATTR(kind2)                                                        \
                 ^

This should be reopened, the build is broken with xcode CLT 14 and 14.1 and if you're on macOS 13, you cannot downgrade. I've been unable to find any workaround to get it to compile.

Yes. I tried to reinstall Xcode and it's tools but I don't find any solution. If I downgrade Xcode, Homebrew doesn't work.

Tracked in #263 - we should have a release out shortly.

This has been released as 2.2.0!

Thanks for the quick fix.