sqlc: The tool stopped working on MacOS 15.4
Version
1.28.0
What happened?
Running the tool via:
go run -mod=mod github.com/sqlc-dev/sqlc/cmd/sqlc generate
Getting the log:
Relevant log output
# github.com/pganalyze/pg_query_go/v5/parser
src_port_snprintf.c:374:1: error: static declaration of 'strchrnul' follows non-static declaration
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_string.h:198:9: note: previous declaration is here
src_port_snprintf.c:438:27: warning: 'strchrnul' is only available on macOS 15.4 or newer [-Wunguarded-availability-new]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_string.h:198:9: note: 'strchrnul' has been marked as being introduced in macOS 15.4 here, but the deployment target is macOS 15.0.0
src_port_snprintf.c:438:27: note: enclose 'strchrnul' in a __builtin_available check to silence this warning
Database schema
Any schema
SQL queries
Any queries
Configuration
Fails even without any config
Playground URL
I think it’s clear without it
What operating system are you using?
MacOS 15.4
What database engines are you using?
Postgres
What type of code are you generating?
Go code
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 28
- Comments: 22
I was able to get around this by adding this to my zshrc
export CGO_CFLAGS="-DHAVE_STRCHRNUL"export CGO_CFLAGS="-DHAVE_STRCHRNUL -mmacosx-version-min=15.4"export MACOSX_DEPLOYMENT_TARGET="15.4"This is a temporary solution that worked for me until it gets fixed.
1.29.0 is out!
That’s me! Been busy at work but trying to create a release in the next two days. Thanks for understanding.
If I understand correctly, we need the
pg_query_goupgrade (which is part of https://github.com/sqlc-dev/sqlc/pull/3922) and then we need a new release ofsqlc. Any chance we can get a timeline on these changes? Thanks!sqlc from
main, withgithub.com/pganalyze/pg_query_go/v6@v6.1.0seems to work too.@kyleconroy yay! Latest
mainworks fine. Thank you!In docs, one way to install sqlc is
and latest points to the version that was released in January. I’d suggest maybe do a GH release as well or update the docs.
And, the side note – thank you for building sqlc! The thing is amazing and has helped a lot!
@vladmiller good catch, I need to run
go mod tidy. It’s an indirect import, so I may need to upgrade the wasilibs dependency as well.Not sure if this helps. I stumbled across this issue while looking for a solution to the same problem with the ruby gem
pg_query. https://github.com/pganalyze/pg_query/issues/327