Skip to content

The tool stopped working on MacOS 15.4 #3916

Closed
hatchet-dev/hatchet
#1879

Description

@legosx

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

Activity

  1. added
    bug
    on Apr 2, 2025
  2. hishamk commented on Apr 2, 2025

    @hishamk

    Same error as well

  3. hishamk commented on Apr 2, 2025

    @hishamk

    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
    
  4. jrmullins commented on Apr 2, 2025

    @jrmullins

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

    export CGO_CFLAGS="-DHAVE_STRCHRNUL"

  5. havsar commented on Apr 2, 2025

    @havsar

    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.

  6. nginx-nickc commented on Apr 3, 2025

    @nginx-nickc

    sqlc from main, with github.com/pganalyze/pg_query_go/v6@v6.1.0 seems to work too.

  7. rubberduck203 commented on Apr 7, 2025

    @rubberduck203

    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

  8. pgr0ss commented on Apr 7, 2025

    @pgr0ss

    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!

  9. kyleconroy commented on Apr 8, 2025

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

  10. pinned this issue on Apr 8, 2025
  11. kyleconroy commented on Apr 11, 2025

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

  12. connor15mcc commented on Apr 14, 2025

    @connor15mcc

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

  13. 2 remaining items

  14. kyleconroy commented on Apr 14, 2025

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

  15. WillAbides commented on Apr 14, 2025

    @WillAbides

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

  16. vladmiller commented on Apr 15, 2025

    @vladmiller

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

  17. matjam commented on Apr 15, 2025

    @matjam

    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.

  18. kyleconroy commented on Apr 15, 2025

    @kyleconroy
    Collaborator
  19. macrael commented on Apr 15, 2025

    @macrael

    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

  20. kyleconroy commented on Apr 16, 2025

    @kyleconroy
    Collaborator

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

  21. kyleconroy commented on Apr 16, 2025

    @kyleconroy
    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
    
  22. kyleconroy commented on Apr 17, 2025

    @kyleconroy
    Collaborator

    1.29.0 is out!

  23. unpinned this issue on Apr 17, 2025
  24. macrael commented on Apr 17, 2025

    @macrael

    Thanks so much!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions