Repository navigation
SQLc failing to build due to upstream dependency due to sprintf deprecation (affects MacOS Ventura) #1956
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
Description
Version
Other
What happened?
Current versions of SQLc are failing to build on latest version of XCode / MacOS Ventura.
This is due to a sprintf deprecation in pg_query_go which is used by SQLc see pganalyze/pg_query_go#67 for more.
The issue is fixed upstream which I've been able to reproduce locally by merging in the C code from https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/port/snprintf.c;h=81d9c8c2740d1b90b69077cb3b5a1d9576e51dad;hb=450ee701261a7ff5fe35842b91384eea46e81c2e into my local build.
Relevant log output
go install github.com/kyleconroy/sqlc/cmd/sqlc@v1.14.0
# github.com/pganalyze/pg_query_go/v2/parser
In file included from gram.y:46:
In file included from ../../../../pkg/mod/github.com/pganalyze/pg_query_go/v2@v2.1.0/parser/include/postgres.h:46:
In file included from ../../../../pkg/mod/github.com/pganalyze/pg_query_go/v2@v2.1.0/parser/include/c.h:1330:
In file included from ../../../../pkg/mod/github.com/pganalyze/pg_query_go/v2@v2.1.0/parser/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:587:101: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPES'
/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'
/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'
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'
<scratch space>:413:1: note: expanded from here
/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'
In file included from gram.y:46:
In file included from ../../../../pkg/mod/github.com/pganalyze/pg_query_go/v2@v2.1.0/parser/include/postgres.h:46:
In file included from ../../../../pkg/mod/github.com/pganalyze/pg_query_go/v2@v2.1.0/parser/include/c.h:1330:
In file included from ../../../../pkg/mod/github.com/pganalyze/pg_query_go/v2@v2.1.0/parser/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'
/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'
/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'
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'
<scratch space>:418:1: note: expanded from here
/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'
In file included from gram.y:46:
In file included from ../../../../pkg/mod/github.com/pganalyze/pg_query_go/v2@v2.1.0/parser/include/postgres.h:46:
In file included from ../../../../pkg/mod/github.com/pganalyze/pg_query_go/v2@v2.1.0/parser/include/c.h:1330:
In file included from ../../../../pkg/mod/github.com/pganalyze/pg_query_go/v2@v2.1.0/parser/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:587:101: note: expanded from macro '__CCT_DECLARE_CONSTRAINED_PTR_TYPES'
/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'
/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'
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'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:113:26: note: expanded from macro '__CONCAT'
<scratch space>:427:1: note: expanded from here
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/socket.h:425:1: note: previous definition is here
/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'
/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'
/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'
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'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:113:26: note: expanded from macro '__CONCAT'
<scratch space>:419:1: note: expanded from here
In file included from gram.y:46:
In file included from ../../../../pkg/mod/github.com/pganalyze/pg_query_go/v2@v2.1.0/parser/include/postgres.h:46:
In file included from ../../../../pkg/mod/github.com/pganalyze/pg_query_go/v2@v2.1.0/parser/include/c.h:1330:
In file included from ../../../../pkg/mod/github.com/pganalyze/pg_query_go/v2@v2.1.0/parser/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
/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'
/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'
/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'
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'
<scratch space>:426:1: note: expanded from here
/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'
In file included from gram.y:46:
In file included from ../../../../pkg/mod/github.com/pganalyze/pg_query_go/v2@v2.1.0/parser/include/postgres.h:46:
In file included from ../../../../pkg/mod/github.com/pganalyze/pg_query_go/v2@v2.1.0/parser/include/c.h:1330:
In file included from ../../../../pkg/mod/github.com/pganalyze/pg_query_go/v2@v2.1.0/parser/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'
/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'
/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'
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'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:113:26: note: expanded from macro '__CONCAT'
<scratch space>:6:1: note: expanded from here
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/socket.h:425:1: note: previous definition is here
/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'
/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'
/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'
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'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:113:26: note: expanded from macro '__CONCAT'
<scratch space>:419:1: note: expanded from here
In file included from gram.y:46:
In file included from ../../../../pkg/mod/github.com/pganalyze/pg_query_go/v2@v2.1.0/parser/include/postgres.h:46:
In file included from ../../../../pkg/mod/github.com/pganalyze/pg_query_go/v2@v2.1.0/parser/include/c.h:1330:
In file included from ../../../../pkg/mod/github.com/pganalyze/pg_query_go/v2@v2.1.0/parser/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
/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'
/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'
/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'
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'
<scratch space>:5:1: note: expanded from here
/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'
make: *** [pre-reqs] Error 2Database schema
naSQL queries
naConfiguration
naPlayground URL
na
What operating system are you using?
macOS
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go
Reactions are currently unavailable
Activity
MarioCarrion commentedon Nov 26, 2022
Waiting for upstream to be fixed is better but if you're willing to upgrade to 1.16.0 instead:
go install github.com/kyleconroy/sqlc/cmd/sqlc@v1.16.0may work in your case, I'm not getting any errors so far running 1.16.0; it will still print out the warnings though:
andrewmbenton commentedon Jun 6, 2023
I believe this is resolved in newer versions of sqlc, but please reopen if there's still an outstanding issue.
tschaub commentedon Jun 7, 2023
I just upgraded to
github.com/kyleconroy/sqlc v1.18.0and am seeing this output:@andrewmbenton - do you think this warrants a new issue?
tschaub commentedon Jun 7, 2023
I just noticed that upgrading the transitive dependency to
github.com/pganalyze/pg_query_go/v4 v4.2.1(was previouslyv4.2.0) gets rid of the output above for me.MarioCarrion commentedon Jun 7, 2023
Sounds like 1.8.0 is still using the previous version https://github.com/kyleconroy/sqlc/blob/v1.18.0/go.mod#L17 I suppose new release should fix this issue.
andrewmbenton commentedon Jun 20, 2023
github.com/pganalyze/pg_query_go/v4got a version bump in #2289 so v1.19.0 should resolve your issue @tschaub.