Skip to content

The tool stopped working on MacOS 15.4 #3916

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
legosx opened this issue Apr 2, 2025 · 22 comments
Closed

The tool stopped working on MacOS 15.4 #3916

legosx opened this issue Apr 2, 2025 · 22 comments

Comments

@legosx
Copy link

legosx commented Apr 2, 2025

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

@legosx legosx added the bug Something isn't working label Apr 2, 2025
@hishamk
Copy link

hishamk commented Apr 2, 2025

Same error as well

@hishamk
Copy link

hishamk commented Apr 2, 2025

Set export MACOSX_DEPLOYMENT_TARGET=15.4

But the static declaration is causing issues:

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
db/db.go:21: running "go": exit status 1

@jrmullins
Copy link

I was able to get around this by adding this to my zshrc

export CGO_CFLAGS="-DHAVE_STRCHRNUL"

@havsar
Copy link

havsar commented Apr 2, 2025

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.

@nginx-nickc
Copy link

sqlc from main, with github.com/pganalyze/pg_query_go/[email protected] seems to work too.

@rubberduck203
Copy link

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.
pganalyze/pg_query#327

@pgr0ss
Copy link

pgr0ss commented Apr 7, 2025

If I understand correctly, we need the pg_query_go upgrade (which is part of #3922) and then we need a new release of sqlc. Any chance we can get a timeline on these changes? Thanks!

@kyleconroy
Copy link
Collaborator

Yep! New release was supposed to go out last week, but I'm glad I waited for pg_query_go 6.1.0 to land

@kyleconroy
Copy link
Collaborator

The upgrade to pg_query_go 6.1.0 has been merged. For those that can, please build from main and let me know if your issue is fixed.

@connor15mcc
Copy link

The upgraded pg_query_go (from main) fixes this for me. Thanks! Will wait for a release

@vladmiller
Copy link

@kyleconroy @connor15mcc I see that sqlc still requires an older pg_query_go. I guess we need to wait until newer version of sqlc is available as well?

	github.com/pganalyze/pg_query_go/v5 v5.1.0 // indirect
	github.com/pganalyze/pg_query_go/v6 v6.1.0 // indirect

@kyleconroy
Copy link
Collaborator

@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.

@kyleconroy
Copy link
Collaborator

@vladmiller the latest main should not include any references to github.com/pganalyze/pg_query_go/v5. I've verified that it doesn't exist in go.mod or go.sum

@WillAbides
Copy link

The current HEAD (b4f2571) works for me on macos 15.4.

@vladmiller
Copy link

vladmiller commented Apr 15, 2025

@kyleconroy yay! Latest main works fine. Thank you!

In docs, one way to install sqlc is

go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest

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!

@matjam
Copy link

matjam commented Apr 15, 2025

painfully, if you're stuck on 15.2 then this seems to happen;

 go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest

# 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

I'll make sure my SDK is up to date.

@kyleconroy
Copy link
Collaborator

kyleconroy commented Apr 15, 2025 via email

@macrael
Copy link

macrael commented Apr 15, 2025

Who has the power to cut a new release? We're on v1.28.0 which is still broken and would rather update to a real release rather than main

@kyleconroy
Copy link
Collaborator

That's me! Been busy at work but trying to create a release in the next two days. Thanks for understanding.

@kyleconroy
Copy link
Collaborator

Alright, sadly the release workflow is borked right now due to some Apple code signing issues. I'm going to be traveling, so I'm not sure a release will happen in the next 10 days. I could tag a new release and not provide binaries, but that would cause more confusion.

In the meantime, please install from main which fixes this issue.

$ go install github.com/sqlc-dev/sqlc/cmd/sqlc@main

@kyleconroy
Copy link
Collaborator

1.29.0 is out!

@kyleconroy kyleconroy unpinned this issue Apr 17, 2025
@macrael
Copy link

macrael commented Apr 17, 2025

Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests